-
Notifications
You must be signed in to change notification settings - Fork 374
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(examples): wugnot (grc20’s wrapped ugnot) #1356
Conversation
Signed-off-by: moul <94029+moul@users.noreply.github.com>
✅ Deploy Preview for gno-docs2 canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1356 +/- ##
==========================================
- Coverage 55.93% 55.93% -0.01%
==========================================
Files 420 420
Lines 65415 65415
==========================================
- Hits 36592 36589 -3
- Misses 25966 25969 +3
Partials 2857 2857 ☔ View full report in Codecov by Sentry. |
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
Signed-off-by: moul <94029+moul@users.noreply.github.com>
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.
Great work! LGTM 👍
code and txtar looks good! @moul FYI, I've built similar logic in gnoswap |
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.
Looks great 💯
I've cross checked it with a wrapped ETH contract, and it looks good.
The only thing I'm concerned about is about is having min / max limits, I don't understand the inherent need for them
const ( | ||
ugnotMinDeposit uint64 = 1000 | ||
wugnotMinDeposit uint64 = 1 | ||
) |
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.
Why is there a min / max for wrapping ugnot?
this is wrapped ugnot token currently used by gnoswap. seems like there are little bit difference between manfred's and gnoswap's [manfred wrapping]
[gnoswap wrapping]
and of course, gnoswap can support manfred's method by using multi msg to wrap tokens then pass wrapped result into it, but since this process requires more functions to be executed it will spend more gas-fee. @moul @zivkovicmilos |
Regarding the general native currency/token/coin discussion, here are a few points from a discussion @dongwon8247 and I had today. Bear in mind I might not have the most accurate view on this topic regarding how coins work, or how leadership has imagined this topic would be implemented, so please correct me if I'm wrong. As far as I understand, Gno.land currently has a single Then, we have the GRC20 standard. This allows us to have a token that conforms to a the ERC20 standard. I propose we call these tokens, as is in Ethereum, for clarity. An example of this can be the WUGNOT token (@moul the ticker Now, @r3v4s, GnoSwap's aim is to make the UX for users better than it currently is with Ethereum when using an exchange (i.e. Uniswap), which is that in order to swap the native currency, ETH, with something else, you first need to wrap it with the WETH contract, and then swap. Because the swap is 2 seperate transactions in itself ( The idea to solve this with GnoSwap is to wrap GNOT under the hood into their version of WGNOT. This will be invisible to end users and any time users want to do anything with GNOT, either swap or LP, the UI will simply display all callable functions with the native GNOT. I think this makes sense on the UX side, but I do think this needs to be documented for users that are tech-oriented, so that no confusion/controversy arises. Also, I am sure that further down the line there will be an exchange that will not have this approach. Here are some general points of discussion, which I hope to clarify and clearly document afterwards:
If you believe this discussion should be taken somewhere else, please point me to where 👍 |
Hello @leohhhn, I really didn't think about documenting this kind of |
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.
lgtm otherwise
} | ||
|
||
caller := std.PrevRealm().Addr() | ||
pkgaddr := std.GetOrigPkgAddr() |
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.
not CurrentRealm().Addr()?
@leohhhn I believe I partly already answered your questions elsewhere, but I'll try to answer what I can at the best of my knowledge.
Yes. My understanding is that the native tokens are the ones which will eventually be exchangeable through IBC. Naturally, as this realm is wrapping the native token ugnot to GRC20, the opposite should also be doable.
See-also #986. Native tokens will be namespaced:
It's still fake internet money as always, but it can work on IBC. Additionally, I think Manfred mentioned something about the native token being more secure, and likely the go-to choice that realms should use eventually.
as far as I can tell, mostly synonyms? maybe "currency" implies that the token has some clout. I'd avoid calling native tokens "coins" and grc20 tokens "tokens", because I think it leads to more confusion and as this PR shows creating a realm to convert back and forth is trivial. When you need to specify, call them grc20/native. |
Merging, and will reply to the native tokens and GRC20 questions in the effective gno documentation next week. |
We have decided to use this Manfred's wgunot realm to support wrapping for $GNOT in Gnoswap. The reasons are:
|
This PR presents a GNOT wrapper that conforms to the GRC20 interface. Optimally, the txtar file should be relocated to the wugnot directory, pending resolution of [issue gnolang#1269](gnolang#1269 (comment)). Enabling the use of `gnokey maketx call -func WUGNOT.Transfer` over `-func Transfer` would streamline the wrapper, reducing it to just the initial 55 lines. <!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests - [x] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Signed-off-by: moul <94029+moul@users.noreply.github.com>
This PR presents a GNOT wrapper that conforms to the GRC20 interface.
Optimally, the txtar file should be relocated to the wugnot directory, pending resolution of issue #1269.
Enabling the use of
gnokey maketx call -func WUGNOT.Transfer
over-func Transfer
would streamline the wrapper, reducing it to just the initial 55 lines.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description