fix: unexpected displayScale usage in txs operations
This commit is contained in:
parent
9ec7f6f296
commit
168257bcc4
1 changed files with 3 additions and 3 deletions
|
|
@ -3,11 +3,11 @@ const configManager = require('./new-config-manager')
|
||||||
const { utils: coinUtils } = require('lamassu-coins')
|
const { utils: coinUtils } = require('lamassu-coins')
|
||||||
|
|
||||||
function truncateCrypto (cryptoAtoms, cryptoCode) {
|
function truncateCrypto (cryptoAtoms, cryptoCode) {
|
||||||
const DECIMAL_PLACES = 3
|
const DECIMAL_PLACES = 6
|
||||||
if (cryptoAtoms.eq(0)) return cryptoAtoms
|
if (cryptoAtoms.eq(0)) return cryptoAtoms
|
||||||
|
|
||||||
const scale = coinUtils.getCryptoCurrency(cryptoCode).displayScale
|
const scale = coinUtils.getCryptoCurrency(cryptoCode).unitScale
|
||||||
const scaleFactor = new BN(10).pow(scale)
|
const scaleFactor = BN(10).pow(scale)
|
||||||
|
|
||||||
return new BN(cryptoAtoms).integerValue(BN.ROUND_DOWN).div(scaleFactor)
|
return new BN(cryptoAtoms).integerValue(BN.ROUND_DOWN).div(scaleFactor)
|
||||||
.decimalPlaces(DECIMAL_PLACES).times(scaleFactor)
|
.decimalPlaces(DECIMAL_PLACES).times(scaleFactor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue