Skip to content

Commit

Permalink
Merge pull request #163 from cryptexfinance/cip-29
Browse files Browse the repository at this point in the history
added cip-29
  • Loading branch information
voith authored Jun 12, 2024
2 parents e23a521 + 82592af commit 6c5b496
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
75 changes: 75 additions & 0 deletions scripts/CIP-29.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// run with
// npx hardhat run ./scripts/CIP-29.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 wintermuteAddress = "0xDbefB887662Ca19CD485381F3386fe5F8537B910";
let wintermuteAmount = ethers.utils.parseEther("400000");
let skynetAddress = "0x07147b70576B7295B04b954ea454b0043243Cca3";
let skynetAmount = ethers.utils.parseEther("200000");
let ctx = await deployments.get("Ctx");
let ctxContract = await ethers.getContractAt("Ctx", ctx.address);

const abi = new ethers.utils.AbiCoder();
const targets = [ctx.address, ctx.address];
const values = [BigNumber.from(0), BigNumber.from(0)];
const signatures = ["transfer(address,uint256)", "transfer(address,uint256)"];
const calldatas = [
abi.encode(["address", "uint256"], [wintermuteAddress, wintermuteAmount]),
abi.encode(["address", "uint256"], [skynetAddress, skynetAmount]),
];
const description = "CIP-29: Renew Wintermute Trading/SkyNet Trading";
console.log(targets);
console.log(values.toString());
console.log(signatures);
console.log(calldatas);
console.log(description);

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

ctxbalance = await ctxContract.balanceOf(skynetAddress);
console.log("old skynetAddress 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(20, true);

// Wait to queue
await queueProposal(20);

// Execute transaction
await executeProposal(20);

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

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

ctxbalance = await ctxContract.balanceOf(skynetAddress);
console.log("new skynetAddress CTX balance", ethers.utils.formatEther(ctxbalance));
}
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
2 changes: 1 addition & 1 deletion scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ethers = hre.ethers;
let signer: Signer;
let governor: Deployment;
let governorContract: Contract;
let proposer = "0x4E926f4580A5221D32e8d27D59C0c88F160b620b";
let proposer = "0x19C48BDEbE9925Ff78026385Dc2bf2427B136f69";

const initialize = async () => {
signer = ethers.provider.getSigner(proposer);
Expand Down

0 comments on commit 6c5b496

Please sign in to comment.