EUSDMiningIncentives
Contract Overview
EUSDMiningIncentives is a stripped down version of Synthetix StakingRewards.sol, to reward esLBR to eUSD&peUSD minters.
Differences from the original contract:
totalStaked and stakedOf(user) are different from the original version.
When a user's borrowing changes in any of the Lst vaults, the
refreshReward()
function needs to be called to update the data.This contract requires users to stake LP tokens in the StakingRewardsV2 contract with a value exceeding the minDlpRatio proportion of stakedOf(user). Otherwise, the mining rewards of the user can be purchased by others using LBR or eUSD at a value proportional to the biddingFeeRatio.
Function Documentation
totalStaked
View function to get the total amount of staked EUSD.
It iterates through the vaults array and retrieves the total circulation of each asset pool using the getPoolTotalCirculation() * function from the ILybra interface. The total staked amount is calculated by multiplying the total circulation by the vault's * weight (obtained from configurator.getVaultWeight()).
stakedOf
Returns the total amount of eUSD and PeUSD borrowed by a specific user.
Parameters:
user
address
The address of the user.
Similar to totalStaked()
, stakedOf(address user)
is equal to the sum of the user's borrowing amount in each vault multiplied by the weight of that vault.
stakedLBRLpValue
Returns the value of the user's staked LP tokens in the ETH-LBR liquidity pool.
user
address
User's address.
lastTimeRewardApplicable()
lastTimeRewardApplicable()
Returns the last time when the reward was applicable.
rewardPerToken()
rewardPerToken()
Calculates and returns the current reward per token.
Returns: The reward per token.
refreshReward
Updates the user's claimable reward data and records the timestamp.
_account
address
User's address.
getBoost
Calculates and returns the boost for a user.
_account
address
User's address.
Returns: The user's boost value.
earned
Calculates and returns the total earned rewards for a user.
_account
address
User's address.
Returns: The total earned rewards.
isOtherEarningsClaimable
Checks if the user's earnings can be claimed by others.
user
address
User's address.
Returns: A boolean indicating if the user's earnings can be claimed by others.
getReward
Claims the earned rewards for the calling user.
buyOthersEarnings
Allows the caller to purchase the earnings from multiple users.
users
address[]
An array of user addresses whose earnings will be purchased.
useEUSD
bool
Indicates if the purchase will be made using eUSD.
Last updated