removed parts param

This commit is contained in:
Alexey 2019-12-23 22:40:08 +03:00
parent 91b97e0276
commit 525ca3bb84
4 changed files with 7 additions and 18 deletions

@ -11,11 +11,6 @@
"internalType": "uint256[]",
"name": "oneUnitAmounts",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "parts",
"type": "uint256[]"
}
],
"name": "getPricesInETH",
@ -30,4 +25,4 @@
"stateMutability": "view",
"type": "function"
}
]
]

@ -6,7 +6,7 @@ module.exports = {
redisUrl: process.env.REDIS_URL,
rpcUrl: process.env.RPC_URL || 'https://kovan.infura.io/',
oracleRpcUrl: process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/',
oracleAddress: '0x5c4c5622670423b8ee5F3A02F505D139fbAfb618',
oracleAddress: '0xB5eE7907FF5f4c1FC9086Fc117E6c397431F39ad',
privateKey: process.env.PRIVATE_KEY,
mixers: {
netId1: {

@ -19,25 +19,21 @@ class Fetcher {
}
this.tokenAddresses
this.oneUintAmount
this.parts
this.currencyLookup
this.gasPrices = {
fast: defaultGasPrice
}
const { tokenAddresses, oneUintAmount, parts, currencyLookup } = getArgsForOracle()
const { tokenAddresses, oneUintAmount, currencyLookup } = getArgsForOracle()
this.tokenAddresses = tokenAddresses
this.oneUintAmount = oneUintAmount
this.parts = parts
this.currencyLookup = currencyLookup
}
async fetchPrices() {
try {
let prices = await this.oracle.methods.getPricesInETH(
this.tokenAddresses,
this.oneUintAmount,
this.parts
).call()
let prices = await this.oracle.methods
.getPricesInETH(this.tokenAddresses, this.oneUintAmount)
.call()
this.ethPrices = prices.reduce((acc, price, i) => {
acc[this.currencyLookup[this.tokenAddresses[i]]] = price
return acc

@ -142,7 +142,6 @@ 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') {
@ -152,11 +151,10 @@ function getArgsForOracle() {
.pow(toBN(data.decimals.toString()))
.toString()
)
parts.push('1')
currencyLookup[data.tokenAddress] = currency
}
})
return { tokenAddresses, oneUintAmount, parts, currencyLookup }
return { tokenAddresses, oneUintAmount, currencyLookup }
}
function getMixers() {