Advertisement
ktv6

Estimated APY [DOT]

Sep 15th, 2022 (edited)
954
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. def inf_apy():
  2.     auction_adjust = 0
  3.     auction_max = 0
  4.     falloff = 0.05
  5.     max_inflation = 0.1
  6.     min_inflation = 0.025
  7.     stake_target = 0.75
  8.  
  9.     total_staked = 6_420_000_493_040_793_352
  10.     total_issuance = 12_325_604_969_594_086_733
  11.  
  12.     num_auctions = 27
  13.  
  14.     if total_staked == 0 or total_issuance == 0:
  15.         staked_fraction = 0
  16.     else:
  17.         staked_fraction = total_staked / total_issuance
  18.  
  19.     ideal_stake = stake_target - min(auction_max, num_auctions) * auction_adjust
  20.     ideal_interest = max_inflation / ideal_stake
  21.     if staked_fraction <= ideal_stake:
  22.         inflation = min_inflation + staked_fraction * (ideal_interest - min_inflation / ideal_stake)
  23.     else:
  24.         power_of_two = 2 ** ((ideal_stake - staked_fraction) / falloff)
  25.         inflation = min_inflation + (ideal_interest * ideal_stake - min_inflation) * power_of_two
  26.  
  27.     return inflation, staked_fraction, inflation / staked_fraction
  28.  
  29.  
  30. print(inf_apy())
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement