Skip to content

Commit

Permalink
Merge pull request #164 from cryptexfinance/cip-30
Browse files Browse the repository at this point in the history
added script for CIP-30
  • Loading branch information
voith authored Jul 3, 2024
2 parents 6c5b496 + f0c4d82 commit 7ad8d32
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions scripts/CIP-30.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// run with
// npx hardhat run ./scripts/CIP-30.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 subDAOMultisigAddress = "0x41187c70eB8eeEfDaEd4ED0bFF20005C53c3a7DD"

let usdcAddress = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
let usdcAmount = BigNumber.from("150000000000");

let ctx = await deployments.get("Ctx");
let ctxContract = await ethers.getContractAt("Ctx", ctx.address);
let usdcContract = await ethers.getContractAt("Ctx", usdcAddress);

let ctxAmount = BigNumber.from("50000000000000000000000")

const abi = new ethers.utils.AbiCoder();
const targets = [usdcAddress, ctx.address];
const values = [BigNumber.from(0), BigNumber.from(0)];
const signatures = ["transfer(address,uint256)", "transfer(address,uint256)"];
const calldatas = [
abi.encode(["address", "uint256"], [subDAOMultisigAddress, usdcAmount]),
abi.encode(["address", "uint256"], [subDAOMultisigAddress, ctxAmount]),
];
const description = "CIP-30: Q3 2024 Funds for SubDAO operations";
console.log(targets);
console.log(values.toString());
console.log(signatures);
console.log(calldatas);
console.log(description);

let ctxbalance = await ctxContract.balanceOf(subDAOMultisigAddress);
console.log(" old subDAOMultisig CTX balance", ethers.utils.formatEther(ctxbalance));

let usdcbalance = await usdcContract.balanceOf(subDAOMultisigAddress);
console.log("old subDAOMultisig CTX balance", usdcbalance/ 10 ** 6);

if (hardhatArguments.network === "hardhat") {
//Fund Multisign with ETH
await fundMultisign("10000000000000000000");

// Create Proposal
await createProposal(targets, values, signatures, calldatas, description);

// Vote
await castVote(20, true);

// Wait to queue
await queueProposal(20);

// Execute transaction
await executeProposal(20);

// Validate Results
console.log("==================Check Results==================");

let ctxbalance = await ctxContract.balanceOf(subDAOMultisigAddress);
console.log("new subDAOMultisig CTX balance", ethers.utils.formatEther(ctxbalance));

let usdcBalance = await usdcContract.balanceOf(subDAOMultisigAddress);
console.log("new subDAOMultisig usdcBalance balance", usdcBalance/ 10 ** 6);
}
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

0 comments on commit 7ad8d32

Please sign in to comment.