Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/deploy/048_deposit_withdraw_tooling.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { deploymentWithGovernanceProposal } = require("../utils/deploy");
const addresses = require("../utils/addresses");
const { isMainnet } = require("../test/helpers.js");

module.exports = deploymentWithProposal(
module.exports = deploymentWithGovernanceProposal(
{
deployName: "048_deposit_withdraw_tooling",
forceDeploy: false,
Expand Down
19 changes: 12 additions & 7 deletions contracts/test/_fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function defaultFixture() {
keepExistingDeployments: Boolean(isForkWithLocalNode),
});

const { governorAddr } = await getNamedAccounts();
const { governorAddr, timelockAddr } = await getNamedAccounts();

const ousdProxy = await ethers.getContract("OUSDProxy");
const vaultProxy = await ethers.getContract("VaultProxy");
Expand Down Expand Up @@ -315,11 +315,13 @@ async function defaultFixture() {
let governor = signers[1];
const strategist = signers[0];
const adjuster = signers[0];
let timelock;

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

if (isFork) {
governor = await impersonateAndFundContract(governorAddr);
timelock = await impersonateAndFundContract(timelockAddr);
}
await fundAccounts();
if (isFork) {
Expand Down Expand Up @@ -351,6 +353,7 @@ async function defaultFixture() {
domen,
daniel,
franck,
timelock,
// Contracts
ousd,
vault,
Expand Down Expand Up @@ -664,8 +667,8 @@ async function convexMetaVaultFixture() {
async function morphoCompoundFixture() {
const fixture = await loadFixture(defaultFixture);

const { governorAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(governorAddr);
const { timelockAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(timelockAddr);

if (isFork) {
await fixture.vault
Expand Down Expand Up @@ -703,10 +706,12 @@ async function morphoCompoundFixture() {
async function morphoAaveFixture() {
const fixture = await loadFixture(defaultFixture);

const { governorAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(governorAddr);
const { governorAddr, timelockAddr } = await getNamedAccounts();
let sGovernor = await ethers.provider.getSigner(governorAddr);

if (isFork) {
sGovernor = await ethers.provider.getSigner(timelockAddr);

await fixture.vault
.connect(sGovernor)
.setAssetDefaultStrategy(
Expand Down Expand Up @@ -751,8 +756,8 @@ async function convexGeneralizedMetaForkedFixture(
) {
return async () => {
const fixture = await loadFixture(defaultFixture);
const { governorAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(governorAddr);
const { timelockAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(timelockAddr);
const { josh, matt, anna, domen, daniel, franck } = fixture;

const threepoolLP = await ethers.getContractAt(
Expand Down
6 changes: 3 additions & 3 deletions contracts/test/_metastrategies-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const erc20Abi = require("./abi/erc20.json");
async function withDefaultOUSDMetapoolStrategiesSet() {
const fixture = await loadFixture(convexMetaVaultFixture);

const { vault, governor, usdt, usdc, OUSDmetaStrategy } = fixture;
const { vault, timelock, usdt, usdc, OUSDmetaStrategy } = fixture;

await vault
.connect(governor)
.connect(timelock)
.setAssetDefaultStrategy(usdt.address, OUSDmetaStrategy.address);

await vault
.connect(governor)
.connect(timelock)
.setAssetDefaultStrategy(usdc.address, OUSDmetaStrategy.address);

return fixture;
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/strategies/generalized-meta.fork-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ metastrategies.forEach(
this.skip();
return;
}
const { governorAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(governorAddr);
const { timelockAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(timelockAddr);

const { vault, usdt, anna } = fixture;

Expand Down Expand Up @@ -236,8 +236,8 @@ metastrategies.forEach(
this.skip();
return;
}
const { governorAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(governorAddr);
const { timelockAddr } = await getNamedAccounts();
const sGovernor = await ethers.provider.getSigner(timelockAddr);

const { vault, usdt, anna } = fixture;

Expand Down
28 changes: 14 additions & 14 deletions contracts/test/vault/harvester.fork-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,38 +76,38 @@ forkOnlyDescribe("ForkTest: Harvester", function () {

describe("Harvest", () => {
it("Should harvest from all strategies", async () => {
const { harvester, governor } = fixture;
await harvester.connect(governor)["harvest()"]();
const { harvester, timelock } = fixture;
await harvester.connect(timelock)["harvest()"]();
});

it("Should swap all coins", async () => {
const { harvester, governor } = fixture;
await harvester.connect(governor).swap();
const { harvester, timelock } = fixture;
await harvester.connect(timelock).swap();
});

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

it("Should swap CRV", async () => {
const { harvester, governor, crv } = fixture;
await harvester.connect(governor).swapRewardToken(crv.address);
const { harvester, timelock, crv } = fixture;
await harvester.connect(timelock).swapRewardToken(crv.address);
});

it("Should swap CVX", async () => {
const { harvester, governor, cvx } = fixture;
await harvester.connect(governor).swapRewardToken(cvx.address);
const { harvester, timelock, cvx } = fixture;
await harvester.connect(timelock).swapRewardToken(cvx.address);
});

it("Should swap COMP", async () => {
const { harvester, governor, comp } = fixture;
await harvester.connect(governor).swapRewardToken(comp.address);
const { harvester, timelock, comp } = fixture;
await harvester.connect(timelock).swapRewardToken(comp.address);
});

it("Should swap AAVE", async () => {
const { harvester, governor, aave } = fixture;
await harvester.connect(governor).swapRewardToken(aave.address);
const { harvester, timelock, aave } = fixture;
await harvester.connect(timelock).swapRewardToken(aave.address);
});

// TODO: Tests for `harvest(address)` for each strategy
Expand Down
6 changes: 3 additions & 3 deletions contracts/test/vault/vault.fork-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ forkOnlyDescribe("ForkTest: Vault", function () {
it("Should have the correct governor address set", async () => {
const { vault } = fixture;
expect(await vault.governor()).to.equal(
"0x72426BA137DEC62657306b12B1E869d43FeC6eC7"
"0x35918cDE7233F2dD33fA41ae3Cb6aE0e42E0e69F"
);
});

Expand Down Expand Up @@ -355,8 +355,8 @@ forkOnlyDescribe("ForkTest: Vault", function () {
});

it("Should be able to withdraw from all strategies", async () => {
const { vault, governor } = fixture;
await vault.connect(governor).withdrawAllFromStrategies();
const { vault, timelock } = fixture;
await vault.connect(timelock).withdrawAllFromStrategies();
});
});
});
7 changes: 5 additions & 2 deletions contracts/utils/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ const deployWithConfirmation = async (
) => {
// check that upgrade doesn't corrupt the storage slots
if (!skipUpgradeSafety) {
await assertUpgradeIsSafe(hre, contractName);
await assertUpgradeIsSafe(
hre,
typeof contract == "string" ? contract : contractName
);
}

const { deploy } = deployments;
Expand Down Expand Up @@ -791,7 +794,7 @@ function deploymentWithProposal(opts, fn) {
return;
}

await sanityCheck();
await sanityCheckOgvGovernance();
const proposal = await fn(tools);
const propDescription = proposal.name;
const propArgs = await proposeArgs(proposal.actions);
Expand Down
10 changes: 5 additions & 5 deletions contracts/utils/governor.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ async function proposeArgs(governorArgsArray) {
* @returns {Promise<*[]>}
*/
async function proposeGovernanceArgs(governorArgsArray) {
const args = await proposeArgs(governorArgsArray);
const [targets, sigs, calldata] = await proposeArgs(governorArgsArray);

return [
args[0],
Array(governorArgsArray).fill(BigNumber.from(0)),
args[1],
args[2],
targets,
Array(governorArgsArray.length).fill(BigNumber.from(0)),
sigs,
calldata,
];
}

Expand Down
5 changes: 1 addition & 4 deletions dapp/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ const queryClient = new QueryClient()
function App({ Component, pageProps, err }) {
const [locale, setLocale] = useState('en_US')

const {
account,
active,
} = useWeb3React()
const { account, active } = useWeb3React()
const [cookies, setCookie, removeCookie] = useCookies(['loggedIn'])
const router = useRouter()
const tried = useEagerConnect()
Expand Down