Active liquidity mining contracts are all here
For example, in USX/DF staking pool,
- 1.Get the price in USD of all assets, in this case, that would be USX and DF, assumption that the price is
- 2.Get total balance of USX and DF deposited in the LP contract, say
- 3.Calculate 1 LP token value should be:
vLP = (pUSX * tbUSX + pDF * tbDF) / LP.totalSupply;
- 4.Get total balance deposited in staking contract, say
tbLP, then the total value of deposited LP tokens should be:
tvLP = vLP * tbLP;
- 5.Get reward rate from staking contract, this variable represents the distributed amount of reward token per block, in Ethereum Mainnet, the block period is ~13 seconds (for BSC, it's about 3 seconds per block), so distribution value per year is:
tvR = pDF * RR(RewardRate) * blockPerYear;
blockPerYear = 3600 * 24 * 365 / block_peroid;
- 6.The annual yield should be:
annual_yield = tvR / tvLP * 100%;
Returns all activated staking contracts.
returns (address memory _allRecipients)
Every staking pool shares the same interface for users depositing/withdraw LP tokens and claim their rewards.
Returns the total distributed amount since start time.
function rewardDistributed() public view returns (uint256);
Returns the up-to-date amount of reward to be claimed.
function earned(address _account) public view returns (uint256);
Deposit LP token into staking pool.
function stake(uint256 _amount) public;
Withdraw LP token from staking pool.
function withdraw(uint256 _amount) public;
function getReward() public;
Withdraw all LP tokens and claim rewards.
function exit() external;