remove proposal 10 check

This commit is contained in:
smart_ex 2022-03-23 11:57:15 +10:00 committed by Danil Kovtonyuk
parent 3c5eaa2c4b
commit 76209e11c0

@ -27,8 +27,6 @@ const {
miningServiceFee, miningServiceFee,
tornadoServiceFee, tornadoServiceFee,
tornadoGoerliProxy, tornadoGoerliProxy,
governanceAddress,
aggregatorAddress,
} = require('./config') } = require('./config')
const ENSResolver = require('./resolver') const ENSResolver = require('./resolver')
const resolver = new ENSResolver() const resolver = new ENSResolver()
@ -198,29 +196,13 @@ async function checkMiningFee({ args }) {
} }
} }
async function isLatestProposalExecuted() {
const PROPOSAL_EXECUTED_STATUS = 5
const expectedProposalId = 10
try {
const aggregator = new web3.eth.Contract(aggregatorAbi, aggregatorAddress)
const proposals = await aggregator.methods.getAllProposals(governanceAddress).call()
const expectedProposal = proposals[expectedProposalId - 1]
return expectedProposal && Number(expectedProposal['state']) === PROPOSAL_EXECUTED_STATUS
} catch (e) {
console.error(e.message)
return false
}
}
async function getProxyContract() { async function getProxyContract() {
let proxyAddress let proxyAddress
if (netId === 5) { if (netId === 5) {
proxyAddress = tornadoGoerliProxy proxyAddress = tornadoGoerliProxy
} else { } else {
const latestProposalExecuted = await isLatestProposalExecuted() proxyAddress = await resolver.resolve(torn.tornadoProxy.address)
proxyAddress = latestProposalExecuted
? await resolver.resolve(torn.tornadoRouter.address)
: await resolver.resolve(torn.tornadoProxy.address)
} }
const contract = new web3.eth.Contract(tornadoProxyABI, proxyAddress) const contract = new web3.eth.Contract(tornadoProxyABI, proxyAddress)