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

function totalStaked() public view returns (uint256)

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

function stakedOf(address user) public view returns (uint256)

Returns the total amount of eUSD and PeUSD borrowed by a specific user.

Parameters:

ParameterTypeDescription

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

function stakedLBRLpValue(address user) public view returns (uint256)

Returns the value of the user's staked LP tokens in the ETH-LBR liquidity pool.

ParameterTypeDescription

user

address

User's address.

lastTimeRewardApplicable()

function lastTimeRewardApplicable() public view returns (uint256)

Returns the last time when the reward was applicable.

rewardPerToken()

function rewardPerToken() public view returns (uint256)

Calculates and returns the current reward per token.

Returns: The reward per token.

refreshReward

function refreshReward(address _account) external updateReward(_account)

Updates the user's claimable reward data and records the timestamp.

ParameterTypeDescription

_account

address

User's address.

getBoost

function getBoost(address _account) public view returns (uint256)

Calculates and returns the boost for a user.

ParameterTypeDescription

_account

address

User's address.

Returns: The user's boost value.

earned

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

Calculates and returns the total earned rewards for a user.

ParameterTypeDescription

_account

address

User's address.

Returns: The total earned rewards.

isOtherEarningsClaimable

function isOtherEarningsClaimable(address user) public view returns (bool)

Checks if the user's earnings can be claimed by others.

ParameterTypeDescription

user

address

User's address.

Returns: A boolean indicating if the user's earnings can be claimed by others.

getReward

function getReward() external updateReward(msg.sender)

Claims the earned rewards for the calling user.

buyOthersEarnings

function buyOthersEarnings(address[] memory users, bool useEUSD) external

Allows the caller to purchase the earnings from multiple users.

ParameterTypeDescription

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