Skip to content

Commit 2b51eeb

Browse files
authored
Fix deploy tooling (#1257)
* Fix deploy tooling * Fix script * Prettify * Try and fix fork tests * Prettify * Fix more tests * Fix Morpho compound
1 parent d00df74 commit 2b51eeb

File tree

9 files changed

+48
-43
lines changed

9 files changed

+48
-43
lines changed

contracts/deploy/048_deposit_withdraw_tooling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { deploymentWithGovernanceProposal } = require("../utils/deploy");
22
const addresses = require("../utils/addresses");
33
const { isMainnet } = require("../test/helpers.js");
44

5-
module.exports = deploymentWithProposal(
5+
module.exports = deploymentWithGovernanceProposal(
66
{
77
deployName: "048_deposit_withdraw_tooling",
88
forceDeploy: false,

contracts/test/_fixture.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function defaultFixture() {
3333
keepExistingDeployments: Boolean(isForkWithLocalNode),
3434
});
3535

36-
const { governorAddr } = await getNamedAccounts();
36+
const { governorAddr, timelockAddr } = await getNamedAccounts();
3737

3838
const ousdProxy = await ethers.getContract("OUSDProxy");
3939
const vaultProxy = await ethers.getContract("VaultProxy");
@@ -315,11 +315,13 @@ async function defaultFixture() {
315315
let governor = signers[1];
316316
const strategist = signers[0];
317317
const adjuster = signers[0];
318+
let timelock;
318319

319320
const [matt, josh, anna, domen, daniel, franck] = signers.slice(4);
320321

321322
if (isFork) {
322323
governor = await impersonateAndFundContract(governorAddr);
324+
timelock = await impersonateAndFundContract(timelockAddr);
323325
}
324326
await fundAccounts();
325327
if (isFork) {
@@ -351,6 +353,7 @@ async function defaultFixture() {
351353
domen,
352354
daniel,
353355
franck,
356+
timelock,
354357
// Contracts
355358
ousd,
356359
vault,
@@ -664,8 +667,8 @@ async function convexMetaVaultFixture() {
664667
async function morphoCompoundFixture() {
665668
const fixture = await loadFixture(defaultFixture);
666669

667-
const { governorAddr } = await getNamedAccounts();
668-
const sGovernor = await ethers.provider.getSigner(governorAddr);
670+
const { timelockAddr } = await getNamedAccounts();
671+
const sGovernor = await ethers.provider.getSigner(timelockAddr);
669672

670673
if (isFork) {
671674
await fixture.vault
@@ -703,10 +706,12 @@ async function morphoCompoundFixture() {
703706
async function morphoAaveFixture() {
704707
const fixture = await loadFixture(defaultFixture);
705708

706-
const { governorAddr } = await getNamedAccounts();
707-
const sGovernor = await ethers.provider.getSigner(governorAddr);
709+
const { governorAddr, timelockAddr } = await getNamedAccounts();
710+
let sGovernor = await ethers.provider.getSigner(governorAddr);
708711

709712
if (isFork) {
713+
sGovernor = await ethers.provider.getSigner(timelockAddr);
714+
710715
await fixture.vault
711716
.connect(sGovernor)
712717
.setAssetDefaultStrategy(
@@ -751,8 +756,8 @@ async function convexGeneralizedMetaForkedFixture(
751756
) {
752757
return async () => {
753758
const fixture = await loadFixture(defaultFixture);
754-
const { governorAddr } = await getNamedAccounts();
755-
const sGovernor = await ethers.provider.getSigner(governorAddr);
759+
const { timelockAddr } = await getNamedAccounts();
760+
const sGovernor = await ethers.provider.getSigner(timelockAddr);
756761
const { josh, matt, anna, domen, daniel, franck } = fixture;
757762

758763
const threepoolLP = await ethers.getContractAt(

contracts/test/_metastrategies-fixtures.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ const erc20Abi = require("./abi/erc20.json");
1616
async function withDefaultOUSDMetapoolStrategiesSet() {
1717
const fixture = await loadFixture(convexMetaVaultFixture);
1818

19-
const { vault, governor, usdt, usdc, OUSDmetaStrategy } = fixture;
19+
const { vault, timelock, usdt, usdc, OUSDmetaStrategy } = fixture;
2020

2121
await vault
22-
.connect(governor)
22+
.connect(timelock)
2323
.setAssetDefaultStrategy(usdt.address, OUSDmetaStrategy.address);
2424

2525
await vault
26-
.connect(governor)
26+
.connect(timelock)
2727
.setAssetDefaultStrategy(usdc.address, OUSDmetaStrategy.address);
2828

2929
return fixture;

contracts/test/strategies/generalized-meta.fork-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ metastrategies.forEach(
172172
this.skip();
173173
return;
174174
}
175-
const { governorAddr } = await getNamedAccounts();
176-
const sGovernor = await ethers.provider.getSigner(governorAddr);
175+
const { timelockAddr } = await getNamedAccounts();
176+
const sGovernor = await ethers.provider.getSigner(timelockAddr);
177177

178178
const { vault, usdt, anna } = fixture;
179179

@@ -236,8 +236,8 @@ metastrategies.forEach(
236236
this.skip();
237237
return;
238238
}
239-
const { governorAddr } = await getNamedAccounts();
240-
const sGovernor = await ethers.provider.getSigner(governorAddr);
239+
const { timelockAddr } = await getNamedAccounts();
240+
const sGovernor = await ethers.provider.getSigner(timelockAddr);
241241

242242
const { vault, usdt, anna } = fixture;
243243

contracts/test/vault/harvester.fork-test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,38 @@ forkOnlyDescribe("ForkTest: Harvester", function () {
7676

7777
describe("Harvest", () => {
7878
it("Should harvest from all strategies", async () => {
79-
const { harvester, governor } = fixture;
80-
await harvester.connect(governor)["harvest()"]();
79+
const { harvester, timelock } = fixture;
80+
await harvester.connect(timelock)["harvest()"]();
8181
});
8282

8383
it("Should swap all coins", async () => {
84-
const { harvester, governor } = fixture;
85-
await harvester.connect(governor).swap();
84+
const { harvester, timelock } = fixture;
85+
await harvester.connect(timelock).swap();
8686
});
8787

8888
it("Should harvest and swap from all strategies", async () => {
89-
const { harvester, governor } = fixture;
90-
await harvester.connect(governor)["harvestAndSwap()"]();
89+
const { harvester, timelock } = fixture;
90+
await harvester.connect(timelock)["harvestAndSwap()"]();
9191
});
9292

9393
it("Should swap CRV", async () => {
94-
const { harvester, governor, crv } = fixture;
95-
await harvester.connect(governor).swapRewardToken(crv.address);
94+
const { harvester, timelock, crv } = fixture;
95+
await harvester.connect(timelock).swapRewardToken(crv.address);
9696
});
9797

9898
it("Should swap CVX", async () => {
99-
const { harvester, governor, cvx } = fixture;
100-
await harvester.connect(governor).swapRewardToken(cvx.address);
99+
const { harvester, timelock, cvx } = fixture;
100+
await harvester.connect(timelock).swapRewardToken(cvx.address);
101101
});
102102

103103
it("Should swap COMP", async () => {
104-
const { harvester, governor, comp } = fixture;
105-
await harvester.connect(governor).swapRewardToken(comp.address);
104+
const { harvester, timelock, comp } = fixture;
105+
await harvester.connect(timelock).swapRewardToken(comp.address);
106106
});
107107

108108
it("Should swap AAVE", async () => {
109-
const { harvester, governor, aave } = fixture;
110-
await harvester.connect(governor).swapRewardToken(aave.address);
109+
const { harvester, timelock, aave } = fixture;
110+
await harvester.connect(timelock).swapRewardToken(aave.address);
111111
});
112112

113113
// TODO: Tests for `harvest(address)` for each strategy

contracts/test/vault/vault.fork-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ forkOnlyDescribe("ForkTest: Vault", function () {
4242
it("Should have the correct governor address set", async () => {
4343
const { vault } = fixture;
4444
expect(await vault.governor()).to.equal(
45-
"0x72426BA137DEC62657306b12B1E869d43FeC6eC7"
45+
"0x35918cDE7233F2dD33fA41ae3Cb6aE0e42E0e69F"
4646
);
4747
});
4848

@@ -355,8 +355,8 @@ forkOnlyDescribe("ForkTest: Vault", function () {
355355
});
356356

357357
it("Should be able to withdraw from all strategies", async () => {
358-
const { vault, governor } = fixture;
359-
await vault.connect(governor).withdrawAllFromStrategies();
358+
const { vault, timelock } = fixture;
359+
await vault.connect(timelock).withdrawAllFromStrategies();
360360
});
361361
});
362362
});

contracts/utils/deploy.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ const deployWithConfirmation = async (
5353
) => {
5454
// check that upgrade doesn't corrupt the storage slots
5555
if (!skipUpgradeSafety) {
56-
await assertUpgradeIsSafe(hre, contractName);
56+
await assertUpgradeIsSafe(
57+
hre,
58+
typeof contract == "string" ? contract : contractName
59+
);
5760
}
5861

5962
const { deploy } = deployments;
@@ -791,7 +794,7 @@ function deploymentWithProposal(opts, fn) {
791794
return;
792795
}
793796

794-
await sanityCheck();
797+
await sanityCheckOgvGovernance();
795798
const proposal = await fn(tools);
796799
const propDescription = proposal.name;
797800
const propArgs = await proposeArgs(proposal.actions);

contracts/utils/governor.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ async function proposeArgs(governorArgsArray) {
3636
* @returns {Promise<*[]>}
3737
*/
3838
async function proposeGovernanceArgs(governorArgsArray) {
39-
const args = await proposeArgs(governorArgsArray);
39+
const [targets, sigs, calldata] = await proposeArgs(governorArgsArray);
4040

4141
return [
42-
args[0],
43-
Array(governorArgsArray).fill(BigNumber.from(0)),
44-
args[1],
45-
args[2],
42+
targets,
43+
Array(governorArgsArray.length).fill(BigNumber.from(0)),
44+
sigs,
45+
calldata,
4646
];
4747
}
4848

dapp/pages/_app.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ const queryClient = new QueryClient()
3535
function App({ Component, pageProps, err }) {
3636
const [locale, setLocale] = useState('en_US')
3737

38-
const {
39-
account,
40-
active,
41-
} = useWeb3React()
38+
const { account, active } = useWeb3React()
4239
const [cookies, setCookie, removeCookie] = useCookies(['loggedIn'])
4340
const router = useRouter()
4441
const tried = useEagerConnect()

0 commit comments

Comments
 (0)