Skip to content

Add Dynamic Inflation

Bitol Maya requested to merge MAYA-77 into develop

constants/constant_values.go:

  • Added InflationPercentageThreshold for setting the threshold in which the dynamic inflation should not mint.
  • Added InflationPoolPercentage for setting the percentage that the pool should receive from the minted cacao.

constants/constants_v1.go:

  • Added InflationPercentageThreshold = 90 for setting the threshold in which the dynamic inflation should not mint.
  • Added InflationPoolPercentage = 50 for setting the percentage that the pool should receive from the minted cacao.

x/thorchain/keeper/keeper.go:

  • Added DynamicInflation function prototype.

x/thorchain/keeper/keeper_dummy.go:

  • Added DynamicInflation function prototype to dummy keeper.

x/thorchain/keeper/v1/keeper_network_fee.go:

  • Added function GetCACAOOnPools in which it gets all the pools and sum the cacao on their BalanceRune.
  • Added function DynamicInflation in which calculate a y = cacaoOnPools / cacaoOnChain and then used formula inflation = ((1-y)*40)+1, which represent a percentage to mint based on the cacaoOnChain. If the relation y >= 90% it should not mint anything. For more information see: https://docs.google.com/document/d/126pnKeC7N9wy-bluy9kJUfVt4jUjiDvW5KY7TWIZ9P4/edit
  • Added function distributeDynamicInflation in which it distribute the minted cacao to:
  1. 50% to pools
  2. 50% to SystemIncome -> [90% Reserve, 10% MayaFund]

x/thorchain/keeper/v1/keeper_network_fee_test.go:

  • Added unit test for DynamicInflation, GetCACAOOnPools and distributeDynamicInflation

x/thorchain/keeper/v1/keeper_test.go:

  • Added setup test for inflation

x/thorchain/manager_gas_current.go:

  • Added the called for function DynamicInflation on EndBlock

FEATURE DESCRIPTION:

image

Edited by Bitol Maya

Merge request reports