Skip to content

Commit

Permalink
fix(hardhat): use irm mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Oct 25, 2023
1 parent 6bd2ca7 commit 9dc74c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
"build:forge": "FOUNDRY_PROFILE=build forge build",
"build:hardhat": "npx hardhat compile",
"build:blue": "cd lib/morpho-blue/ && yarn build:forge && cd ../..",
"build:irm": "cd lib/morpho-blue-irm/ && forge build && cd ../..",
"typecheck": "tsc --noEmit",
"test:forge": "yarn build:blue && FOUNDRY_PROFILE=test forge test",
"test:hardhat": "yarn build:blue && yarn build:irm && npx hardhat test",
"test:hardhat": "yarn build:blue && npx hardhat test",
"lint": "yarn lint:forge && yarn lint:ts",
"lint:ts": "prettier --check test/hardhat",
"lint:forge": "forge fmt --check",
Expand Down
15 changes: 6 additions & 9 deletions test/hardhat/MetaMorpho.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbiCoder, MaxUint256, ZeroHash, keccak256, toBigInt } from "ethers";
import hre from "hardhat";
import _range from "lodash/range";
import { ERC20Mock, OracleMock, MetaMorpho, IIrm, IMorpho, MetaMorphoFactory, MetaMorpho__factory } from "types";
import { ERC20Mock, OracleMock, MetaMorpho, IMorpho, MetaMorphoFactory, MetaMorpho__factory, IrmMock } from "types";
import { MarketParamsStruct } from "types/@morpho-blue/interfaces/IMorpho";

import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
Expand All @@ -13,7 +13,6 @@ import {
} from "@nomicfoundation/hardhat-network-helpers/dist/src/helpers/time";

// Must use relative import path.
import SpeedJumpIrmArtifact from "../../lib/morpho-blue-irm/out/SpeedJumpIrm.sol/SpeedJumpIrm.json";
import MorphoArtifact from "../../lib/morpho-blue/out/Morpho.sol/Morpho.json";

// Without the division it overflows.
Expand Down Expand Up @@ -72,7 +71,7 @@ describe("MetaMorpho", () => {
let loan: ERC20Mock;
let collateral: ERC20Mock;
let oracle: OracleMock;
let irm: IIrm;
let irm: IrmMock;

let factory: MetaMorphoFactory;
let metaMorpho: MetaMorpho;
Expand Down Expand Up @@ -148,13 +147,11 @@ describe("MetaMorpho", () => {

const morphoAddress = await morpho.getAddress();

const SpeedJumpIrmFactory = await hre.ethers.getContractFactory(
SpeedJumpIrmArtifact.abi,
SpeedJumpIrmArtifact.bytecode.object,
admin,
);
const IrmMockFactory = await hre.ethers.getContractFactory("IrmMock", admin);

irm = await IrmMockFactory.deploy();

irm = (await SpeedJumpIrmFactory.deploy(morphoAddress, ln2, speedFactor, targetUtilization, initialRate)) as IIrm;
await irm.setApr(BigInt.WAD / 100n); // 1%

const loanAddress = await loan.getAddress();
const collateralAddress = await collateral.getAddress();
Expand Down

0 comments on commit 9dc74c4

Please sign in to comment.