cosmos-sdk icon indicating copy to clipboard operation
cosmos-sdk copied to clipboard

Add max-supply param to mint module

Open anilcse opened this issue 2 years ago • 4 comments

Summary

Currently a number of Cosmos based chains are announcing max-supply for their tokens but practically there's no hard-limit configurable in cosmos-sdk

Proposal

Introduce a new genesis param max-supply for mint module. Newly minted tokens should consider this limit

anilcse avatar Sep 15 '22 15:09 anilcse

teams that have a max supply are not using the cosmos-sdk mint module, they have forked. We should see what they have added and upstream (evmos, osmosis are two that come to mind)

tac0turtle avatar Sep 16 '22 07:09 tac0turtle

What would adding this parameter do exactly? Say we add it, we don't actually use or enforce maximum supply? Or are you suggesting that we add this param and limit minted tokens?

alexanderbez avatar Sep 16 '22 15:09 alexanderbez

What would adding this parameter do exactly? Say we add it, we don't actually use or enforce maximum supply? Or are you suggesting that we add this param and limit minted tokens?

Yes, this param will limit minting

anilcse avatar Sep 16 '22 15:09 anilcse

I mean I'm not necessarily opposed to it. But also, there really isn't any chain I know of that uses x/mint and has a capped supply.

alexanderbez avatar Sep 18 '22 17:09 alexanderbez

This is a good feature to be added to the mint module. This is actually an invariant though. What should be the default behavior of the chain after it reaches the max_supply value? Maybe it can continue running and validators will stop getting the inflation part as there will not be any inflation. The rest of the logic should be dependent on chains about what solution they bring to incentivize delegators and validators.

akure avatar Nov 01 '22 11:11 akure

I mean I'm not necessarily opposed to it. But also, there really isn't any chain I know of that uses x/mint and has a capped supply.

Akash and Passage have capped supply (on paper), they are planning to adjust the inflation (based on estimated timeline)

anilcse avatar Nov 01 '22 12:11 anilcse

would the interaction with the cap be effected by token burns?

tac0turtle avatar Nov 01 '22 14:11 tac0turtle

would the interaction with the cap be effected by token burns?

Hmm, not sure. But I think it should consider burned tokens or they should be sent to a burn address (such that IBC mint/burn doesn't get effected with this)

anilcse avatar Nov 01 '22 14:11 anilcse

I think - Effectively, It should be like.

current_total_supply = total minted so far + total burned so far

Two cases should be handled -

  1. Case 1 - If current_total_supply + expected_new_minting > max_supply then mint the diff ( max_supply - current_total_supply) and set the current_total_supply = max_supply
  2. Case 2 - If current_total_supply = max_supply, don't do anything.

Though this should be checked continuously on each block due to the possibility of burning. Whenever sufficient burn will happen, current_total_supply will be less than max_supply.

akure avatar Nov 01 '22 14:11 akure

Im open to adding this feature. We can add it in the simplest form of only a max of supply + burned and later one refactor it base of better calculations of mint and burn

tac0turtle avatar Mar 06 '23 10:03 tac0turtle