-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Implement initial simple denom convert utils #3747
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3747 +/- ##
===========================================
+ Coverage 60.95% 60.98% +0.03%
===========================================
Files 192 193 +1
Lines 14360 14386 +26
===========================================
+ Hits 8753 8774 +21
- Misses 5033 5035 +2
- Partials 574 577 +3 |
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.
What about just one function, "ConvertDenom", which takes an amount, a source denom, and a desired denom, and converts one to the other (if the denoms are recognized)? Then we can easily add new denoms without changing the function calls.
Related to the work: https://github.com/cosmos/cosmos-sdk/pull/3813/files |
@cwgoes @rigelrozanski bump <3 |
Would it be possible to use SI prefixes correctly? |
Absolutely let's do - what should we change? |
We should at the very least use |
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.
I don't think we should be using anything except uatom
and atom
in this tool - everything else just adds confusion AFIAC. Also I think the unit's are off based on what I'm seeing in the code (Bez's comment seems correct though, confusingly) https://www.google.com/search?q=si+prefixes&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjCxMfutvvgAhULpYMKHQFUAD4Q_AUIDigB&biw=1269&bih=696#imgrc=F26w4WQUVJaWDM:
@rigelrozanski Those are standard de-facto SI prefixes. We should've caught this sooner tbh. Also, wrt to only |
I don't see why we should avoid other prefixes - |
@cwgoes @rigelrozanski @jleni updated |
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.
Couple minor comments to make things a bit more clear - but looks good. Also you're right, I forgot this is the util not the gaia implementation, so nbd about using a bunch of SI examples
Co-Authored-By: alexanderbez <[email protected]>
Updated. Should be good to merge. |
Bump @cwgoes |
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.
Needs a changelog entry, otherwise the code LGTM.
I wonder if we should warn the user somehow when truncation results in loss of precision.
Added a pending log entry @cwgoes |
Fixed CI and added pending log entry @cwgoes |
Implement denom registration and a coin conversion utility.
This assumes we do not touch
ParseCoin/s
. IMHO, that should only take in the base denom --uatom
./cc @cwgoes @rigelrozanski
ref: #3510
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorerFor Admin Use: