-
Notifications
You must be signed in to change notification settings - Fork 389
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 Summary🔴 Pending initial approval by a review team member, or review from tech-staff 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
- instead of iteration in grc20reg use read only tree from avl
-remove test
All comments have been addressed and changes made. I have also made tests for new funcs. Can you please check out the "Dillema" section of the PR description and maybe provide an opinion 🙏 Thanks!! |
-adapt grc20reg to use the right key
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
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.
Dillema
Since the hub uses existing grc20reg and extends it's usage, if a token is registered through the hub it would mean an incorrect realm path would be written in the grc20reg since the prevrealm would now point to the hub. I have not thought of an ideal solution to this. Here are some ideas I got:
(because of this probelm this is not yet ready to be merged but I would like an opinion)
See screenshots
All feedback is welcome