Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the maximum supply cap by a percentage determined by governance #315

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

igorv43
Copy link

@igorv43 igorv43 commented Jul 27, 2023

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

@nghuyenthevinh2000
Copy link
Contributor

nghuyenthevinh2000 commented Jul 27, 2023

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

@nghuyenthevinh2000
Copy link
Contributor

please fix test as well

@nghuyenthevinh2000
Copy link
Contributor

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

@igorv43
Copy link
Author

igorv43 commented Jul 28, 2023

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

@inon-man inon-man changed the base branch from swap-enable to main August 8, 2023 07:54
@nghuyenthevinh2000
Copy link
Contributor

@alchemist-ti please look at this one

Copy link
Contributor

@alchemist-ti alchemist-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

x/market/keeper/msg_server.go Outdated Show resolved Hide resolved
@igorv43
Copy link
Author

igorv43 commented Sep 8, 2023

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

@alchemist-ti
Copy link
Contributor

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

@alchemist-ti
Copy link
Contributor

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

@igorv43
Copy link
Author

igorv43 commented Sep 20, 2023

@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 igorv43 closed this Sep 20, 2023
@igorv43
Copy link
Author

igorv43 commented Sep 20, 2023

@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 igorv43 reopened this Sep 20, 2023
@igorv43 igorv43 closed this Sep 21, 2023
@igorv43
Copy link
Author

igorv43 commented Sep 29, 2023

Sorry, I closed it by mistake

@igorv43 igorv43 reopened this Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants