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
Parameter
Type
Description

amount

uint256

The amount of LBR tokens to stake.

unstake

Unlocks esLBR and converts it to LBR.

function unstake(uint256 amount) external
Parameter
Type
Description

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.

function reStake() external

withdraw

function withdraw(address user) public
Parameter
Type
Description

user

address

The address of the user.

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
Parameter
Type
Description

amount

uint256

The amount of esLBR to be purchased.

useEUSD

bool

Indicates if the purchase will be made using eUSD.

getPreUnlockableAmount

function getPreUnlockableAmount(address user) public view returns (uint256 amount)
Parameter
Type
Description

user

address

User address

Returns the amount of LBR that can be unlocked prematurely.

getClaimAbleLBR

function getClaimAbleLBR(address user) public view returns (uint256 amount)
Parameter
Type
Description

user

address

User address

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

getReservedLBRForVesting

function getReservedLBRForVesting(address user) public view returns (uint256 amount)
Parameter
Type
Description

user

address

User address

Returns the amount of LBR that is reserved for vesting.

earned

function earned(address _account) public view returns (uint)
Parameter
Type
Description

_account

address

User address

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
Parameter
Type
Description

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