Skip to content

Commit

Permalink
Fix mainnet fork tests (#2285)
Browse files Browse the repository at this point in the history
* Fixed Meta Morpho fork test now funds are in it

* Fix OUSD Vault fork tests now Meta Morpho strategy is live

* Fix OETH AMO fork tests

* Fixed Morpho Aave fork test
  • Loading branch information
naddison36 authored Oct 22, 2024
1 parent 50f7fb3 commit 1fb5af0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
10 changes: 5 additions & 5 deletions contracts/test/strategies/morpho-aave.mainnet.fork-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,28 @@ describe("ForkTest: Morpho Aave Strategy", function () {

const supplyBeforeMint = await ousd.totalSupply();

const amount = "10010";
const redeemAmount = ousdUnits("30000");

// Mint with all three assets
for (const asset of [usdt, usdc, dai]) {
await vault
.connect(anna)
.mint(asset.address, await units(amount, asset), 0);
.mint(asset.address, await units("15000", asset), 0);
}

const currentSupply = await ousd.totalSupply();
const supplyAdded = currentSupply.sub(supplyBeforeMint);
expect(supplyAdded).to.approxEqualTolerance(ousdUnits("30000"), 1);
expect(supplyAdded).to.gt(redeemAmount);

const currentBalance = await ousd.connect(anna).balanceOf(anna.address);

// Now try to redeem 30k
await vault.connect(anna).redeem(ousdUnits("30000"), 0);
await vault.connect(anna).redeem(redeemAmount, 0);

// User balance should be down by 30k
const newBalance = await ousd.connect(anna).balanceOf(anna.address);
expect(newBalance).to.approxEqualTolerance(
currentBalance.sub(ousdUnits("30000")),
currentBalance.sub(redeemAmount),
1
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ describe("ForkTest: OETH AMO Curve Metapool Strategy", function () {
const loadFixture = createFixtureLoader(convexOETHMetaVaultFixture, {
wethMintAmount: 20000,
depositToStrategy: false,
poolAddOethAmount: 7000,
poolAddOethAmount: 5000,
balancePool: true,
});
beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ describe("ForkTest: MetaMorpho USDC Strategy", function () {
vaultSigner,
} = fixture;

const checkBalanceBefore = await OUSDMetaMorphoStrategy.checkBalance(
usdc.address
);

const usdcDepositAmount = await units("1000", usdc);

// Vault transfers USDC to strategy
Expand Down Expand Up @@ -141,7 +145,10 @@ describe("ForkTest: MetaMorpho USDC Strategy", function () {
);
expect(
await OUSDMetaMorphoStrategy.checkBalance(usdc.address)
).to.approxEqualTolerance(usdcDepositAmount, 0.01); // 0.01% or 1 basis point
).to.approxEqualTolerance(
checkBalanceBefore.add(usdcDepositAmount),
0.01
); // 0.01% or 1 basis point
});
it("Only vault can deposit some USDC to the strategy", async function () {
const {
Expand Down
2 changes: 2 additions & 0 deletions contracts/test/vault/vault.mainnet.fork-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ describe("ForkTest: Vault", function () {
"0x89Eb88fEdc50FC77ae8a18aAD1cA0ac27f777a90", // OUSD MetaStrategy
"0x79F2188EF9350A1dC11A062cca0abE90684b0197", // MorphoAaveStrategy
"0x6b69B755C629590eD59618A2712d8a2957CA98FC", // Maker DSR Strategy
"0x603CDEAEC82A60E3C4A10dA6ab546459E5f64Fa0", // Meta Morpho USDC
];

for (const s of strategies) {
Expand Down Expand Up @@ -384,6 +385,7 @@ describe("ForkTest: Vault", function () {
"0x5e3646A1Db86993f73E6b74A57D8640B69F7e259",
"0x9c459eeb3FA179a40329b81C1635525e9A0Ef094",
"0x79F2188EF9350A1dC11A062cca0abE90684b0197", // MorphoAave
"0x603CDEAEC82A60E3C4A10dA6ab546459E5f64Fa0", // Meta Morpho USDC
]).to.include(await vault.assetDefaultStrategies(usdc.address));
});

Expand Down

0 comments on commit 1fb5af0

Please sign in to comment.