Advertisement
ktv6

Untitled

Sep 16th, 2022
1,049
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. def inf_apy():
  2.     auction_adjust = 0.3 / 60
  3.     auction_max = 60
  4.     falloff = 0.05
  5.     max_inflation = 0.1
  6.     min_inflation = 0.025
  7.     stake_target = 0.7504
  8.  
  9.     total_staked = 6_915_481_381_481_673_659
  10.     total_issuance = 12_723_233_806_674_928_899
  11.  
  12.     num_auctions = 52
  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.  
  20.     ideal_stake = stake_target - min(auction_max, num_auctions) * auction_adjust
  21.  
  22.     print(f'sf = {staked_fraction}_ is = {ideal_stake}')
  23.  
  24.     ideal_interest = max_inflation / ideal_stake
  25.     if staked_fraction <= ideal_stake:
  26.         inflation = min_inflation + staked_fraction * (ideal_interest - min_inflation / ideal_stake)
  27.     else:
  28.         power_of_two = 2 ** ((ideal_stake - staked_fraction) / falloff)
  29.         inflation = min_inflation + (ideal_interest * ideal_stake - min_inflation) * power_of_two
  30.         print(f'pow2 = {power_of_two}_ inf = {inflation}')
  31.  
  32.     return inflation, staked_fraction, inflation / staked_fraction, ideal_stake
  33.  
  34.  
  35. print(inf_apy())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement