Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 869b887

Browse files
committed
Update validate crypto listing function to use GetCryptoDivisibility
1 parent 5edd633 commit 869b887

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

repo/listing.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,24 +2119,16 @@ func (l *Listing) validateCryptocurrencyListing() error {
21192119
return ErrListingCryptoCurrencyCodeInvalid
21202120
}
21212121

2122-
var cryptoDivisibility uint
2123-
switch listing.Metadata.Version {
2124-
case 5:
2125-
cryptoDivisibility = uint(listing.Metadata.CryptoDivisibility)
2126-
default:
2127-
if listing.Metadata.CryptoDivisibility != 0 {
2128-
cryptoDivisibility = uint(math.Log10(float64(listing.Metadata.CryptoDivisibility)))
2129-
}
2130-
}
2122+
2123+
cryptoDivisibility := l.GetCryptoDivisibility()
21312124
if cryptoDivisibility == 0 {
21322125
return ErrListingCryptoDivisibilityInvalid
21332126
}
21342127
localDef, err := AllCurrencies().Lookup(listing.Metadata.CryptoCurrencyCode)
21352128
if err != nil {
21362129
return ErrCurrencyDefinitionUndefined
21372130
}
2138-
if cryptoDivisibility != localDef.Divisibility {
2139-
log.Info("***", cryptoDivisibility, localDef.Divisibility)
2131+
if uint(cryptoDivisibility) != localDef.Divisibility {
21402132
return ErrListingCryptoDivisibilityInvalid
21412133
}
21422134
return nil

0 commit comments

Comments
 (0)