Skip to content
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

CLI don't convert denominations automatically #7623

Closed
1 of 4 tasks
yihuang opened this issue Oct 22, 2020 · 2 comments · Fixed by #7777
Closed
1 of 4 tasks

CLI don't convert denominations automatically #7623

yihuang opened this issue Oct 22, 2020 · 2 comments · Fixed by #7777

Comments

@yihuang
Copy link
Collaborator

yihuang commented Oct 22, 2020

Summary

When we have multiple denominations of same coin, we should convert them automatically.
It's good to handle them at interface layer(cli or grpc).
We already have the ConvertCoin utility, so it should be trivial to implement this.
We already did that in our chain by override cli commands (https://github.com/crypto-com/chain-main/blob/68a0f526b8844d75874582cde40561e1c8460f9d/x/staking/client/cli/tx.go#L121). it would be better to implement that in cosmos-sdk, we are happy to submit the PR.

Problem Definition

Proposal

  • Convert coins to predefined base unit in cli commands.

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@tomtau
Copy link
Contributor

tomtau commented Oct 22, 2020

related cosmos/gaia#300

@alexanderbez
Copy link
Contributor

Yes, this is why I've added the GetDenomUnit and ConvertCoin functions. If we can leverage these in client-facing interfaces, that would be great!

yihuang added a commit to yihuang/cosmos-sdk that referenced this issue Nov 16, 2020
fixes: cosmos#7623

- test order of decimal operations
- support both int and decimal coins, truncate when normalizing to
  base unit
@mergify mergify bot closed this as completed in #7777 Nov 16, 2020
mergify bot added a commit that referenced this issue Nov 16, 2020
* cli: convert coins to smallest unit registered

fixes: #7623

- test order of decimal operations
- support both int and decimal coins, truncate when normalizing to
  base unit

* Update types/coin_test.go

* Update types/coin_test.go

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
yihuang added a commit to yihuang/cosmos-sdk that referenced this issue Nov 27, 2020
* cli: convert coins to smallest unit registered

fixes: cosmos#7623

- test order of decimal operations
- support both int and decimal coins, truncate when normalizing to
  base unit

* Update types/coin_test.go

* Update types/coin_test.go

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this issue May 22, 2023
* cli: convert coins to smallest unit registered

fixes: cosmos#7623

- test order of decimal operations
- support both int and decimal coins, truncate when normalizing to
  base unit

* Update types/coin_test.go

* Update types/coin_test.go

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants