Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Crisgarner committed Feb 13, 2023
2 parents a47b105 + fd6f177 commit 43db344
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 6 deletions.
62 changes: 62 additions & 0 deletions scripts/CIP-19.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// run with
// npx hardhat run ./scripts/CIP-19.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("212500");
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-19: Operating Expenditures 2023";
console.log(targets);
console.log(values);
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(9, true);

// Wait to queue
await queueProposal(9);

// Execute transaction
await executeProposal(9);

// 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);
});
12 changes: 6 additions & 6 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let governor: Deployment;
let governorContract: Contract;

const initialize = async () => {
signer = ethers.provider.getSigner("0x8d6f396d210d385033b348bcae9e4f9ea4e045bd");
signer = ethers.provider.getSigner("0x8D6F396D210d385033b348bCae9e4f9Ea4e045bD");
governor = await deployments.get("GovernorBeta");
governorContract = await ethers.getContractAt("GovernorBeta", governor.address, signer);
};
Expand All @@ -21,19 +21,19 @@ export async function fundMultisign(amount: string) {
// VB sends us ETH
await hre.network.provider.request({
method: "hardhat_impersonateAccount",
params: ["0xab5801a7d398351b8be11c439e05c5b3259aec9b"],
params: ["0xd8da6bf26964af9d7eed9e03e53415d37aa96045"],
});

let vbSigner = ethers.provider.getSigner("0xab5801a7d398351b8be11c439e05c5b3259aec9b");
let vbSigner = ethers.provider.getSigner("0xd8da6bf26964af9d7eed9e03e53415d37aa96045");

await vbSigner.sendTransaction({
to: "0x8d6f396d210d385033b348bcae9e4f9ea4e045bd",
to: "0x8D6F396D210d385033b348bCae9e4f9Ea4e045bD",
value: ethers.BigNumber.from(amount),
});

await hre.network.provider.request({
method: "hardhat_impersonateAccount",
params: ["0x8d6f396d210d385033b348bcae9e4f9ea4e045bd"],
params: ["0x8D6F396D210d385033b348bCae9e4f9Ea4e045bD"],
});
}

Expand All @@ -50,7 +50,7 @@ export async function createProposal(

let ctx = await deployments.get("Ctx");
let ctxContract= await ethers.getContractAt("Ctx",ctx.address, signer);
const x = await ctxContract.delegate("0x8d6f396d210d385033b348bcae9e4f9ea4e045bd");
const x = await ctxContract.delegate("0x8D6F396D210d385033b348bCae9e4f9Ea4e045bD");
await ethers.provider.send("evm_mine", []);

console.log("==================Create Proposal==================");
Expand Down

0 comments on commit 43db344

Please sign in to comment.