diff --git a/lib/commission-math.js b/lib/commission-math.js index 3827cb59..fe77b922 100644 --- a/lib/commission-math.js +++ b/lib/commission-math.js @@ -3,11 +3,11 @@ const configManager = require('./new-config-manager') const { utils: coinUtils } = require('lamassu-coins') function truncateCrypto (cryptoAtoms, cryptoCode) { - const DECIMAL_PLACES = 3 + const DECIMAL_PLACES = 6 if (cryptoAtoms.eq(0)) return cryptoAtoms - const scale = coinUtils.getCryptoCurrency(cryptoCode).displayScale - const scaleFactor = new BN(10).pow(scale) + const scale = coinUtils.getCryptoCurrency(cryptoCode).unitScale + const scaleFactor = BN(10).pow(scale) return new BN(cryptoAtoms).integerValue(BN.ROUND_DOWN).div(scaleFactor) .decimalPlaces(DECIMAL_PLACES).times(scaleFactor)