-
Notifications
You must be signed in to change notification settings - Fork 460
fix(grc20)!: decouple token id from symbol #5908
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
288cdb0
fix(grc20): decouple token id from symbol
notJoon c8ecbb0
Merge remote-tracking branch 'upstream/master' into fix/grc20-token-id
notJoon 35fca35
fix: update API and use seqid
notJoon 04d9bbb
fix
notJoon f289153
fix: use `seqid.ID` type instead of string
notJoon 705d222
refator: remove `origRealm` from `Token` typedef
notJoon 1e38ea0
fix ci
notJoon d5d1c73
fix ci
notJoon 2db1bfc
Merge branch 'master' into fix/grc20-token-id
aeddi 8e0aabc
Merge remote-tracking branch 'upstream/master' into fix/grc20-token-id
notJoon 681f84b
fix(grc20reg): key registry by rlmPath.symbol, not full Token.ID()
moul a947093
Merge remote-tracking branch 'origin/master' into wip-5908
moul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
examples/gno.land/p/demo/tokens/grc20/filetests/token_identity_filetest.gno
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| // PKGPATH: gno.land/r/demo/grc20identity | ||
|
|
||
| package grc20identity | ||
|
|
||
| import ( | ||
| "chain" | ||
|
|
||
| "gno.land/p/demo/tokens/grc20" | ||
| "gno.land/p/nt/seqid/v0" | ||
| ) | ||
|
|
||
| var nextTokenID seqid.ID | ||
|
|
||
| func main(cur realm) { | ||
| first, firstLedger := newToken(cur) | ||
| second, secondLedger := newToken(cur) | ||
|
|
||
| if first.ID() != "gno.land/r/demo/grc20identity.0000001" { | ||
| panic("unexpected first token ID: " + first.ID()) | ||
| } | ||
| if second.ID() != "gno.land/r/demo/grc20identity.0000002" { | ||
| panic("unexpected second token ID: " + second.ID()) | ||
| } | ||
|
|
||
| holder := chain.PackageAddress("holder") | ||
| spender := chain.PackageAddress("spender") | ||
| firstLedger.Mint(holder, 1) | ||
| firstLedger.Approve(holder, spender, 1) | ||
| secondLedger.Mint(holder, 2) | ||
| secondLedger.Approve(holder, spender, 2) | ||
| } | ||
|
|
||
| func newToken(cur realm) (*grc20.Token, *grc20.PrivateLedger) { | ||
| id := nextTokenID.Next().String() | ||
| return grc20.NewToken("Same", "DUP", 6, id, cur) | ||
| } | ||
|
|
||
| // Events: | ||
| // [ | ||
| // { | ||
| // "type": "Transfer", | ||
| // "attrs": [ | ||
| // { | ||
| // "key": "token", | ||
| // "value": "gno.land/r/demo/grc20identity.0000001" | ||
| // }, | ||
| // { | ||
| // "key": "from", | ||
| // "value": "" | ||
| // }, | ||
| // { | ||
| // "key": "to", | ||
| // "value": "g18rwjsdf0kcy673ta0q4ujwvsncz4k2a8gcv94t" | ||
| // }, | ||
| // { | ||
| // "key": "value", | ||
| // "value": "1" | ||
| // } | ||
| // ], | ||
| // "pkg_path": "gno.land/p/demo/tokens/grc20" | ||
| // }, | ||
| // { | ||
| // "type": "Approval", | ||
| // "attrs": [ | ||
| // { | ||
| // "key": "token", | ||
| // "value": "gno.land/r/demo/grc20identity.0000001" | ||
| // }, | ||
| // { | ||
| // "key": "owner", | ||
| // "value": "g18rwjsdf0kcy673ta0q4ujwvsncz4k2a8gcv94t" | ||
| // }, | ||
| // { | ||
| // "key": "spender", | ||
| // "value": "g148tp8xkvvk3l73lmxywpdlsxgdujjlclx7wfyg" | ||
| // }, | ||
| // { | ||
| // "key": "value", | ||
| // "value": "1" | ||
| // } | ||
| // ], | ||
| // "pkg_path": "gno.land/p/demo/tokens/grc20" | ||
| // }, | ||
| // { | ||
| // "type": "Transfer", | ||
| // "attrs": [ | ||
| // { | ||
| // "key": "token", | ||
| // "value": "gno.land/r/demo/grc20identity.0000002" | ||
| // }, | ||
| // { | ||
| // "key": "from", | ||
| // "value": "" | ||
| // }, | ||
| // { | ||
| // "key": "to", | ||
| // "value": "g18rwjsdf0kcy673ta0q4ujwvsncz4k2a8gcv94t" | ||
| // }, | ||
| // { | ||
| // "key": "value", | ||
| // "value": "2" | ||
| // } | ||
| // ], | ||
| // "pkg_path": "gno.land/p/demo/tokens/grc20" | ||
| // }, | ||
| // { | ||
| // "type": "Approval", | ||
| // "attrs": [ | ||
| // { | ||
| // "key": "token", | ||
| // "value": "gno.land/r/demo/grc20identity.0000002" | ||
| // }, | ||
| // { | ||
| // "key": "owner", | ||
| // "value": "g18rwjsdf0kcy673ta0q4ujwvsncz4k2a8gcv94t" | ||
| // }, | ||
| // { | ||
| // "key": "spender", | ||
| // "value": "g148tp8xkvvk3l73lmxywpdlsxgdujjlclx7wfyg" | ||
| // }, | ||
| // { | ||
| // "key": "value", | ||
| // "value": "2" | ||
| // } | ||
| // ], | ||
| // "pkg_path": "gno.land/p/demo/tokens/grc20" | ||
| // } | ||
| // ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.