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 from totalSupply() in the esLBR contract.

  • Getting stakedOf(user) from balanceOf(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.

function stake(uint256 amount) external

unstake

Unlocks esLBR and converts it to LBR.

function unstake(uint256 amount) external

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.

function reStake() external

withdraw

function withdraw(address user) public

Claim unlocked LBR on behalf of a user.

unlockPrematurely

function unlockPrematurely() external

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.

function grabEsLBR(uint256 amount, bool useEUSD) external

getPreUnlockableAmount

function getPreUnlockableAmount(address user) public view returns (uint256 amount)

Returns the amount of LBR that can be unlocked prematurely.

getClaimAbleLBR

function getClaimAbleLBR(address user) public view returns (uint256 amount)

Returns the amount of LBR that can be claimed by the user.

getReservedLBRForVesting

function getReservedLBRForVesting(address user) public view returns (uint256 amount)

Returns the amount of LBR that is reserved for vesting.

earned

function earned(address _account) public view returns (uint)

Returns the total amount of rewards earned by the _account.

getReward

function getReward() external updateReward(msg.sender)

Claims the protocol rewards earnings for the caller.

notifyRewardAmount

function notifyRewardAmount(uint amount, uint tokenType) external

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