Skip to content

Commit

Permalink
Merge pull request #61 from morpho-org/style/naming
Browse files Browse the repository at this point in the history
style: v1.1 naming
  • Loading branch information
MathisGD authored Dec 19, 2024
2 parents 7f4d1e5 + c0a5d03 commit 1f46b9a
Show file tree
Hide file tree
Showing 20 changed files with 152 additions and 140 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# MetaMorpho No Bad Debt Realization
# MetaMorpho v1.1

> [!NOTE]
> [!NOTE]
> This repo is a fork of [metamorpho](https://github.com/morpho-org/metamorpho), with 4 changes:
> - this MetaMorpho vault does not realize the bad debt (more on this [here](https://github.com/morpho-org/metamorpho-no-bad-debt-realization/blob/d16ecfed0da4b4c51ed65c2eba865f5623c2242b/src/interfaces/IMetaMorpho.sol#L81));
>
> - this MetaMorpho vault does not realize the bad debt (more on this [here](https://github.com/morpho-org/metamorpho-no-bad-debt-realization/blob/d16ecfed0da4b4c51ed65c2eba865f5623c2242b/src/interfaces/IMetaMorphoV1_1.sol#L81));
> - the timelock can be set to zero at deployment;
> - the name and symbol are mutable;
> - `reallocate` always reverts if the market is not enabled in the vault.
Expand All @@ -17,9 +18,9 @@ Users of MetaMorpho are liquidity providers who want to earn from borrowing inte
The active management of the deposited assets is the responsibility of a set of different roles (owner, curator and allocators).
These roles are primarily responsible for enabling and disabling markets on Morpho Blue and managing the allocation of users’ funds.

[`MetaMorpho`](./src/MetaMorpho.sol) vaults are [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) vaults, with ([ERC-2612](https://eips.ethereum.org/EIPS/eip-2612)) permit.
[`MetaMorphoV1_1`](./src/MetaMorphoV1_1.sol) vaults are [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) vaults, with ([ERC-2612](https://eips.ethereum.org/EIPS/eip-2612)) permit.
One MetaMorpho vault is related to one loan asset on Morpho Blue.
The [`MetaMorphoFactory`](./src/MetaMorphoFactory.sol) is deploying immutable onchain instances of MetaMorpho vaults.
The [`MetaMorphoV1_1Factory`](./src/MetaMorphoV1_1Factory.sol) is deploying immutable onchain instances of MetaMorpho vaults.

Users can supply or withdraw assets at any time, depending on the available liquidity on Morpho Blue.
A maximum of 30 markets can be enabled on a given MetaMorpho vault.
Expand Down
24 changes: 12 additions & 12 deletions certora/applyMunging.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -ruN interfaces/IMetaMorpho.sol interfaces/IMetaMorpho.sol
--- interfaces/IMetaMorpho.sol
+++ interfaces/IMetaMorpho.sol
diff -ruN interfaces/IMetaMorphoV1_1.sol interfaces/IMetaMorphoV1_1.sol
--- interfaces/IMetaMorphoV1_1.sol
+++ interfaces/IMetaMorphoV1_1.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
Expand All @@ -11,21 +11,21 @@ diff -ruN interfaces/IMetaMorpho.sol interfaces/IMetaMorpho.sol
import {IERC20Permit} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol";

@@ -30,7 +30,7 @@
/// @dev Consider using the IMetaMorpho interface instead of this one.
interface IMetaMorphoBase {
/// @dev Consider using the IMetaMorphoV1_1 interface instead of this one.
interface IMetaMorphoV1_1Base {
/// @notice The address of the Morpho contract.
- function MORPHO() external view returns (IMorpho);
+ function MORPHO() external view returns (IMorphoHarness);
function DECIMALS_OFFSET() external view returns (uint8);

/// @notice The address of the curator.
diff -ruN MetaMorpho.sol MetaMorpho.sol
--- MetaMorpho.sol
+++ MetaMorpho.sol
diff -ruN MetaMorphoV1_1.sol MetaMorphoV1_1.sol
--- MetaMorphoV1_1.sol
+++ MetaMorphoV1_1.sol
@@ -9,7 +9,7 @@
IMetaMorphoBase,
IMetaMorphoStaticTyping
} from "./interfaces/IMetaMorpho.sol";
IMetaMorphoV1_1Base,
IMetaMorphoV1_1StaticTyping
} from "./interfaces/IMetaMorphoV1_1.sol";
-import {Id, MarketParams, Market, IMorpho} from "../lib/morpho-blue/src/interfaces/IMorpho.sol";
+import {Id, MarketParams, Market, IMorphoHarness} from "../certora/helpers/IMorphoHarness.sol";

Expand Down Expand Up @@ -55,7 +55,7 @@ diff -ruN MetaMorpho.sol MetaMorpho.sol
@@ -56,7 +52,7 @@
/* IMMUTABLES */

/// @inheritdoc IMetaMorphoBase
/// @inheritdoc IMetaMorphoV1_1Base
- IMorpho public immutable MORPHO;
+ IMorphoHarness public immutable MORPHO;

Expand Down
2 changes: 1 addition & 1 deletion certora/gambit.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"filename" : "../src/MetaMorpho.sol",
"filename" : "../src/MetaMorphoV1_1.sol",
"sourceroot": "..",
"num_mutants": 15,
"solc_remappings": []
Expand Down
2 changes: 1 addition & 1 deletion certora/helpers/ERC20Helper.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.26;

import {IERC20, SafeERC20} from "../../munged/MetaMorpho.sol";
import {IERC20, SafeERC20} from "../../munged/MetaMorphoV1_1.sol";

contract ERC20Helper {
using SafeERC20 for IERC20;
Expand Down
8 changes: 4 additions & 4 deletions certora/helpers/MetaMorphoHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ pragma solidity 0.8.26;

import {
Math,
MetaMorpho,
MetaMorphoV1_1,
Id,
ConstantsLib,
PendingUint192,
PendingAddress,
MarketConfig
} from "../../munged/MetaMorpho.sol";
} from "../../munged/MetaMorphoV1_1.sol";

contract MetaMorphoHarness is MetaMorpho {
contract MetaMorphoHarness is MetaMorphoV1_1 {
constructor(
address owner,
address morpho,
uint256 initialTimelock,
address _asset,
string memory _name,
string memory _symbol
) MetaMorpho(owner, morpho, initialTimelock, _asset, _name, _symbol) {}
) MetaMorphoV1_1(owner, morpho, initialTimelock, _asset, _name, _symbol) {}

function pendingTimelock_() external view returns (PendingUint192 memory) {
return pendingTimelock;
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@morpho-org/metamorpho",
"description": "MetaMorpho",
"name": "@morpho-org/metamorpho-v1.1",
"description": "MetaMorpho V1.1",
"license": "GPL-2.0-or-later",
"version": "1.1.0",
"main": "lib/index.js",
Expand Down Expand Up @@ -28,17 +28,17 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/morpho-org/metamorpho.git"
"url": "git+https://github.com/morpho-org/metamorpho-v1.1.git"
},
"author": {
"name": "Morpho Labs",
"email": "security@morpho.org",
"url": "https://github.com/morpho-labs"
},
"bugs": {
"url": "https://github.com/morpho-org/metamorpho/issues"
"url": "https://github.com/morpho-org/metamorpho-v1.1/issues"
},
"homepage": "https://github.com/morpho-org/metamorpho#readme",
"homepage": "https://github.com/morpho-org/metamorpho-v1.1#readme",
"dependencies": {
"ethers": "^6.9.2",
"evm-maths": "^6.0.0",
Expand Down
6 changes: 3 additions & 3 deletions pkg/MetaMorphoAction.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BigNumberish } from "ethers";
import { MetaMorpho__factory } from "types";
import { MarketAllocationStruct, MarketParamsStruct } from "types/src/MetaMorpho";
import { MetaMorphoV1_1__factory } from "types";
import { MarketAllocationStruct, MarketParamsStruct } from "types/src/MetaMorphoV1_1";

const METAMORPHO_IFC = MetaMorpho__factory.createInterface();
const METAMORPHO_IFC = MetaMorphoV1_1__factory.createInterface();

export type MetaMorphoCall = string;

Expand Down
Loading

0 comments on commit 1f46b9a

Please sign in to comment.