feat: change to generic ERC-20 ABI json file
fix: coinUtils rename import
This commit is contained in:
parent
dff407e30e
commit
8e099e3283
36 changed files with 364 additions and 249 deletions
|
|
@ -1,6 +1,6 @@
|
|||
const BN = require('./bn')
|
||||
const configManager = require('./new-config-manager')
|
||||
const { utils } = require('lamassu-coins')
|
||||
const { utils: coinUtils } = require('lamassu-coins')
|
||||
|
||||
function truncateCrypto (cryptoAtoms, cryptoCode) {
|
||||
const DECIMAL_PLACES = 3
|
||||
|
|
@ -20,7 +20,7 @@ function fiatToCrypto (tx, rec, deviceId, config) {
|
|||
const tickerRate = BN(tx.rawTickerPrice)
|
||||
const discount = getDiscountRate(tx.discount, commissions[tx.direction])
|
||||
const rate = tickerRate.mul(discount).round(5)
|
||||
const unitScale = utils.getCryptoCurrency(tx.cryptoCode).unitScale
|
||||
const unitScale = coinUtils.getCryptoCurrency(tx.cryptoCode).unitScale
|
||||
const unitScaleFactor = BN(10).pow(unitScale)
|
||||
|
||||
return truncateCrypto(BN(usableFiat).div(rate.div(unitScaleFactor)), tx.cryptoCode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue