Closed
Description
Summary
sdk.Coin
has Add()
and Sub()
methods but I think it'd be good to have AddAmount()
and SubAmount()
methods too.
Problem Definition
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:
amount := sdk.NewInt(1000)
result := existingCoin.SubAmount(amount)
And it'll improve code readability a lot.
Proposal
Implement AddAmount()
and SubAmount()
to sdk.Coin
.
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned
Metadata
Assignees
Labels
No labels