Skip to content

Commit

Permalink
fix: revert changes for transaction.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Debugger022 committed Sep 25, 2023
1 parent c64f95b commit 544c549
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
import { ethers } from "hardhat";

import { getCalldatas } from "./utils";
import GOVERNOR_BRAVO_DELEGATE_ABI from "./vip-framework/abi/governorBravoDelegateAbi.json";

const DEFAULT_GOVERNOR_PROXY = "0x5573422A1a59385C247ec3a66B93B7C08eC2f8f2";
const DEFAULT_GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a";

export const loadProposal = async (num: string) => {
const x = await import("../vips/vip-174/vip-174-testnet");
console.log("----------------------------XXX", x);
return x["vip174Testnet"]();
const x = await import(`../vips/vip-${num}.ts`);
return x[`vip${num}`]();
};

export const proposeVIP = async (vipNumber: string) => {
export const proposeVIP = async (vipNumber: string, governorProxyAddress?: string) => {
const proposal = await loadProposal(vipNumber);
console.log("----------------------------proposal", proposal);

const [proposer] = await ethers.getSigners();
const governorProxy = await ethers.getContractAt(GOVERNOR_BRAVO_DELEGATE_ABI, DEFAULT_GOVERNOR_PROXY);

const { targets, signatures, values, meta } = proposal;

await governorProxy
.connect(proposer)
.propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type);
const params = [targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type];
let functionSignature = "function propose(address[],uint256[],string[],bytes[],string,uint8)";

// await governorProxy
// .connect(proposer)
// .castVote(296, 1);
};
if (proposal.type === undefined || proposal.type === null) {
functionSignature = "function propose(address[],uint256[],string[],bytes[],string)";
params.pop();
}

proposeVIP(130);
return {
target: governorProxyAddress ?? DEFAULT_GOVERNOR_PROXY,
calldata: new ethers.utils.Interface([functionSignature]).encodeFunctionData("propose", params),
};
};

0 comments on commit 544c549

Please sign in to comment.