Skip to content

Commit

Permalink
fix(hardhat): improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Sep 22, 2023
1 parent 8a7878a commit 9dcf5da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hardhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

jobs:
build-contracts:
name: Compilation
name: Gas tests
runs-on: ubuntu-latest

steps:
Expand Down
7 changes: 3 additions & 4 deletions test/hardhat/MetaMorpho.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import hre from "hardhat";
import _range from "lodash/range";
import { ERC20Mock, IrmMock, OracleMock, MetaMorpho } from "types";
import { IMorpho, MarketParamsStruct } from "types/@morpho-blue/interfaces/IMorpho";
import { MarketAllocationStruct } from "types/src/MetaMorpho";

import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { setNextBlockTimestamp } from "@nomicfoundation/hardhat-network-helpers/dist/src/helpers/time";
Expand Down Expand Up @@ -204,15 +203,15 @@ describe("MetaMorpho", () => {
const market = await morpho.market(identifier(marketParams));
const liquidity = market.totalSupplyAssets - market.totalBorrowAssets;

assets = liquidity / 2n;
if (liquidity < 2n) break;

await randomForwardTimestamp();

await morpho.connect(borrower).supplyCollateral(marketParams, assets, borrower.address, "0x");
await morpho.connect(borrower).supplyCollateral(marketParams, liquidity, borrower.address, "0x");

await randomForwardTimestamp();

await morpho.connect(borrower).borrow(marketParams, assets / 3n, 0, borrower.address, borrower.address);
await morpho.connect(borrower).borrow(marketParams, liquidity / 2n, 0, borrower.address, borrower.address);
}
}
});
Expand Down

0 comments on commit 9dcf5da

Please sign in to comment.