-
Notifications
You must be signed in to change notification settings - Fork 397
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
feat: token hub #3479
base: master
Are you sure you want to change the base?
feat: token hub #3479
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Check this out, it's a similar idea: https://github.com/gnolang/gno/blob/master/examples/gno.land/r/demo/grc20reg/grc20reg.gno |
Thanks for pointing out, I will consider implementation for different token types |
-change tokenhub to be a hub for nfts rather than a hub for fungible tokens
…okens - match registering grc721 to grc20 registration which now go by pck path (and custom slug) instead of symbol - combine the two in the token hub
…ion to grc20reg.gno but this might help with iteration in that realm as well)
-update the getbalances functions so they're easier to parse
gno.land/pkg/sdk/vm/convert.go
Outdated
@@ -50,7 +50,7 @@ | |||
"error parsing int %q: %v", | |||
arg, err)) | |||
} | |||
tv.SetInt(i64) | |||
tv.SetInt(int(i64)) |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types
gno.land/pkg/sdk/vm/convert.go
Outdated
@@ -100,7 +100,7 @@ | |||
"error parsing uint %q: %v", | |||
arg, err)) | |||
} | |||
tv.SetUint(u64) | |||
tv.SetUint(uint(u64)) |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types
447235d
to
f3b4f2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to remove the review/triage-pending
label, and handing off to @leohhhn to manage the review process.
Description
Token hub is a registry for tokens and NFTs created on gno.land. Since all the tokens are visible in each their own realms, as it is right now there is no easy way that a user can check which tokens belong to him by his address. Token hub bypasses this by concentrating each each token in it's own realm and allows operations over these tokens providing a easier way to communicate with the realms in which the tokens are originally made. Since grc20 registry already exists the idea is to combine it's functionality with similar concept used for other tokens to create a realm that will contain information about all tokens, this way you will be able to get all your token balances in one place.
See more details
How it works
In the realm where token is being made, tokenhub needs to be imported and the newly made token has to be registered to the token hub by using RegisterToken function and passing the token as an argument. This is everything token hub needs to be able to operate. Simiraly how it is done here for GRC20 token hub registers a pointer to the token in it's registry.
More Details
In order to make this work I had to make minor additions to other realms as one would probably notice in the code - I had to add Getters (pointers) in the grc721 and grc1155 so storing the token instance itself is avoided, like it is done with GRC20 for grc20reg.gno purposes. I also needed to add Iterate and IterateN functions to grc20 only to be able to get the tokens of that registry which shouldn't undermine any of it's functionality or security.
See screenshots
All feedback is welcome