Add waiting for contracts deployment before verification

This commit is contained in:
Theo 2023-06-13 12:32:09 -07:00
parent f2a0e18cc0
commit ea9b28457c

@ -1,28 +1,48 @@
const hre = require('hardhat')
const config = require("../config")
const { ethers } = hre
const hre = require("hardhat");
const config = require("../config");
const { ethers } = hre;
const sleep = (s) => new Promise((r) => setTimeout(r, s * 1000));
async function main() {
const factory_staking = await ethers.getContractFactory("TornadoStakingRewards")
const factory_proposal = await ethers.getContractFactory("Proposal")
const factory_staking = await ethers.getContractFactory(
"TornadoStakingRewards"
);
const factory_proposal = await ethers.getContractFactory(
"RestoreRewardsProposal"
);
const staking = await factory_staking.deploy(config.governanceProxy, config.torn, config.registryProxy)
const staking = await factory_staking.deploy(
config.governanceProxy,
config.torn,
config.registryProxy
);
await sleep(20);
console.log("\nStaking contract impl successfully deployed @ " + staking.address + '\n')
console.log(
"\nStaking contract impl successfully deployed @ " + staking.target + "\n"
);
await hre.run('verify:verify', {
address: staking.address,
constructorArguments: [config.governanceProxy, config.torn, config.registryProxy],
})
await hre.run("verify:verify", {
address: staking.target,
constructorArguments: [
config.governanceProxy,
config.torn,
config.registryProxy,
],
});
const proposal = await factory_proposal.deploy(staking.address)
const proposal = await factory_proposal.deploy(staking.target);
await sleep(20);
console.log("\nProposal 25 successfully deployed @ " + proposal.address + '\n')
console.log(
"\nProposal 25 successfully deployed @ " + proposal.target + "\n"
);
await hre.run('verify:verify', {
address: proposal.address,
constructorArguments: [staking.address],
})
await hre.run("verify:verify", {
address: proposal.target,
constructorArguments: [staking.target],
});
}
main().then((res) => console.log(res ?? "\nScript finished.\n"))
main().then((res) => console.log(res ?? "\nScript finished.\n"));