deposit
User can Stake on StakeEasy using their SCRT or SSCRT coins and gets a liquidity token seSCRT.
To stake SCRT with StakeEasy user calls Stake SCRT
. It transfers SCRT/SSCRT coins from users wallet to contract. Now,
When User deposits SCRT in the contracts
When user stake (deposit) SCRT
coins in the stake-easy contract, it triggers try_stake
function of the contract -
try_stake
function fetches exchange rate fromexchange_rate
function and calculates seSCRT token amount that user will get and then sends mint message to thetoken_contract
which is a snip-20 token contract and it will mint the seSCRT token amount in the user's wallet.
When User deposits SSCRT in the contracts
When user deposit SSCRT coins in the stake-easy contract, Receive
call automatically gets triggered and it triggers try_withdraw
function of the contract -
try_withdraw
function after receivingSSCRT
coins fetch exchange rate fromexchange_rate
function and calculates seSCRT token amount that user will get and then sends mint message to thetoken_contract
and it will mint the seSCRT token amount in the user's wallet.
Exchange rate
Exchange_rate
function calculates
total seSCRT
tokens in the supply andtotal on chain SCRT
balance along with rewards (deposited SCRT in contract + rewards accumulated from validators)returns ratio of total sescrt to total on chain SCRT.
Stake from Contract to the validators - Claim_and_stake call
After users deposit in the contract -
Contract manager
or user callsClaimAndStake
which triggersclaim_and_stake
function.claim_and_stake
function collects -- the rewards accumulated to the validators and
- new deposits in the contract
and stake the collected amount to the validators.
claim_and_stake
is called every 8 hours to delegate the accumulated rewards and this way users get rid of staking their rewards again and again.Staking is done in such a way that keeps difference between staked amount on each validators minimum.