ProtocolRewardsPool
This contract is a derivative version of Synthetix StakingRewards.sol and is responsible for distributing protocol rewards to esLBR stakers and converting esLBR to LBR.
Differences from the original contract include:
Getting
totalStaked
fromtotalSupply()
in the esLBR contract.Getting
stakedOf(user)
frombalanceOf(user)
in the esLBR contract.Calling the
refreshReward
method when the esLBR balance of an address changes to update the rewards to be claimed.This contract includes the functionality to convert between esLBR and LBR tokens. When converting from esLBR to LBR, there is a gradual unlocking process over a period of time. Users are allowed to unlock in advance, but they will lose a portion of their esLBR tokens. These lost esLBR tokens can be purchased by other users using a small amount of LBR.
Functions
stake
Stakes LBR tokens.
amount
uint256
The amount of LBR tokens to stake.
unstake
Unlocks esLBR and converts it to LBR.
amount
uint256
The amount of esLBR tokens to unstake.
Requirements:
If the current time is less than the unlock time of the user's lock status in the esLBRBoost contract, the locked portion in the esLBRBoost contract cannot be unlocked.
reStake
Converts unredeemed and converting esLBR tokens back to LBR.
withdraw
user
address
The address of the user.
Claim unlocked LBR on behalf of a user.
unlockPrematurely
Redeems and converts the esLBR being claimed in advance, with the lost portion being recorded in the contract and available for others to purchase in LBR at a certain ratio.
grabEsLBR
Purchases the accumulated amount of pre-claimed lost esLBR in the contract using LBR or eUSD.
amount
uint256
The amount of esLBR to be purchased.
useEUSD
bool
Indicates if the purchase will be made using eUSD.
getPreUnlockableAmount
user
address
User address
Returns the amount of LBR that can be unlocked prematurely.
getClaimAbleLBR
user
address
User address
Returns the amount of LBR that can be claimed by the user.
getReservedLBRForVesting
user
address
User address
Returns the amount of LBR that is reserved for vesting.
earned
_account
address
User address
Returns the total amount of rewards earned by the _account
.
getReward
Claims the protocol rewards earnings for the caller.
notifyRewardAmount
amount
uint
The amount of rewards to be distributed.
tokenType
uint
The type of token (0 for peUSD, 1 for other stablecoins).
Receives stablecoin tokens sent by the configurator contract and records the protocol rewards accumulation per esLBR held. This function is called by the configurator contract to distribute rewards. When receiving stablecoin tokens other than peUSD, the decimals of the token are converted to 18 for consistent calculations.
Last updated