gno
gno copied to clipboard
feat(gnovm/tm2): add ZeroAddress constant
Contributors' checklist...
- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a
BREAKING CHANGE: xxx
message was included in the description - [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to generated graphs, if any. More info here.
After discussion in #2316, this PR does:
- add
std.ZeroAddress()
with addressg100000000000000000000000000000000dnmcnx
in tm2. - Logic: add coins to
zeroAddress
when user burn coin withSDKBanker.RemoveCoin()
- add a
ZeroAccount
withaccount_number
= 0 when initializing the chain - add
std.ZeroAddress()
ingnovm/std
in oder to help realm can burn coins to this address.
There are 2 main usecase of this adding that I think about:
- With native, user can burn coin by sending it to
ZeroAddress
❯ gnokey maketx send -gas-fee="1000ugnot" -gas-wanted="50000" -send="1000ugnot" -to g100000000000000000000000000000000dnmcnx -broadcast testKey
- With token like
grc20
, user can burn coin by calling transfer toZeroAddress
:
❯ gnokey maketx call -pkgpath "gno.land/r/thinhnx/foo20" -func "Transfer" -args "g100000000000000000000000000000000dnmcnx" -args "5000000000" -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast testKey
Status:
In this approach, I think we should deduct the total supply coin / token in chain, but it is neither implemented in native coin, nor grc20
standard. This may be relate to this @leohhhn 's PR #2314.
Demo:
Native coin
grc20 token - I changed admin address to mine when testing