import { ethers, network } from "hardhat"; import { time } from "@nomicfoundation/hardhat-toolbox/network-helpers"; import governanceAbi from "./abi/governance.abi.json"; const governanceAddr = "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce"; async function getManyEth(addr: string) { await network.provider.send("hardhat_setBalance", [addr, "0x111166630153555558483537"]); } async function deployAndExecuteProposal() { const proposal = await ethers.deployContract("Proposal", []); await proposal.waitForDeployment(); const bigStakerAddr = "0xE4143f6377AEcd7193b9731d1C28815b57C4f5Ab"; await getManyEth(bigStakerAddr); const stakerSigner = await ethers.getImpersonatedSigner(bigStakerAddr); const governanceContract = await ethers.getContractAt( governanceAbi, governanceAddr, stakerSigner, ); await governanceContract.propose(proposal.target, ""); const proposalId = await governanceContract.proposalCount(); await time.increase(60 * 60); await governanceContract.castVote(proposalId, true); await time.increase(60 * 60 * 24 * 7 + 60); await governanceContract.execute(proposalId); } module.exports = { deployAndExecuteProposal, };