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
struct CreateVars {
address gauge;
uint256 userPower;
uint256 totalPower;
uint256 totalRewards;
uint256 lockedRatio;
uint256 rewardRatio;
uint256 totalRatio;
uint256 userPeriodRewards;
uint256 userMultiplier;
uint256 userPalAmount;
uint256 userExtraAmount;
}
loot
address loot
Address of the Loot contract
lootVoteController
address lootVoteController
Address of the Loot Vote Controller contract
holyPower
address holyPower
Address of the HolyPalPower contract
lootGauge
address lootGauge
Address of the Loot Gauge or Budget contract
allowedDistributors
mapping(address => bool) allowedDistributors
Quest Distributors allowed to intract with this contract
distributorsBoards
mapping(address => address) distributorsBoards
QuestBoard for each Distributor
distributors
address[] distributors
List of listed Quest Distributors
nextBudgetUpdatePeriod
uint256 nextBudgetUpdatePeriod
Timestamp of the next Budget update
pendingBudget
struct LootCreator.Budget pendingBudget
Current pending budget to be used during next period
periodBudget
mapping(uint256 => struct LootCreator.Budget) periodBudget
Budgets for each period
allocatedBudgetHistory
mapping(uint256 => struct LootCreator.Budget) allocatedBudgetHistory
History of allocated amounts from the Budget of each period
gaugeBudgetPerPeriod
mapping(address => mapping(uint256 => struct LootCreator.Budget)) gaugeBudgetPerPeriod
Budget allocated to a Gauge for each period
isGaugeAllocatedForPeriod
mapping(address => mapping(uint256 => bool)) isGaugeAllocatedForPeriod
Was the gauge allocated a Budget for each period
totalQuestPeriodRewards
mapping(address => mapping(uint256 => mapping(uint256 => uint256))) totalQuestPeriodRewards
Total Rewards distributed for a period for a Quest
totalQuestPeriodSet
mapping(address => mapping(uint256 => mapping(uint256 => bool))) totalQuestPeriodSet
Was the total reward set for a Quest period
userQuestPeriodRewards
mapping(address => mapping(uint256 => mapping(uint256 => mapping(address => uint256)))) userQuestPeriodRewards
User claimed amount for a Quest period
userQuestPeriodCreated
mapping(address => mapping(uint256 => mapping(uint256 => mapping(address => bool)))) userQuestPeriodCreated
User created Loot for a Quest period
Init
event Init(address lootGauge)
Event emitted when the contract is initialized
NewDistributorListed
event NewDistributorListed(address distributor)
Event emitted when a new Distributor is listed
DistributorUnlisted
event DistributorUnlisted(address distributor)
Event emitted when Distributor is unlisted
GaugeUpdated
event GaugeUpdated(address oldGauge, address newGauge)
Event emitted when the budget Gauge is updated
LootCreated
event LootCreated(address user, uint256 questId, uint256 period, uint256 lootId)
Event emitted when a Loot is created
getBudgetForPeriod
function getBudgetForPeriod(uint256 period) external view returns (uint256 palAmount, uint256 extraAmount)
Returns the global budget for a period
Parameters
period
uint256
Timestamp of the period
Return Values
palAmount
uint256
(uint256) : Amount of PAL tokens allocated for the period
extraAmount
uint256
(uint256) : Amount of extra tokens allocated for the period
getGaugeBudgetForPeriod
function getGaugeBudgetForPeriod(address gauge, uint256 period) external view returns (uint256 palAmount, uint256 extraAmount)
Returns the gauge budget for a period
Parameters
gauge
address
Address of the gauge
period
uint256
Timestamp of the period
Return Values
palAmount
uint256
(uint256) : Amount of PAL tokens allocated for the period
extraAmount
uint256
(uint256) : Amount of extra tokens allocated for the period
getQuestAllocationForPeriod
function getQuestAllocationForPeriod(uint256 questId, address distributor, uint256 period) external view returns (uint256 palPerVote, uint256 extraPerVote)
Returns the allocation for a Quest for a period
Parameters
questId
uint256
ID of the Quest
distributor
address
Address of the Distributor handling the Quest rewards
period
uint256
Timestamp of the period
Return Values
palPerVote
uint256
(uint256) : Amount of PAL tokens allocated for the period
extraPerVote
uint256
(uint256) : Amount of extra tokens allocated for the period
getListedDistributors
function getListedDistributors() external view returns (address[])
Returns all listed Distributors
Return Values
[0]
address[]
uint256 : List of Distributors
createLoot
function createLoot(address user, address distributor, uint256 questId, uint256 period) external
Creates a Loot for a user
Parameters
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
function createMultipleLoot(address user, struct ILootCreator.MultiCreate[] params) external
Creates multiple Loots for a user
Parameters
user
address
Address of the user
params
struct ILootCreator.MultiCreate[]
Quest claim parameters (distributor, questId, period)
notifyQuestClaim
function notifyQuestClaim(address user, uint256 questId, uint256 period, uint256 claimedAmount) external
Notifies of a Quest claim
Parameters
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
function notifyDistributedQuestPeriod(uint256 questId, uint256 period, uint256 totalRewards) external
Notifies of a Quest period distribution
Parameters
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
function notifyAddedRewardsQuestPeriod(uint256 questId, uint256 period, uint256 addedRewards) external
Notifies of the amount added to a Quest period via emergency update in Distributors
Parameters
questId
uint256
ID of the Quest
period
uint256
Timestamp of the period
addedRewards
uint256
Amount added to the total
notifyUndistributedRewards
function notifyUndistributedRewards(uint256 palAmount) external
Notifies of undistributed rewards
Parameters
palAmount
uint256
Amount of PAL tokens slashed
notifyNewBudget
function notifyNewBudget(uint256 palAmount, uint256 extraAmount) external
Notifies of new budget
Parameters
palAmount
uint256
Amount of PAL tokens added to the budget
extraAmount
uint256
Amount of extra tokens added to the budget
updatePeriod
function updatePeriod() external
Updates the period
Last updated
Was this helpful?