removed parts param
This commit is contained in:
parent
91b97e0276
commit
525ca3bb84
@ -11,11 +11,6 @@
|
|||||||
"internalType": "uint256[]",
|
"internalType": "uint256[]",
|
||||||
"name": "oneUnitAmounts",
|
"name": "oneUnitAmounts",
|
||||||
"type": "uint256[]"
|
"type": "uint256[]"
|
||||||
},
|
|
||||||
{
|
|
||||||
"internalType": "uint256[]",
|
|
||||||
"name": "parts",
|
|
||||||
"type": "uint256[]"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "getPricesInETH",
|
"name": "getPricesInETH",
|
||||||
@ -30,4 +25,4 @@
|
|||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -6,7 +6,7 @@ module.exports = {
|
|||||||
redisUrl: process.env.REDIS_URL,
|
redisUrl: process.env.REDIS_URL,
|
||||||
rpcUrl: process.env.RPC_URL || 'https://kovan.infura.io/',
|
rpcUrl: process.env.RPC_URL || 'https://kovan.infura.io/',
|
||||||
oracleRpcUrl: process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/',
|
oracleRpcUrl: process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/',
|
||||||
oracleAddress: '0x5c4c5622670423b8ee5F3A02F505D139fbAfb618',
|
oracleAddress: '0xB5eE7907FF5f4c1FC9086Fc117E6c397431F39ad',
|
||||||
privateKey: process.env.PRIVATE_KEY,
|
privateKey: process.env.PRIVATE_KEY,
|
||||||
mixers: {
|
mixers: {
|
||||||
netId1: {
|
netId1: {
|
||||||
|
@ -19,25 +19,21 @@ class Fetcher {
|
|||||||
}
|
}
|
||||||
this.tokenAddresses
|
this.tokenAddresses
|
||||||
this.oneUintAmount
|
this.oneUintAmount
|
||||||
this.parts
|
|
||||||
this.currencyLookup
|
this.currencyLookup
|
||||||
this.gasPrices = {
|
this.gasPrices = {
|
||||||
fast: defaultGasPrice
|
fast: defaultGasPrice
|
||||||
}
|
}
|
||||||
|
|
||||||
const { tokenAddresses, oneUintAmount, parts, currencyLookup } = getArgsForOracle()
|
const { tokenAddresses, oneUintAmount, currencyLookup } = getArgsForOracle()
|
||||||
this.tokenAddresses = tokenAddresses
|
this.tokenAddresses = tokenAddresses
|
||||||
this.oneUintAmount = oneUintAmount
|
this.oneUintAmount = oneUintAmount
|
||||||
this.parts = parts
|
|
||||||
this.currencyLookup = currencyLookup
|
this.currencyLookup = currencyLookup
|
||||||
}
|
}
|
||||||
async fetchPrices() {
|
async fetchPrices() {
|
||||||
try {
|
try {
|
||||||
let prices = await this.oracle.methods.getPricesInETH(
|
let prices = await this.oracle.methods
|
||||||
this.tokenAddresses,
|
.getPricesInETH(this.tokenAddresses, this.oneUintAmount)
|
||||||
this.oneUintAmount,
|
.call()
|
||||||
this.parts
|
|
||||||
).call()
|
|
||||||
this.ethPrices = prices.reduce((acc, price, i) => {
|
this.ethPrices = prices.reduce((acc, price, i) => {
|
||||||
acc[this.currencyLookup[this.tokenAddresses[i]]] = price
|
acc[this.currencyLookup[this.tokenAddresses[i]]] = price
|
||||||
return acc
|
return acc
|
||||||
|
@ -142,7 +142,6 @@ function getArgsForOracle() {
|
|||||||
const tokens = mixers['netId1']
|
const tokens = mixers['netId1']
|
||||||
const tokenAddresses = []
|
const tokenAddresses = []
|
||||||
const oneUintAmount = []
|
const oneUintAmount = []
|
||||||
const parts = [] // this is probably should be removed
|
|
||||||
const currencyLookup = {}
|
const currencyLookup = {}
|
||||||
Object.entries(tokens).map(([currency, data]) => {
|
Object.entries(tokens).map(([currency, data]) => {
|
||||||
if (currency !== 'eth') {
|
if (currency !== 'eth') {
|
||||||
@ -152,11 +151,10 @@ function getArgsForOracle() {
|
|||||||
.pow(toBN(data.decimals.toString()))
|
.pow(toBN(data.decimals.toString()))
|
||||||
.toString()
|
.toString()
|
||||||
)
|
)
|
||||||
parts.push('1')
|
|
||||||
currencyLookup[data.tokenAddress] = currency
|
currencyLookup[data.tokenAddress] = currency
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return { tokenAddresses, oneUintAmount, parts, currencyLookup }
|
return { tokenAddresses, oneUintAmount, currencyLookup }
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMixers() {
|
function getMixers() {
|
||||||
|
Loading…
Reference in New Issue
Block a user