From ef71852b1f0ada77507d7ff4207cbc9467ecc9fb Mon Sep 17 00:00:00 2001 From: Crisgarner <@crisgarner> Date: Mon, 25 Mar 2024 19:22:56 -0600 Subject: [PATCH] added cip-27 script --- scripts/CIP-27.ts | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 scripts/CIP-27.ts diff --git a/scripts/CIP-27.ts b/scripts/CIP-27.ts new file mode 100644 index 0000000..f296efd --- /dev/null +++ b/scripts/CIP-27.ts @@ -0,0 +1,70 @@ +// run with +// npx hardhat run ./scripts/CIP-27.ts --network hardhat +import hre, { deployments, network, hardhatArguments } from "hardhat"; +import { + castVote, + createProposal, + executeProposal, + fundMultisign, + queueProposal, +} from "./utils"; +import { BigNumber } from "ethers"; + +async function main() { + const ethers = hre.ethers; + let multisig = "0xa70b638B70154EdfCbb8DbbBd04900F328F32c35"; + let ctxAmount = ethers.utils.parseEther("91000"); + let ctx = await deployments.get("Ctx"); + let ctxContract = await ethers.getContractAt("Ctx", ctx.address); + + const abi = new ethers.utils.AbiCoder(); + const targets = [ctx.address]; + const values = [BigNumber.from(0)]; + const signatures = ["transfer(address,uint256)"]; + const calldatas = [ + abi.encode(["address", "uint256"], [multisig, ctxAmount]), + ]; + const description = + "CIP-27: 2024 Operating Expenditures Treasury Transfers for Q2"; + console.log(targets); + console.log(values.toString()); + console.log(signatures); + console.log(calldatas); + console.log(description); + + let ctxbalance = await ctxContract.balanceOf(multisig); + console.log("multisig old CTX balance", ethers.utils.formatEther(ctxbalance)); + + if (hardhatArguments.network === "hardhat") { + //Fund Multisign with ETH + await fundMultisign("10000000000000000000"); + + // Create Proposal + await createProposal(targets, values, signatures, calldatas, description); + + // Vote + await castVote(17, true); + + // Wait to queue + await queueProposal(17); + + // Execute transaction + await executeProposal(17); + + // Validate Results + console.log("==================Check Results=================="); + + ctxbalance = await ctxContract.balanceOf(multisig); + console.log( + "multisig new CTX balance", + ethers.utils.formatEther(ctxbalance) + ); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + });