LootCreator

Contract handling the Budget for gauges & Quests and the Loot creation. The budget allocated to each Quest for each period is based on the weight of a gauge received through votes on the LootVoteController, and the number of Quest on each gauge. All unallocated budget is pushed back to the pending budget for the next period. The rewards allocated to Quest voters are allocated by this contract (which creates the Loot), based on the Quest allocation, the user voting rewards and the user boosting power. All rewards not allocated to an user for its Loot (by lack of boosting power) are pushed back to the pending budget for the next period. Each period budget is pulled from the LootBudget or the LootGauge.

BASE_MULTIPLIER

uint256 BASE_MULTIPLIER

Base Multiplier for Loot rewards

MAX_MULTIPLIER

uint256 MAX_MULTIPLIER

Max Multiplier for Loot rewards

Budget

Budget struct

struct Budget {
  uint128 palAmount;
  uint128 extraAmount;
}

Allocation

Allocation strcut

struct Allocation {
  uint128 palPerVote;
  uint128 extraPerVote;
}

CreateVars

Struct use in memory for Loot creation method

loot

Address of the Loot contract

lootVoteController

Address of the Loot Vote Controller contract

holyPower

Address of the HolyPalPower contract

lootGauge

Address of the Loot Gauge or Budget contract

allowedDistributors

Quest Distributors allowed to intract with this contract

distributorsBoards

QuestBoard for each Distributor

distributors

List of listed Quest Distributors

nextBudgetUpdatePeriod

Timestamp of the next Budget update

pendingBudget

Current pending budget to be used during next period

periodBudget

Budgets for each period

allocatedBudgetHistory

History of allocated amounts from the Budget of each period

gaugeBudgetPerPeriod

Budget allocated to a Gauge for each period

isGaugeAllocatedForPeriod

Was the gauge allocated a Budget for each period

totalQuestPeriodRewards

Total Rewards distributed for a period for a Quest

totalQuestPeriodSet

Was the total reward set for a Quest period

userQuestPeriodRewards

User claimed amount for a Quest period

userQuestPeriodCreated

User created Loot for a Quest period

Init

Event emitted when the contract is initialized

NewDistributorListed

Event emitted when a new Distributor is listed

DistributorUnlisted

Event emitted when Distributor is unlisted

GaugeUpdated

Event emitted when the budget Gauge is updated

LootCreated

Event emitted when a Loot is created

getBudgetForPeriod

Returns the global budget for a period

Parameters

Name
Type
Description

period

uint256

Timestamp of the period

Return Values

Name
Type
Description

palAmount

uint256

(uint256) : Amount of PAL tokens allocated for the period

extraAmount

uint256

(uint256) : Amount of extra tokens allocated for the period

getGaugeBudgetForPeriod

Returns the gauge budget for a period

Parameters

Name
Type
Description

gauge

address

Address of the gauge

period

uint256

Timestamp of the period

Return Values

Name
Type
Description

palAmount

uint256

(uint256) : Amount of PAL tokens allocated for the period

extraAmount

uint256

(uint256) : Amount of extra tokens allocated for the period

getQuestAllocationForPeriod

Returns the allocation for a Quest for a period

Parameters

Name
Type
Description

questId

uint256

ID of the Quest

distributor

address

Address of the Distributor handling the Quest rewards

period

uint256

Timestamp of the period

Return Values

Name
Type
Description

palPerVote

uint256

(uint256) : Amount of PAL tokens allocated for the period

extraPerVote

uint256

(uint256) : Amount of extra tokens allocated for the period

getListedDistributors

Returns all listed Distributors

Return Values

Name
Type
Description

[0]

address[]

uint256 : List of Distributors

createLoot

Creates a Loot for a user

Parameters

Name
Type
Description

user

address

Address of the user

distributor

address

Address of the Distributor handling the Quest rewards

questId

uint256

ID of the Quest

period

uint256

Timestamp of the period

createMultipleLoot

Creates multiple Loots for a user

Parameters

Name
Type
Description

user

address

Address of the user

params

struct ILootCreator.MultiCreate[]

Quest claim parameters (distributor, questId, period)

notifyQuestClaim

Notifies of a Quest claim

Parameters

Name
Type
Description

user

address

Address of the user

questId

uint256

ID of the Quest

period

uint256

Timestamp of the period

claimedAmount

uint256

Amount of rewards claimed by the user

notifyDistributedQuestPeriod

Notifies of a Quest period distribution

Parameters

Name
Type
Description

questId

uint256

ID of the Quest

period

uint256

Timestamp of the period

totalRewards

uint256

Total amount of rewards distributed for the period for the Quest

notifyAddedRewardsQuestPeriod

Notifies of the amount added to a Quest period via emergency update in Distributors

Parameters

Name
Type
Description

questId

uint256

ID of the Quest

period

uint256

Timestamp of the period

addedRewards

uint256

Amount added to the total

notifyUndistributedRewards

Notifies of undistributed rewards

Parameters

Name
Type
Description

palAmount

uint256

Amount of PAL tokens slashed

notifyNewBudget

Notifies of new budget

Parameters

Name
Type
Description

palAmount

uint256

Amount of PAL tokens added to the budget

extraAmount

uint256

Amount of extra tokens added to the budget

updatePeriod

Updates the period

Last updated

Was this helpful?