onchain prices

This commit is contained in:
Alexey 2019-12-23 19:38:44 +03:00
parent 9e2eef492a
commit 91b97e0276
7 changed files with 80 additions and 28 deletions

View file

@ -138,21 +138,29 @@ function isEnoughFee({ gas, gasPrices, currency, amount, refund, ethPrices, fee
return { isEnough: true }
}
function getMainnetTokens() {
function getArgsForOracle() {
const tokens = mixers['netId1']
const tokenAddresses = []
const oneUintAmount = []
const parts = [] // this is probably should be removed
const currencyLookup = {}
Object.entries(tokens).map(([currency, data]) => {
if (currency !== 'eth') {
tokenAddresses.push(data.tokenAddress)
currencyLookup[data.tokenAddress.toLowerCase()] = currency
oneUintAmount.push(
toBN('10')
.pow(toBN(data.decimals.toString()))
.toString()
)
parts.push('1')
currencyLookup[data.tokenAddress] = currency
}
})
return { tokenAddresses, currencyLookup }
return { tokenAddresses, oneUintAmount, parts, currencyLookup }
}
function getMixers() {
return mixers[`netId${netId}`]
}
module.exports = { isValidProof, isValidArgs, sleep, isKnownContract, isEnoughFee, getMixers, getMainnetTokens }
module.exports = { isValidProof, isValidArgs, sleep, isKnownContract, isEnoughFee, getMixers, getArgsForOracle }