From d6d6d3fee5cb84e7fba3cd2302e32eab985a3d42 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 10 Jun 2020 15:24:00 +0100 Subject: [PATCH] Use decimal comparison in faucet token manager --- packages/faucet/src/tokenmanager.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/faucet/src/tokenmanager.ts b/packages/faucet/src/tokenmanager.ts index 88996eee..9d09ad76 100644 --- a/packages/faucet/src/tokenmanager.ts +++ b/packages/faucet/src/tokenmanager.ts @@ -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 {