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

How to burn tokens to zero address #11020

Closed
bruce-wayne2 opened this issue Jan 25, 2022 · 14 comments · Fixed by #17569
Closed

How to burn tokens to zero address #11020

bruce-wayne2 opened this issue Jan 25, 2022 · 14 comments · Fixed by #17569

Comments

@bruce-wayne2
Copy link
Contributor

Sorry I can't join the discord (because the double counter),
I want to burn tokens to zero address(like solidity address(0)), but I didn't find the proper way, every one can help me.

/x/bank/keeper/keeper.go#BurnCoins ,seems to just reduce total supply?

@yihuang
Copy link
Collaborator

yihuang commented Jan 25, 2022

just send to zero address?

@bruce-wayne2
Copy link
Contributor Author

just send to zero address?

I want to reduce totalSupply and distribute the reduced amount to zero address.

@tac0turtle
Copy link
Member

Burncoins burns from module accounts. Are you trying to burn tokens owned by a user?

@bruce-wayne2
Copy link
Contributor Author

I tried to implement an ERC20-like mechanism through a custom module.When user trying to burn token, I want to send it to zero address.

@fedekunze
Copy link
Collaborator

fedekunze commented Oct 23, 2022

you can send the tokens to the bech32 representation of the 0x0 address (eg evmos1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3z33a4 on Evmos). If you want to burn the tokens you would need to create a custom MsgBurn that burns the tokens and removes them from circulation using the function from the Bank Keeper

@alexanderbez
Copy link
Contributor

I think the question is sufficiently answered here 👍

@larry0x
Copy link
Contributor

larry0x commented Jul 4, 2023

If you want to burn the tokens you would need to create a custom MsgBurn that burns the tokens and removes them from circulation using the function from the Bank Keeper

Are you guys open to a PR that adds this?

@alexanderbez
Copy link
Contributor

Yes I think so @larry0x, but we have to ensure it's only executed by the authority allowed to do it, e.g. governance.

@larry0x
Copy link
Contributor

larry0x commented Jul 4, 2023

Yes I think so @larry0x, but we have to ensure it's only executed by the authority allowed to do it, e.g. governance.

Hmm what's the problem letting people burn their tokens permissionlessly?

@alexanderbez
Copy link
Contributor

I misunderstood then. I assumed you wanted to burn tokens from a module account. I think there should probably be both. Allowing a user to burn their assets (permissionless) and a module account (authority-based).

@tac0turtle
Copy link
Member

i think it should all be permission less but a user could not say burn funds from x account. this goes back into the discussion of the router making sure only the signer/module from where the msg originates can call the message. Gov should not set bank as the address which is burning

@tac0turtle tac0turtle reopened this Jul 5, 2023
@alexanderbez
Copy link
Contributor

well I mean ValidateBasic should ensure the signer is the address that is burned from. This is no different than a MsgSend for example.

Gov should not set bank as the address which is burning

Not sure where you got this from? For burning module tokens, you need an authority s.t. it can be executed. The same way MsgUpdateParams are handled.

@tac0turtle
Copy link
Member

Validatebasic never checked the origin just if it can be decoded.

@alexanderbez
Copy link
Contributor

alexanderbez commented Jul 5, 2023

Validatebasic never checked the origin just if it can be decoded.

It did. It checked signer == <exepedted_origin>, e.g. sender or delegator. (eg. https://github.com/cosmos/cosmos-sdk/blob/v0.45.15/x/staking/types/msg.go#L172)

@github-project-automation github-project-automation bot moved this to 📝 Todo in Cosmos-SDK Aug 18, 2023
@tac0turtle tac0turtle self-assigned this Aug 29, 2023
@tac0turtle tac0turtle moved this from 📝 Todo to 👀 Needs Review in Cosmos-SDK Aug 29, 2023
@github-project-automation github-project-automation bot moved this from 👀 Needs Review to 👏 Done in Cosmos-SDK Sep 8, 2023
@tac0turtle tac0turtle removed this from Cosmos-SDK Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants