From 2c719fb0295e123713e231d785616b1e80103fa0 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 25 Sep 2023 15:33:48 +0530 Subject: [PATCH] fix: renamed diamond comptroller vip files and folders --- .../abi/Comptroller.json | 0 .../abi/IERC20UpgradableAbi.json | 0 .../abi/VBep20DelegateAbi.json | 0 .../abi/priceOracleAbi.json | 0 .../scripts/diamond.ts | 0 .../scripts/facet-cut-params-generator.ts | 0 .../vip-174-testnet}/simulations.ts | 6 ++-- .../vip-174-testnet/utils/cut-params.json} | 0 .../vip-174}/simulations.ts | 6 ++-- .../vip-174}/utils/cut-params.json | 0 src/transactions.ts | 33 ++++++++++--------- .../vip-174-testnet.ts} | 4 +-- .../vip-174.ts} | 4 +-- 13 files changed, 28 insertions(+), 25 deletions(-) rename simulations/{vip-diamond-comptroller => vip-174}/abi/Comptroller.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/abi/IERC20UpgradableAbi.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/abi/VBep20DelegateAbi.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/abi/priceOracleAbi.json (100%) rename simulations/{vip-diamond-comptroller => vip-174}/scripts/diamond.ts (100%) rename simulations/{vip-diamond-comptroller => vip-174}/scripts/facet-cut-params-generator.ts (100%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller-testnet => vip-174/vip-174-testnet}/simulations.ts (98%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json => vip-174/vip-174-testnet/utils/cut-params.json} (100%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller => vip-174/vip-174}/simulations.ts (98%) rename simulations/{vip-diamond-comptroller/vip-diamond-comptroller => vip-174/vip-174}/utils/cut-params.json (100%) rename vips/{vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts => vip-174/vip-174-testnet.ts} (93%) rename vips/{vip-diamond-comptroller/vip-Diamond-comptroller.ts => vip-174/vip-174.ts} (93%) diff --git a/simulations/vip-diamond-comptroller/abi/Comptroller.json b/simulations/vip-174/abi/Comptroller.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/Comptroller.json rename to simulations/vip-174/abi/Comptroller.json diff --git a/simulations/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json b/simulations/vip-174/abi/IERC20UpgradableAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/IERC20UpgradableAbi.json rename to simulations/vip-174/abi/IERC20UpgradableAbi.json diff --git a/simulations/vip-diamond-comptroller/abi/VBep20DelegateAbi.json b/simulations/vip-174/abi/VBep20DelegateAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/VBep20DelegateAbi.json rename to simulations/vip-174/abi/VBep20DelegateAbi.json diff --git a/simulations/vip-diamond-comptroller/abi/priceOracleAbi.json b/simulations/vip-174/abi/priceOracleAbi.json similarity index 100% rename from simulations/vip-diamond-comptroller/abi/priceOracleAbi.json rename to simulations/vip-174/abi/priceOracleAbi.json diff --git a/simulations/vip-diamond-comptroller/scripts/diamond.ts b/simulations/vip-174/scripts/diamond.ts similarity index 100% rename from simulations/vip-diamond-comptroller/scripts/diamond.ts rename to simulations/vip-174/scripts/diamond.ts diff --git a/simulations/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts b/simulations/vip-174/scripts/facet-cut-params-generator.ts similarity index 100% rename from simulations/vip-diamond-comptroller/scripts/facet-cut-params-generator.ts rename to simulations/vip-174/scripts/facet-cut-params-generator.ts diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts b/simulations/vip-174/vip-174-testnet/simulations.ts similarity index 98% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts rename to simulations/vip-174/vip-174-testnet/simulations.ts index 045c62884..936b33c18 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/simulations.ts +++ b/simulations/vip-174/vip-174-testnet/simulations.ts @@ -6,7 +6,7 @@ import { ethers } from "hardhat"; import { initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { vipDiamondTestnet } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet"; +import { vip174Testnet } from "../../../vips/vip-174/vip-174-testnet"; import Comptroller from "../abi/Comptroller.json"; import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; @@ -178,7 +178,7 @@ forking(33497000, async () => { }); }); - testVip("VIP-Diamond Contract Migration", vipDiamondTestnet()); + testVip("VIP-Diamond Contract Migration", vip174Testnet()); describe("Verify Storage slots after VIP execution", async () => { // These tests checks the storage collision of comptroller while updating it via diamond. @@ -363,7 +363,7 @@ forking(33497000, async () => { let diamondUnitroller: Contract; before(async () => { - await pretendExecutingVip(vipDiamondTestnet()); + await pretendExecutingVip(vip174Testnet()); unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json b/simulations/vip-174/vip-174-testnet/utils/cut-params.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json rename to simulations/vip-174/vip-174-testnet/utils/cut-params.json diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts b/simulations/vip-174/vip-174/simulations.ts similarity index 98% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts rename to simulations/vip-174/vip-174/simulations.ts index 5d885d315..f010c30de 100644 --- a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/simulations.ts +++ b/simulations/vip-174/vip-174/simulations.ts @@ -6,7 +6,7 @@ import { ethers } from "hardhat"; import { initMainnetUser } from "../../../src/utils"; import { forking, pretendExecutingVip, testVip } from "../../../src/vip-framework"; -import { vipDiamondComptroller } from "../../../vips/vip-diamond-comptroller/vip-Diamond-comptroller"; +import { vip174 } from "../../../vips/vip-174/vip-174"; import Comptroller from "../abi/Comptroller.json"; import IERC20Upgradeable from "../abi/IERC20UpgradableAbi.json"; import VBEP20_DELEGATE_ABI from "../abi/VBep20DelegateAbi.json"; @@ -178,7 +178,7 @@ forking(31933620, async () => { }); }); - testVip("VIP-Diamond Contract Migration", vipDiamondComptroller()); + testVip("VIP-Diamond Contract Migration", vip174()); describe("Verify Storage slots after VIP execution", async () => { // These tests checks the storage collision of comptroller while updating it via diamond. @@ -363,7 +363,7 @@ forking(31933620, async () => { let diamondUnitroller: Contract; before(async () => { - await pretendExecutingVip(vipDiamondComptroller()); + await pretendExecutingVip(vip174()); unitroller = new ethers.Contract(UNITROLLER, Comptroller, ethers.provider); diamondUnitroller = new ethers.Contract(unitroller.address, Comptroller, ethers.provider); diff --git a/simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json b/simulations/vip-174/vip-174/utils/cut-params.json similarity index 100% rename from simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json rename to simulations/vip-174/vip-174/utils/cut-params.json diff --git a/src/transactions.ts b/src/transactions.ts index e61d45028..5bfea322e 100644 --- a/src/transactions.ts +++ b/src/transactions.ts @@ -1,29 +1,32 @@ import { ethers } from "hardhat"; import { getCalldatas } from "./utils"; +import GOVERNOR_BRAVO_DELEGATE_ABI from "./vip-framework/abi/governorBravoDelegateAbi.json"; -const DEFAULT_GOVERNOR_PROXY = "0x2d56dC077072B53571b8252008C60e945108c75a"; +const DEFAULT_GOVERNOR_PROXY = "0x5573422A1a59385C247ec3a66B93B7C08eC2f8f2"; export const loadProposal = async (num: string) => { - const x = await import(`../vips/vip-${num}.ts`); - return x[`vip${num}`](); + const x = await import("../vips/vip-174/vip-174-testnet"); + console.log("----------------------------XXX", x); + return x["vip174Testnet"](); }; -export const proposeVIP = async (vipNumber: string, governorProxyAddress?: string) => { +export const proposeVIP = async (vipNumber: string) => { const proposal = await loadProposal(vipNumber); + console.log("----------------------------proposal", proposal); - const { targets, signatures, values, meta } = proposal; + const [proposer] = await ethers.getSigners(); + const governorProxy = await ethers.getContractAt(GOVERNOR_BRAVO_DELEGATE_ABI, DEFAULT_GOVERNOR_PROXY); - const params = [targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type]; - let functionSignature = "function propose(address[],uint256[],string[],bytes[],string,uint8)"; + const { targets, signatures, values, meta } = proposal; - if (proposal.type === undefined || proposal.type === null) { - functionSignature = "function propose(address[],uint256[],string[],bytes[],string)"; - params.pop(); - } + await governorProxy + .connect(proposer) + .propose(targets, values, signatures, getCalldatas(proposal), JSON.stringify(meta), proposal.type); - return { - target: governorProxyAddress ?? DEFAULT_GOVERNOR_PROXY, - calldata: new ethers.utils.Interface([functionSignature]).encodeFunctionData("propose", params), - }; + // await governorProxy + // .connect(proposer) + // .castVote(296, 1); }; + +proposeVIP(130); diff --git a/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts b/vips/vip-174/vip-174-testnet.ts similarity index 93% rename from vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts rename to vips/vip-174/vip-174-testnet.ts index 91488d3f4..8818d3e7a 100644 --- a/vips/vip-diamond-comptroller/vip-Diamond-comptroller-testnet.ts +++ b/vips/vip-174/vip-174-testnet.ts @@ -1,4 +1,4 @@ -import { cutParams as params } from "../../simulations/vip-diamond-comptroller/vip-diamond-comptroller-testnet/utils/cut-params-testnet.json"; +import { cutParams as params } from "../../simulations/vip-174/vip-174-testnet/utils/cut-params.json"; import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; @@ -35,7 +35,7 @@ const grantAccessControl = () => { return accessProposals; }; -export const vipDiamondTestnet = () => { +export const vip174Testnet = () => { const meta = { version: "v1", title: "VIP Comptroller Diamond proxy", diff --git a/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts b/vips/vip-174/vip-174.ts similarity index 93% rename from vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts rename to vips/vip-174/vip-174.ts index 3288eb676..41c17d414 100644 --- a/vips/vip-diamond-comptroller/vip-Diamond-comptroller.ts +++ b/vips/vip-174/vip-174.ts @@ -1,4 +1,4 @@ -import { cutParams as params } from "../../simulations/vip-diamond-comptroller/vip-diamond-comptroller/utils/cut-params.json"; +import { cutParams as params } from "../../simulations/vip-174/vip-174/utils/cut-params.json"; import { ProposalType } from "../../src/types"; import { makeProposal } from "../../src/utils"; @@ -35,7 +35,7 @@ const grantAccessControl = () => { return accessProposals; }; -export const vipDiamondComptroller = () => { +export const vip174 = () => { const meta = { version: "v1", title: "VIP Comptroller Diamond proxy",