core icon indicating copy to clipboard operation
core copied to clipboard

Reduce the maximum supply cap by a percentage determined by governance

Open igorv43 opened this issue 2 years ago • 11 comments

Summary of changes

Good morning! Guys, I'm sending a code that reduces the supply safely if you open the markt swap. Everything is explained in the link below:

https://medium.com/@igorsoares_41904/reduce-the-maximum-supply-cap-by-a-percentage-determined-by-governance-951695ca37bc

If possible, please test.

Attention needs to be deployed also on the burn rate, because if you have burn rate, you need to reduce the total maximum supply. But do not add the calculation with a percentage, but subtract the value burned by the maximum supply limit. it would be something like this:

amount:= burnTax supplyMaxDescending := k.GetSupplyMaxDescending(ctx, []byte("SupplyMaxDescending"+offerCoin.Denom)) k.SetSupplyMaxDescending(ctx, []byte("SupplyMaxDescending"+offerCoin.Denom), supplyMaxDescending.Sub(amount.TruncateInt()))

Report of required housekeeping

  • [ ] Github issue OR spec proposal link
  • [ ] Wrote tests
  • [ ] Updated API documentation (client/lcd/swagger-ui/swagger.yaml)
  • [ ] Added a relevant changelog entry: clog add [section] [stanza] [message]

(FOR ADMIN) Before merging

  • [ ] Added appropriate labels to PR
  • [ ] Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)
  • [ ] Confirm added tests are consistent with the intended behavior of changes
  • [ ] Ensure all tests pass

igorv43 avatar Jul 27 '23 13:07 igorv43

hi, thanks you for submitting the code, can you clear out all the conflicts first

nghuyenthevinh2000 avatar Jul 27 '23 13:07 nghuyenthevinh2000

please fix test as well

nghuyenthevinh2000 avatar Jul 27 '23 15:07 nghuyenthevinh2000

@igorv43 can we have a talk, I would love to talk to you

nghuyenthevinh2000 avatar Jul 27 '23 19:07 nghuyenthevinh2000

@nghuyenthevinh2000 Good evening, I sent you a DM, on discord

igorv43 avatar Jul 28 '23 00:07 igorv43

@alchemist-ti please look at this one

nghuyenthevinh2000 avatar Sep 02 '23 01:09 nghuyenthevinh2000

It seems to only limit the max supply, I don't understand how to reduce it.

The reduction takes place on exchange.

Total value of supply(TS) 1,000,000 Maximum value of supply(MS) 1,000,000 Percentage(P) 0.3 (30%) Exchange value LUNC-USTC(VT) 100,000 X = MS — (VT * P) X = 970,000 Values updated after exchange TS = 900,000 MS = 970,000

So I write it to the SetSupplyMaxDescending(MS) storage. Every change I consult getSupplyMaxDescending and check the limit if it is less than or equal to MS, let it change.

https://medium.com/@igorsoares_41904/reduce-the-maximum-supply-cap-by-a-percentage-determined-by-governance-951695ca37bc

igorv43 avatar Sep 08 '23 17:09 igorv43

@igorv43 I see. Have you considered the issue of swap pool prices being different from oracle prices if supply is limited?

alchemist-ti avatar Sep 12 '23 02:09 alchemist-ti

@igorv43 Parameters need to be initialized in the upgrade handler, you can refer to https://github.com/classic-terra/core/tree/main/app/upgrades.

alchemist-ti avatar Sep 12 '23 02:09 alchemist-ti

@igorv43Eu vejo. Você já considerou a questão dos preços do swap pool serem diferentes dos preços do oráculo se a oferta for limitada?

igorv43 avatar Sep 20 '23 16:09 igorv43

@igorv43 I see. Have you considered the issue of swap pool prices being different from oracle prices if supply is limited?

I hadn't taken into account, and I was unaware that the price could fluctuate. I had assumed they would calculate the market value. How can I check the current price?

igorv43 avatar Sep 20 '23 16:09 igorv43

Sorry, I closed it by mistake

igorv43 avatar Sep 29 '23 13:09 igorv43

thank you for your efforts. unfortunately this branch is completely out of sync - maybe try to rebase your changes on current branch.

fragwuerdig avatar May 09 '25 08:05 fragwuerdig