proposal-34/scripts/deploy.js
2023-11-03 20:26:48 +00:00

54 lines
2.3 KiB
JavaScript

// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");
const { ethers } = require("hardhat");
async function main() {
const RelayerRegistryFactory = await ethers.getContractFactory("RelayerRegistry");
const constructorArgs = ["0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce", "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29", "0x5f6c97C6AD7bdd0AE7E0Dd4ca33A4ED3fDabD4D7"];
const relayerRegistry = await RelayerRegistryFactory.deploy(...constructorArgs);
const deployedRegistryAddr = await relayerRegistry.getAddress();
console.log(`Relayer registry contract deployed by address ${deployedRegistryAddr}, waiting for blockchain confirmations...`)
let tx = relayerRegistry.deploymentTransaction();
await tx.wait(6);
console.log("Deployment confirmed with 6 blocks, waiting for verification on Etherscan");
await hre.run("verify:verify",
{
address: deployedRegistryAddr,
contract: "contracts/RelayerRegistry.sol:RelayerRegistry",
constructorArguments: constructorArgs
});
console.log("Relayer registry contract deployed and verified!\n\n");
const proposalFactory = await ethers.getContractFactory("Proposal");
const proposal = await proposalFactory.deploy(deployedRegistryAddr);
const deployedProposalAddr = await proposal.getAddress();
console.log(`Proposal contract deployed by address ${deployedProposalAddr}, waiting for blockchain confirmations...`);
tx = proposal.deploymentTransaction();
await tx.wait(6);
console.log("Deployment confirmed with 6 blocks, waiting for verification on Etherscan");
await hre.run("verify:verify",
{
address: deployedProposalAddr,
contract: "contracts/Proposal.sol:Proposal",
constructorArguments: [deployedRegistryAddr]
});
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});