-
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
Reconcile DecCoin/s with Coin/s #3311
Comments
What did you have in mind? like testing through an interface? golang is kinda inhibiting for actually combining these two types unfortunately |
Yeah I wish we could keep it DRY as possible, but I mean just making sure the APIs are the same (e.g. |
How about defining these common interfaces? type Coin interface {
SameDenomAs(Coin) bool
Zero() bool
GTE(Coin) bool
LT(Coin) bool
Equal(Coin) bool
Plus(Coin) Coin
Minus(Coin) Coin
Positive() bool
Negative() bool
String() string
}
type CoinSet interface {
Valid() bool
Plus(CoinSet) Coin
Minus(CoinSet) Coin
SafeMinus(CoinSet) Coin
AllGT(CoinSet) bool
AllGTE(CoinSet) bool
AllLTE(CoinSet) bool
Zero() bool
Equal(CoinSet) bool
Empty() bool
AllPositive() bool
AllNotNegative() bool
AnyNegative() bool
Sort() CoinSet
String() string
} Note that I have removed the |
We might need an |
Summary
Reconcile the
DecCoin
andDecCoins
APIs with theCoin
andCoins
APIs for consistency.e.g.
For Admin Use
The text was updated successfully, but these errors were encountered: