mirror of
https://github.com/tornadocash/tornado-relayer.git
synced 2025-08-15 01:25:33 -04:00
multiple contracts
This commit is contained in:
parent
2d2115ab43
commit
cd9f19e1f5
5 changed files with 44 additions and 13 deletions
13
utils.js
13
utils.js
|
@ -1,6 +1,6 @@
|
|||
const fetch = require('node-fetch')
|
||||
const { isHexStrict, hexToNumberString } = require('web3-utils')
|
||||
const { gasOracleUrls, ethdaiAddress } = require('./config')
|
||||
const { gasOracleUrls, ethdaiAddress, mixers } = require('./config')
|
||||
const oracleABI = require('./abis/ETHDAIOracle.json')
|
||||
|
||||
async function fetchGasPrice({ gasPrices, oracleIndex = 0 }) {
|
||||
|
@ -90,8 +90,17 @@ function isValidProof(proof) {
|
|||
return { valid: true }
|
||||
}
|
||||
|
||||
function isKnownContract(contract) {
|
||||
for (let i = 0; i < mixers.length; i++) {
|
||||
if (mixers[i].address === contract) {
|
||||
return { valid: true, currency: mixers[i].currency }
|
||||
}
|
||||
}
|
||||
return { valid: false }
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
module.exports = { fetchGasPrice, isValidProof, sleep, fetchDAIprice }
|
||||
module.exports = { fetchGasPrice, isValidProof, sleep, fetchDAIprice, isKnownContract }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue