QuestBoard
Storage
GAUGE_CONTROLLER
Address of the Curve Gauge Controller
nextID
ID for the next Quest to be created
quests
List of Quest (indexed by ID)
periodsByQuest
Mapping of all QuestPeriod struct for each period of each Quest
questDistributors
Mapping of Distributors used by each Quest to send rewards
questWithdrawableAmount
Amount not distributed, for Quest creators to redeem
platformFeeRatio
Platform fees ratio (in BPS)
customPlatformFeeRatio
Mapping of specific fee ratio for some Quest creators
objectiveMinimalThreshold
Minimum Objective required
questChest
Address of the Chest to receive platform fees
distributor
Address of the reward Distributor contract
biasCalculator
Address of the Bias Calculator Module
approvedManagers
Mapping of addresses allowed to call manager methods
whitelistedTokens
Whitelisted tokens that can be used as reward tokens
minRewardPerVotePerToken
Min rewardPerVote per token (to avoid spam creation of useless Quest)
isKilled
Boolean, true if the cotnract was killed, stopping main user functions
killTs
Timestamp when the contract was killed
Structs
QuestPeriod
Struct for a Period of a Quest
rewardAmountPerPeriod : Total reward amount that can be distributed for that period
minRewardPerVote : Min Amount of reward for each vote (for 1 veToken)
maxRewardPerVote : Max Amount of reward for each vote (for 1 veToken)
minObjectiveVotes : Min Target Bias for the Gauge
maxObjectiveVotes : Max Target Bias for the Gauge
rewardAmountDistributed : Amount of reward to distribute, at period closing
periodStart : Timestamp of the Period start
currentState : Current state of the Period
Quest
Struct holding the parameters of the Quest common for all periods
creator : Address of the Quest creator
rewardToken : Address of the ERC20 used for rewards
gauge : Address of the target Gauge
duration : Total number of periods for the Quest
periodStart : Timestamp where the 1st QuestPeriod starts
totalRewardAmount : Total amount of rewards paid for this Quest
types : Quest Types
QuestTypes
Struct with all the Quest types
Events
Init
Event emitted when the Board is Initialized
NewQuest
Event emitted when a new Quest is created
ExtendQuestDuration
Event emitted when the Quest duration is extended
UpdateQuestParameters
Event emitted when a Quest parameters are updated
WithdrawUnusedRewards
Event emitted when Quest creator withdraw undistributed rewards
PeriodClosed
Event emitted when a Period is Closed
PeriodBiasFixed
Event emitted when a Period Bias is fixed
WhitelistToken
Event emitted when a new reward token is whitelisted
UpdateRewardToken
Event emitted when a reward token parameter is updated
Killed
Event emitted when the contract is killed
Unkilled
Event emitted when the contract is unkilled
EmergencyWithdraw
Event emitted when the Quest creator withdraw all unused funds (if the contract was killed)
ApprovedManager
Event emitted when a new manager is approved
RemovedManager
Event emitted when a manager is removed
ChestUpdated
Event emitted when the Chest address is updated
SetCustomFeeRatio
Event emitted when a custom fee ratio is set for a given address
DistributorUpdated
Event emitted when the Distributor address is updated
PlatformFeeRatioUpdated
Event emitted when the fee ratio is updated
MinObjectiveUpdated
Event emitted when the minimum objective of votes is updated
Modifiers
onlyAllowed
Check the caller is either the admin or an approved manager
isAlive
Check that contract was not killed
isInitialized
Check that contract was initialized
Constructor
init
Initialize the contract
Parameters
Name | Type | Description |
---|---|---|
_distributor | address | Address of the Distributor |
_biasCalculator | address | Address of the Bias Calculator |
View Methods
getCurrentPeriod
Returns the current Period for the contract
Returns the current Period for the contract
getQuestIdsForPeriod
Returns the list of all Quest IDs active on a given period
Returns the list of all Quest IDs active on a given period
Parameters
Name | Type | Description |
---|---|---|
period | uint256 | Timestamp of the period |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256[] | uint256[] : Quest IDs for the period |
getQuestIdsForPeriodForGauge
Returns the list of all Quest IDs active on a given period
Returns the list of all Quest IDs active on a given period
Parameters
Name | Type | Description |
---|---|---|
gauge | address | |
period | uint256 | Timestamp of the period |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256[] | uint256[] : Quest IDs for the period |
getAllPeriodsForQuestId
Returns all periods for a Quest
Returns all period timestamps for a Quest ID
Parameters
Name | Type | Description |
---|---|---|
questId | uint256 | ID of the Quest |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint48[] | uint256[] : List of period timestamps |
getAllQuestPeriodsForQuestId
Returns all QuestPeriod of a given Quest
Returns all QuestPeriod of a given Quest ID
Parameters
Name | Type | Description |
---|---|---|
questId | uint256 | ID of the Quest |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct IQuestBoard.QuestPeriod[] | QuestPeriod[] : list of QuestPeriods |
_getRemainingDuration
Returns the number of periods to come for a given Quest
Returns the number of periods to come for a given Quest
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint : remaining duration (non active periods) |
getCurrentReducedBias
Returns the current reduced bias of a gauge for a given Quest
Returns the current reduced bias of a gauge for a given Quest
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : current reduced bias of the gauge |
getQuestCreator
Returns the address of the Quest creator
Returns the address of the Quest creator
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | address : creator of the Quest |
State-changing Methods
createFixedQuest
Creates a fixed rewards Quest based on the given parameters
Creates a Quest based on the given parameters & the given types with the Fixed Rewards type
Parameters
Name | Type | Description |
---|---|---|
gauge | address | Address of the gauge |
rewardToken | address | Address of the reward token |
startNextPeriod | bool | (bool) true to start the Quest the next period |
duration | uint48 | Duration of the Quest (in weeks) |
rewardPerVote | uint256 | Amount of reward/vote (in wei) |
totalRewardAmount | uint256 | Total amount of rewards available for the full Quest duration |
feeAmount | uint256 | Amount of fees paid at creation |
voteType | enum QuestDataTypes.QuestVoteType | Vote type for the Quest |
closeType | enum QuestDataTypes.QuestCloseType | Close type for the Quest |
voterList | address[] | List of voters for the Quest (to be used for Blacklist or Whitelist) |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : ID of the newly created Quest |
createRangedQuest
Creates a ranged rewards Quest based on the given parameters
Creates a Quest based on the given parameters & the given types with the Ranged Rewards type
Parameters
Name | Type | Description |
---|---|---|
gauge | address | Address of the gauge |
rewardToken | address | Address of the reward token |
startNextPeriod | bool | (bool) true to start the Quest the next period |
duration | uint48 | Duration of the Quest (in weeks) |
minRewardPerVote | uint256 | Minimum amount of reward/vote (in wei) |
maxRewardPerVote | uint256 | Maximum amount of reward/vote (in wei) |
totalRewardAmount | uint256 | Total amount of rewards available for the full Quest duration |
feeAmount | uint256 | Amount of fees paid at creation |
voteType | enum QuestDataTypes.QuestVoteType | Vote type for the Quest |
closeType | enum QuestDataTypes.QuestCloseType | Close type for the Quest |
voterList | address[] | List of voters for the Quest (to be used for Blacklist or Whitelist) |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : ID of the newly created Quest |
_createQuest
Creates a Quest based on the given parameters
Creates a Quest based on the given parameters & the given types
Parameters
Name | Type | Description |
---|---|---|
gauge | address | Address of the gauge |
rewardToken | address | Address of the reward token |
types | struct IQuestBoard.QuestTypes | Quest Types (Rewards, Vote & Close) |
startNextPeriod | bool | (bool) true to start the Quest the next period |
duration | uint48 | Duration of the Quest (in weeks) |
minRewardPerVote | uint256 | Minimum amount of reward/vote (in wei) |
maxRewardPerVote | uint256 | Maximum amount of reward/vote (in wei) |
totalRewardAmount | uint256 | Total amount of rewards available for the full Quest duration |
feeAmount | uint256 | Amount of fees paid at creation |
voterList | address[] | List of voters for the Quest (to be used for Blacklist or Whitelist) |
Return Values
Name | Type | Description |
---|---|---|
newQuestID | uint256 | (uint256) : ID of the newly created Quest |
extendQuestDuration
Increases the duration of a Quest
Adds more QuestPeriods and extends the duration of a Quest
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
addedDuration | uint48 | Number of period to add |
addedRewardAmount | uint256 | Amount of reward to add for the new periods (in wei) |
feeAmount | uint256 | Platform fees amount (in wei) |
updateQuestParameters
Updates the parametes of the Quest
Updates the reward/vote parameters, allowing to update the Quest objectives too
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
newMinRewardPerVote | uint256 | New min reward/vote value (in wei) |
newMaxRewardPerVote | uint256 | New max reward/vote value (in wei) |
addedPeriodRewardAmount | uint256 | Amount of reward to add for each period (in wei) |
addedTotalRewardAmount | uint256 | Amount of reward to add for all periods (in wei) |
feeAmount | uint256 | Platform fees amount (in wei) |
withdrawUnusedRewards
Withdraw all undistributed rewards from Closed Quest Periods
Withdraw all undistributed rewards from Closed Quest Periods
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
recipient | address | Address to send the reward tokens to |
emergencyWithdraw
Emergency withdraws all undistributed rewards from Closed Quest Periods & all rewards for Active Periods
Emergency withdraws all undistributed rewards from Closed Quest Periods & all rewards for Active Periods
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
recipient | address | Address to send the reward tokens to |
Internal Methods
_getFeeRatio
Get the fee ratio for a given Quest creator
Returns the custom fee ratio for a Quest creator if set, otherwise returns the general fee ratio
Parameters
Name | Type | Description |
---|---|---|
questCreator | address | address of the Quest creator |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : fee ratio |
_getDistributionAmount
Gets the amount of rewards to be distributed for the period
Gets the amount of rewards to be distributed for the
Parameters
Name | Type | Description |
---|---|---|
questRewardType | enum QuestDataTypes.QuestRewardsType | Rewards type for the Quest |
periodBias | uint256 | Bias of the gauge (reduced if nedded) for the given period |
_questPeriod | struct IQuestBoard.QuestPeriod | Data for the Quest Period |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 : Amount to be distributed |
_handleUndistributedRewards
Handles the Quest period undistributed rewards
Handles the Quest period undistributed rewards based on the Quest Close type
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
currentPeriod | uint256 | Timestamp of the current period |
questCloseType | enum QuestDataTypes.QuestCloseType | Close type for the Quest |
rewardToken | address | Address of the reward token |
undistributedAmount | uint256 | Amount of token not distributed for voter rewards |
_closeQuestPeriod
Closes the Period, and all QuestPeriods for this period
Closes all QuestPeriod for the given period, calculating rewards to distribute & send them to distributor
Parameters
Name | Type | Description |
---|---|---|
period | uint256 | Timestamp of the period |
questID | uint256 |
Manager Methods
closeQuestPeriod
Closes the Period, and all QuestPeriods for this period
Closes all QuestPeriod for the given period, calculating rewards to distribute & send them to distributor
Parameters
Name | Type | Description |
---|---|---|
period | uint256 | Timestamp of the period |
closePartOfQuestPeriod
Closes the given QuestPeriods for the Period
Closes the given QuestPeriods for the Period, calculating rewards to distribute & send them to distributor
Parameters
Name | Type | Description |
---|---|---|
period | uint256 | Timestamp of the period |
questIDs | uint256[] | List of the Quest IDs to close |
_addMerkleRoot
Sets the QuestPeriod as disitrbuted, and adds the MerkleRoot to the Distributor contract
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
period | uint256 | Timestamp of the period |
totalAmount | uint256 | sum of all rewards for the Merkle Tree |
merkleRoot | bytes32 | MerkleRoot to add |
addMerkleRoot
Sets the QuestPeriod as disitrbuted, and adds the MerkleRoot to the Distributor contract
_internal call to addMerkleRoot()
Parameters
Name | Type | Description |
---|---|---|
questID | uint256 | ID of the Quest |
period | uint256 | Timestamp of the period |
totalAmount | uint256 | sum of all rewards for the Merkle Tree |
merkleRoot | bytes32 | MerkleRoot to add |
addMultipleMerkleRoot
Sets a list of QuestPeriods as disitrbuted, and adds the MerkleRoot to the Distributor contract for each
_Loop and internal call to addMerkleRoot()
Parameters
Name | Type | Description |
---|---|---|
questIDs | uint256[] | List of Quest IDs |
period | uint256 | Timestamp of the period |
totalAmounts | uint256[] | List of sums of all rewards for the Merkle Tree |
merkleRoots | bytes32[] | List of MerkleRoots to add |
whitelistToken
Whitelists a reward token
Whitelists a reward token
Parameters
Name | Type | Description |
---|---|---|
newToken | address | Address of the reward token |
minRewardPerVote | uint256 | Minimal threshold of reward per vote for the reward token |
whitelistMultipleTokens
Whitelists a list of reward tokens
Whitelists a list of reward tokens
Parameters
Name | Type | Description |
---|---|---|
newTokens | address[] | List of reward tokens addresses |
minRewardPerVotes | uint256[] | List of minimal threshold of reward per vote for the reward token |
updateRewardToken
Updates a reward token parameters
Updates a reward token parameters
Parameters
Name | Type | Description |
---|---|---|
newToken | address | Address of the reward token |
newMinRewardPerVote | uint256 | New minimal threshold of reward per vote for the reward token |
Admin Methods
fixQuestPeriodBias
Approves a new address as manager
Approves a new address as manager
Parameters
Name | Type | Description |
---|---|---|
period | uint256 | Timestamp fo the period to fix |
questID | uint256 | ID of the Quest |
correctReducedBias | uint256 | Currect bias to be used for the Quest period |
approveManager
Approves a new address as manager
Approves a new address as manager
Parameters
Name | Type | Description |
---|---|---|
newManager | address | Address to add |
removeManager
Removes an address from the managers
Removes an address from the managers
Parameters
Name | Type | Description |
---|---|---|
manager | address | Address to remove |
updateChest
Updates the Chest address
Updates the Chest address
Parameters
Name | Type | Description |
---|---|---|
chest | address | Address of the new Chest |
updateDistributor
Updates the Distributor address
Updates the Distributor address
Parameters
Name | Type | Description |
---|---|---|
newDistributor | address | Address of the new Distributor |
updatePlatformFee
Updates the Platfrom fees BPS ratio
Updates the Platfrom fees BPS ratio
Parameters
Name | Type | Description |
---|---|---|
newFee | uint256 | New fee ratio |
updateMinObjective
Updates the min objective value
Updates the min objective value
Parameters
Name | Type | Description |
---|---|---|
newMinObjective | uint256 | New min objective |
setCustomFeeRatio
Sets a custom fee ratio for a given address
Sets a custom fee ratio for a given address
Parameters
Name | Type | Description |
---|---|---|
user | address | User address |
customFeeRatio | uint256 | Custom fee ratio |
recoverERC20
Recovers ERC2O tokens sent by mistake to the contract
Recovers ERC2O tokens sent by mistake to the contract
Parameters
Name | Type | Description |
---|---|---|
token | address | Address tof the EC2O token |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool: success |
killBoard
Kills the contract
Kills the contract
unkillBoard
Unkills the contract
Unkills the contract
Maths
safe48
Last updated