Comment on page
QuestBoard
address GAUGE_CONTROLLER
Address of the Curve Gauge Controller
uint256 nextID
ID for the next Quest to be created
mapping(uint256 => struct IQuestBoard.Quest) quests
List of Quest (indexed by ID)
mapping(uint256 => mapping(uint256 => struct IQuestBoard.QuestPeriod)) periodsByQuest
Mapping of all QuestPeriod struct for each period of each Quest
mapping(uint256 => address) questDistributors
Mapping of Distributors used by each Quest to send rewards
mapping(uint256 => uint256) questWithdrawableAmount
Amount not distributed, for Quest creators to redeem
uint256 platformFeeRatio
Platform fees ratio (in BPS)
mapping(address => uint256) customPlatformFeeRatio
Mapping of specific fee ratio for some Quest creators
uint256 objectiveMinimalThreshold
Minimum Objective required
address questChest
Address of the Chest to receive platform fees
address distributor
Address of the reward Distributor contract
address biasCalculator
Address of the Bias Calculator Module
mapping(address => bool) approvedManagers
Mapping of addresses allowed to call manager methods
mapping(address => bool) whitelistedTokens
Whitelisted tokens that can be used as reward tokens
mapping(address => uint256) minRewardPerVotePerToken
Min rewardPerVote per token (to avoid spam creation of useless Quest)
bool isKilled
Boolean, true if the cotnract was killed, stopping main user functions
uint256 killTs
Timestamp when the contract was killed
struct QuestPeriod {
uint256 rewardAmountPerPeriod;
uint256 minRewardPerVote;
uint256 maxRewardPerVote;
uint256 minObjectiveVotes;
uint256 maxObjectiveVotes;
uint256 rewardAmountDistributed;
uint48 periodStart;
QuestDataTypes.PeriodState currentState;
}
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
struct Quest {
address creator;
address rewardToken;
address gauge;
uint48 duration;
uint48 periodStart;
uint256 totalRewardAmount;
QuestTypes types;
}
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
struct QuestTypes {
QuestDataTypes.QuestVoteType voteType;
QuestDataTypes.QuestRewardsType rewardsType;
QuestDataTypes.QuestCloseType closeType;
}
Struct with all the Quest types
event Init(address distributor, address biasCalculator)
Event emitted when the Board is Initialized
event NewQuest(uint256 questID, address creator, address gauge, address rewardToken, uint48 duration, uint256 startPeriod)
Event emitted when a new Quest is created
event ExtendQuestDuration(uint256 questID, uint256 addedDuration, uint256 addedRewardAmount)
Event emitted when the Quest duration is extended
event UpdateQuestParameters(uint256 questID, uint256 updatePeriod, uint256 newMinRewardPerVote, uint256 newMaxRewardPerVote, uint256 addedPeriodRewardAmount)
Event emitted when a Quest parameters are updated
event WithdrawUnusedRewards(uint256 questID, address recipient, uint256 amount)
Event emitted when Quest creator withdraw undistributed rewards
event PeriodClosed(uint256 questID, uint256 period)
Event emitted when a Period is Closed
event PeriodBiasFixed(uint256 questID, uint256 period, uint256 newBias)
Event emitted when a Period Bias is fixed
event WhitelistToken(address token, uint256 minRewardPerVote)
Event emitted when a new reward token is whitelisted
event UpdateRewardToken(address token, uint256 newMinRewardPerVote)
Event emitted when a reward token parameter is updated
event Killed(uint256 killTime)
Event emitted when the contract is killed
event Unkilled(uint256 unkillTime)
Event emitted when the contract is unkilled
event EmergencyWithdraw(uint256 questID, address recipient, uint256 amount)
Event emitted when the Quest creator withdraw all unused funds (if the contract was killed)
event ApprovedManager(address manager)
Event emitted when a new manager is approved
event RemovedManager(address manager)
Event emitted when a manager is removed
event ChestUpdated(address oldChest, address newChest)
Event emitted when the Chest address is updated
event SetCustomFeeRatio(address creator, uint256 customFeeRatio)
Event emitted when a custom fee ratio is set for a given address
event DistributorUpdated(address oldDistributor, address newDistributor)
Event emitted when the Distributor address is updated
event PlatformFeeRatioUpdated(uint256 oldFeeRatio, uint256 newFeeRatio)
Event emitted when the fee ratio is updated
event MinObjectiveUpdated(uint256 oldMinObjective, uint256 newMinObjective)
Event emitted when the minimum objective of votes is updated
modifier onlyAllowed()
Check the caller is either the admin or an approved manager
modifier isAlive()
Check that contract was not killed
modifier isInitialized()
Check that contract was initialized
constructor(address _gaugeController, address _chest) public
function init(address _distributor, address _biasCalculator) external
Initialize the contract
Parameters
Name | Type | Description |
---|---|---|
_distributor | address | Address of the Distributor |
_biasCalculator | address | Address of the Bias Calculator |
function getCurrentPeriod() public view returns (uint256)
Returns the current Period for the contract
Returns the current Period for the contract
function getQuestIdsForPeriod(uint256 period) external view returns (uint256[])
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 |
function getQuestIdsForPeriodForGauge(address gauge, uint256 period) external view returns (uint256[])
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 |
function getAllPeriodsForQuestId(uint256 questId) external view returns (uint48[])
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 |
function getAllQuestPeriodsForQuestId(uint256 questId) external view returns (struct IQuestBoard.QuestPeriod[])
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 |
function _getRemainingDuration(uint256 questID) internal view returns (uint256)
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) |
function getCurrentReducedBias(uint256 questID) external view returns (uint256)
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 |
function getQuestCreator(uint256 questID) external view returns (address)
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 |
function createFixedQuest(address gauge, address rewardToken, bool startNextPeriod, uint48 duration, uint256 rewardPerVote, uint256 totalRewardAmount, uint256 feeAmount, enum QuestDataTypes.QuestVoteType voteType, enum QuestDataTypes.QuestCloseType closeType, address[] voterList) external returns (uint256)
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 |
function createRangedQuest(address gauge, address rewardToken, bool startNextPeriod, uint48 duration, uint256 minRewardPerVote, uint256 maxRewardPerVote, uint256 totalRewardAmount, uint256 feeAmount, enum QuestDataTypes.QuestVoteType voteType, enum QuestDataTypes.QuestCloseType closeType, address[] voterList) external returns (uint256)
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 |
function _createQuest(address gauge, address rewardToken, struct IQuestBoard.QuestTypes types, bool startNextPeriod, uint48 duration, uint256 minRewardPerVote, uint256 maxRewardPerVote, uint256 totalRewardAmount, uint256 feeAmount, address[] voterList) internal returns (uint256 newQuestID)
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 |
function extendQuestDuration(uint256 questID, uint48 addedDuration, uint256 addedRewardAmount, uint256 feeAmount) external
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) |
function updateQuestParameters(uint256 questID, uint256 newMinRewardPerVote, uint256 newMaxRewardPerVote, uint256 addedPeriodRewardAmount, uint256 addedTotalRewardAmount, uint256 feeAmount) external
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) |
function withdrawUnusedRewards(uint256 questID, address recipient) external
Withdraw all undistributed rewards from Closed Quest Periods
Withdraw all undistributed rewards from Closed Quest Periods
Parameters