Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion trade/trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func ParseAmount(amount string, decimals int) (*big.Int, error) {
}

if len(frac) > decimals {
frac = frac[:decimals]
return nil, errors.New("too many decimal places")
}
for len(frac) < decimals {
frac += "0"
Expand Down
3 changes: 2 additions & 1 deletion trade/trade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func TestParseAmountRejectsInvalidAmounts(t *testing.T) {
{"negative", "-1", 6},
{"positive sign", "+1", 6},
{"invalid fractional", "1.a", 6},
{"too many decimals", "1.2.3", 6},
{"too many decimal separators", "1.2.3", 6},
{"too many fractional digits", "0.0000001", 6},
{"negative decimals", "1", -1},
}
for _, tt := range tests {
Expand Down
Loading