Staking

HOO's contracts for staking $AMBR.

Introduction

Version 1 of the staking contracts allows users to stake AMBR in order to earn USDC rewards over time. Future versions will allow for a split reward system with additional payouts in $esAMBR, and introduce a vesting system.

AmbrStaking

  • This is the main contract that handles user staking and tracks user state. Users deposit AMBR into the contract and accumulate USDC rewards.
  • Reward amounts are determined by the user's staked amount and the associated AmbrStakingRates contract's interest rate and reward multiplier.
  • A user can withdraw their tokens at any time.
  • A user's pending rewards are automatically claimed on any stake or withdrawal; rewards can also be manually claimed if desired.

AmbrStakingRates

  • This is the auxiliary contract to the AmbrStaking contract, and handles the interest rate and reward calculations using 64.64 fixed point math.
  • This contract is used to store the current interest rate and reward multiplier used in the AmbrStaking contract, as well as calculate pending rewards.
  • The contract functions via a constantly changing RewardRate based on previous and current interest rates. The RewardRate is shared by all users, and stored with timestamp on the AmbrStaking contract.
  • Reward calculations are performed by comparing the latest reward rate with a users previous reward rate.
    • Ex: Reward = (latestRewardRate - prevRewardRate) * stakedBalance * rewardScale
  • The interest rate can be updated in real time. Accrued interest from the previous interest rate is calculated and stored each time there is an interest rate update.
Last modified 9mo ago