near-wallet
near-wallet copied to clipboard
Create the new version of UI/UX for displaying APY for farming validators
@stefanopepe @esaminu @agileurbanite
Ack we will propose a UX in the next few days and reply in this issue.
@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, offering1,000,000
$aurora tokens over 12 months. They received already190,000
$near staked, out of a grand total of400,000,000
$near currently staked in the network - the user Alice stakes
10,000
$near, corresponding to5%
of the total of200,000
$near staked in the pool - Alice's $near APY will be
0%
, since Aurora Pool keeps100%
of the protocol rewards - $aurora Annual Yield will be
5%
of 1,000,000 or50,000
$aurora tokens >> this is because Alice holds 5% of all funds staked into the Aurora Pool - as of today,
1
$aurora is0.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, offering20,000,000
$paras tokens over 12 months. They received already990,000
$near staked out of the400,000,000
$near currently staked in the network - the user Bob stakes
10,000
$near, corresponding to1%
of the total of1,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%
of20,000,000
or200,000
$paras tokens - as of today,
1
$paras is0.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 already19,990,000
$near staked out of the400,000,000
$near currently staked in the network - the user Charlie stakes
10,000
$near, corresponding to0.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:
- We simplified to a constant of
11.125%
APY for the staking on the protocol, coming from the standard rewards of4.5%
over 1 billion tokens of supply, applied to 400 million $near staked - 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
- 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
- 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 , 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?