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

[v18] Juno x/burn module #801

Merged
merged 11 commits into from
Sep 23, 2023
Merged

[v18] Juno x/burn module #801

merged 11 commits into from
Sep 23, 2023

Conversation

Reecepbcups
Copy link
Contributor

@Reecepbcups Reecepbcups commented Aug 21, 2023

Closes #647

Files of importance

  • x/burn/* (more of a wasm plugin override than a module)
  • app/keepers/keepers.go -> wasmkeeper.WithMessageHandler

Usage

There are 2 ways to burn tokens

  1. Send directly to the module account address juno1mj7t69y4r2adl3cnuq8y9uundkzawvx6avu7nj
  2. Bank::Burn in CosmWasm

TODO

@dimiandre
Copy link
Member

This way the query "juno q bank total" will be wrong and It's used by many third party services.

I'm not sure if this is the proper way to do it.

Probably better to keep the standard burn functions and modify our mint module so that it's also reduced in minter.TargetSupply

* reduce tokens in targetsupply when burning

* lint

---------

Co-authored-by: Reece Williams <[email protected]>
@Reecepbcups
Copy link
Contributor Author

TODO: Voting yes on the Unity contract continues to fail for not passing vote. Very odd its effecting SudoContracts

@dimiandre
Copy link
Member

dimiandre commented Sep 17, 2023

@Reecepbcups I pushed a new commit.

The burning was not working before because coins were sent to x/junoburn module but burn was happening on x/wasm

My commit:

  1. Removes burn permissions to x/wasm. This is to prevent other part of wasm handing burns in a not appropriate way. For example: https://github.com/CosmWasm/wasmd/blob/6a2bffd479acd212d76ac92681b1b6ec099e649d/x/wasm/keeper/keeper.go#L1188
  2. Give burn permission to junoburn module/plugin
  3. Fix module names, tokens are now transfered & burned from junoburn and never reaching wasm account
  4. Remove the total supply adjustment in mint module, it's not needed because we are modifying the target supply

This can be tested using docker and test contract in this repository https://github.com/dimiandre/cw-testburn/blob/39d44cc74911d34a369ed1d9af0af07efaefd982/contracts/first-contract/src/contract.rs#L50

junod tx wasm store ./first_contract-aarch64.wasm --from docker --gas-prices 0.001ujunox --gas 5000000

junod tx wasm instantiate 1 '{}' --admin="juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y" --from docker --gas-prices 0.0001ujunox --label "burn contract"

junod tx wasm execute juno14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9skjuwg8 '{"burn_token":{}}' --amount 1000000ujunox --from docker --gas-prices 0.0001ujunox

junod q bank balances juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y

@Reecepbcups Reecepbcups changed the title Add a JunoBurn module/wasm plugin Add Juno x/burn module Sep 21, 2023
@Reecepbcups Reecepbcups changed the title Add Juno x/burn module [v18] Juno x/burn module Sep 21, 2023
Copy link
Member

@dimiandre dimiandre left a comment

Choose a reason for hiding this comment

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

lgtm!

great job with contract refactor and tests!

@Reecepbcups Reecepbcups merged commit 8473deb into main Sep 23, 2023
21 checks passed
@Reecepbcups Reecepbcups deleted the reece/burn-without-mint branch September 23, 2023 18:54
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.

x/burn 🔥
2 participants