Bribe
Contract for third parties to bribe sDYSON holders into depositing their sDYSON in certain Gauge contract. Each Bribe contract is paired with one Gauge contract. Third parties can add multiple tokens as rewards. Please refer to Sponsorship section in our white paper to learn more.
addReward
Adds a reward of a given token to a specific week. Below is an introduction to what the function does:
Require Statement:
Ensures that the specified week is either the present week or a future week.
Token Transfer:
Transfers the specified amount of tokens from the caller's address to the Bribe contract.
Update Total Reward:
Increases the total reward amount for the given token and week by the specified amount.
This function is designed to be used by third parties to contribute rewards to the Bribe contract for specific tokens and weeks. The require
statement ensures that rewards cannot be added for past weeks. The function provides transparency by emitting an event for every reward addition.
Parameters:
token
address
Address of the token to add as a reward.
week
uint
The week to add the reward to (i-th week since 1970/01/01). It must be the present week or a future week.
amount
uint
Amount of the token to add as a reward.
_claimReward
Claims the reward by the user for a specific token and week. Below is the key actions in the function:
Require Statements:
Ensures that the specified week is in the past.
Ensures that the user has not already claimed the reward for the given token and week.
User and Total Votes Calculation:
Retrieves the user's voting power (
userVotes
) and the total voting power (totalVotes
) for the specified week from the associated Gauge contract.
Reward Calculation:
Calculates the amount of reward the user is eligible to claim based on their voting power relative to the total voting power.
Mark as Claimed:
Marks the reward as claimed for the user, preventing duplicate claims.
This function is internal and is used internally by the contract. It calculates and facilitates the claiming of rewards for a user for a specific token and week.
Parameters:
token
address
Address of the reward token.
week
uint
The week of the reward to claim (i-th week since 1970/01/01).
Return Values:
amount
uint
Amount of the claimed reward.
claimReward
Enables sDYSON holders to claim rewards for a specific token and week based on _claimReward
.
Parameters:
token
address
Address of the reward token.
week
uint
The week of the reward to claim (i-th week since 1970/01/01).
Return Values:
amount
uint
Amount of the claimed reward.
claimRewards
Claims multiple rewards by the user for a specific token and multiple weeks based on _claimReward
.
Parameters:
token
address
Address of the reward token.
week
uint[]
An array of weeks for which the user wants to claim rewards.
Return Values:
amount
uint
Total amount of the claimed rewards.
claimRewardsMultipleTokens
Claims multiple rewards for multiple tokens and multiple weeks based on _claimReward
.
Parameters:
token
address[]
An array of addresses of reward tokens.
week
uint[][]
An array of arrays of weeks for which the user wants to claim rewards.
Return Values:
amount
uint
An array of total amounts of the claimed rewards.
Last updated