proposal-46/scripts/deploy.js
2024-01-31 10:12:30 +00:00

49 lines
2.2 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 stakingAddr = "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29";
const gasCompensationAddr = "0xFA4C1f3f7D5dd7c12a9Adb82Cd7dDA542E3d59ef";
const userVaultAddr = "0x2F50508a8a3D323B91336FA3eA6ae50E55f32185";
const governanceFactory = await ethers.getContractFactory("GovernanceProposalStateUpgrade");
const governanceImpl = await governanceFactory.deploy(stakingAddr, gasCompensationAddr, userVaultAddr);
const governanceImplAddr = await governanceImpl.getAddress();
let tx = governanceImpl.deploymentTransaction();
await tx.wait(16);
console.log("New governance impl deployment confirmed with 16 blocks, waiting for verification on Etherscan");
await hre.run("verify:verify", {
address: governanceImplAddr,
contract: "contracts/v5-proposal-state-patch/GovernanceProposalStateUpgrade.sol:GovernanceProposalStateUpgrade",
constructorArguments: [stakingAddr, gasCompensationAddr, userVaultAddr],
});
const proposalFactory = await ethers.getContractFactory("Proposal");
const proposal = await proposalFactory.deploy(governanceImplAddr);
const deployedProposalAddr = await proposal.getAddress();
console.log(`Proposal contract deployed by address ${deployedProposalAddr}, waiting for blockchain confirmations...`);
tx = proposal.deploymentTransaction();
await tx.wait(16);
console.log("Deployment confirmed with 16 blocks, waiting for verification on Etherscan");
await hre.run("verify:verify", {
address: deployedProposalAddr,
contract: "contracts/Proposal.sol:Proposal",
constructorArguments: [governanceImplAddr],
});
}
// 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;
});