near-wallet icon indicating copy to clipboard operation
near-wallet copied to clipboard

Create the new version of UI/UX for displaying APY for farming validators

Open askulikov opened this issue 2 years ago • 3 comments

@stefanopepe @esaminu @agileurbanite

askulikov avatar Mar 22 '22 21:03 askulikov

Ack we will propose a UX in the next few days and reply in this issue.

agileurbanite avatar Mar 22 '22 22:03 agileurbanite

@corwinharrell, the APY is an "annual percentage yield" used to measure the interest rate.

Calling it APY can be tricky, as pools (see Aurora) might take $near, keep fees at 100%, and give back only Aurora tokens, which would yield 0% APY in $near tokens and a certain amount of $aurora tokens (or any other similar fungible token).

Example 1:

  • Aurora Pool takes 100% staking fees, offering 1,000,000 $aurora tokens over 12 months. They received already 190,000 $near staked, out of a grand total of 400,000,000 $near currently staked in the network
  • the user Alice stakes 10,000 $near, corresponding to 5% of the total of 200,000 $near staked in the pool
  • Alice's $near APY will be 0%, since Aurora Pool keeps 100% of the protocol rewards
  • $aurora Annual Yield will be 5% of 1,000,000 or 50,000 $aurora tokens >> this is because Alice holds 5% of all funds staked into the Aurora Pool
  • as of today, 1 $aurora is 0.59825470 $near, so the Annual Yield equivalent is (50,000 * 0.598)=29,900 $near
  • Alice's cumulative APY would be 0% $near from protocol rewards + (29,900/10,000)=299% from the $aurora fungible token rewards

Example 2:

  • Paras Pool takes 50% staking fees, offering 20,000,000 $paras tokens over 12 months. They received already 990,000 $near staked out of the 400,000,000 $near currently staked in the network
  • the user Bob stakes 10,000 $near, corresponding to 1% of the total of 1,000,000 $near staked
  • Bob's $near APY will be half of the protocol rewards, or (0.5 * 0.1125)=5.625%, since Paras Pool takes 50% or 0.5 in fees
  • $paras Annual Yield will be 1% of 20,000,000 or 200,000 $paras tokens
  • as of today, 1 $paras is 0.019 $near, or an Annual Yield equivalent of 3,800 $near
  • Bob's cumulative APY would be 5.625% $near from protocol rewards + (3,800/10,000)= 38% from the fungible tokens

Example 3:

  • Bison Trails Pool takes 10% staking fees, not offering fungible tokens. They received already 19,990,000 $near staked out of the 400,000,000 $near currently staked in the network
  • the user Charlie stakes 10,000 $near, corresponding to 0.05% of the total staked in the pool
  • Charlie's $near APY will be 90% of the protocol rewards since Bison Trails keep 10% in fees, or ((1-0.1)*0.1125)=10.125%
  • no fungible tokens are distributed by Bison Trails, so there are no additional Annual Yield to calculate
  • Charlie's cumulative APY would be 10.125% from protocol rewards, and nothing else

Notes:

  1. We simplified to a constant of 11.125% APY for the staking on the protocol, coming from the standard rewards of 4.5% over 1 billion tokens of supply, applied to 400 million $near staked
  2. We simplified the fungible tokens annual yields, since some pools may have a release schedule that is shorter than 12 months, so the APY (annual, 12 months) is lower
  3. The current calculation here is using USD as the unit of account instead of $near, which is faster to implement but requires to know the fungible token values in USD
  4. this calculation won't take into account the $near, $aurora and $paras exchange fluctuations: the 299% APY might change dramatically if the $near tokens and/or the $aurora token USD value increase or decrease in the double digit.

Will need an ack by @ilblackdragon to make sure we are all on the same page in terms of UI

stefanopepe avatar Mar 23 '22 20:03 stefanopepe

@stefanopepe , about the calculation in terms of prices. It might be wrong, but as I understand if we are using just math - there won't be any difference between the results. Anyway, we have to somewhere take data about prices. As we decided to use ref.finance - it is much easier to take prices of whitelisted tokens instead of selecting the pools and $near/$token ratio. Am I wrong?

askulikov avatar Mar 24 '22 16:03 askulikov