Use decimal comparison in faucet token manager

This commit is contained in:
willclarktech 2020-06-10 15:24:00 +01:00
parent 0ae83b0657
commit d6d6d3fee5
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7

View File

@ -54,9 +54,7 @@ export class TokenManager {
const thresholdAmount = this.refillThreshold(tickerSymbol);
const threshold = Decimal.fromAtomics(thresholdAmount.amount, meta.fractionalDigits);
// TODO: perform < operation on Decimal type directly
// https://github.com/iov-one/iov-core/issues/1375
return balance.toFloatApproximation() < threshold.toFloatApproximation();
return balance.isLessThan(threshold);
}
private getTokenMeta(tickerSymbol: string): BankTokenMeta {