We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
sdk.Coin has Add() and Sub() methods but I think it'd be good to have AddAmount() and SubAmount() methods too.
sdk.Coin
Add()
Sub()
AddAmount()
SubAmount()
If someone wants to subtract some amount from existing coin, one should right:
amount := sdk.NewInt(1000) result := existingCoin.Sub(sdk.NewCoin(existingCoin.Denom, amount))
But that's a bit redundant that we have to type existingCoin twice. We should do it better with:
existingCoin
amount := sdk.NewInt(1000) result := existingCoin.SubAmount(amount)
And it'll improve code readability a lot.
Implement AddAmount() and SubAmount() to sdk.Coin.
The text was updated successfully, but these errors were encountered:
This sounds okay to me, would you like to create a PR?
Sorry, something went wrong.
@AmauryM Yep, I'll create PR right away.
Successfully merging a pull request may close this issue.
Summary
sdk.Coin
hasAdd()
andSub()
methods but I think it'd be good to haveAddAmount()
andSubAmount()
methods too.Problem Definition
If someone wants to subtract some amount from existing coin, one should right:
But that's a bit redundant that we have to type
existingCoin
twice.We should do it better with:
And it'll improve code readability a lot.
Proposal
Implement
AddAmount()
andSubAmount()
tosdk.Coin
.For Admin Use
The text was updated successfully, but these errors were encountered: