Skip to content

Commit

Permalink
fix: solidity versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Grimal committed Oct 17, 2024
1 parent 452ecea commit 08a9cb8
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 24 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/morpho-blue-bundlers"]
path = lib/morpho-blue-bundlers
url = https://github.com/morpho-org/morpho-blue-bundlers
1 change: 0 additions & 1 deletion lib/morpho-blue-bundlers
Submodule morpho-blue-bundlers deleted from 97ecc8
2 changes: 1 addition & 1 deletion src/MorphoToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
pragma solidity ^0.8.27;

import {ERC20Upgradeable} from "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol";
import {Ownable2StepUpgradeable} from
Expand Down
2 changes: 1 addition & 1 deletion src/Wrapper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
pragma solidity ^0.8.27;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

Expand Down
24 changes: 6 additions & 18 deletions test/MorphoTokenMigration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ pragma solidity ^0.8.13;
import {console} from "lib/forge-std/src/Test.sol";
import {BaseTest} from "./helpers/BaseTest.sol";
import {Wrapper} from "../src/Wrapper.sol";
import {IMulticall} from "lib/morpho-blue-bundlers/src/interfaces/IMulticall.sol";
import {TransferBundler} from "lib/morpho-blue-bundlers/src/TransferBundler.sol";
import {ERC20WrapperBundler} from "lib/morpho-blue-bundlers/src/ERC20WrapperBundler.sol";
import {IMulticall} from "./helpers/interfaces/IMulticall.sol";
import {EncodeLib} from "./helpers/libraries/EncodeLib.sol";
import {IERC20} from
"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

// TODO: Test the following:
// - Test migration flow
// - Test bundler wrapping
contract MorphoTokenMigrationTest is BaseTest {
address internal constant BUNDLER_ADDRESS = 0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077;
address internal constant LEGACY_MORPHO = 0x9994E35Db50125E0DF82e4c2dde62496CE330999;
Expand Down Expand Up @@ -75,8 +71,8 @@ contract MorphoTokenMigrationTest is BaseTest {
function testDAOMigration() public {
uint256 daoTokenAmount = legacyMorpho.balanceOf(MORPHO_DAO);

bundle.push(_erc20TransferFrom(LEGACY_MORPHO, daoTokenAmount));
bundle.push(_erc20WrapperDepositFor(address(wrapper), daoTokenAmount));
bundle.push(EncodeLib._erc20TransferFrom(LEGACY_MORPHO, daoTokenAmount));
bundle.push(EncodeLib._erc20WrapperDepositFor(address(wrapper), daoTokenAmount));

vm.startPrank(MORPHO_DAO);
legacyMorpho.approve(address(bundler), daoTokenAmount);
Expand All @@ -95,8 +91,8 @@ contract MorphoTokenMigrationTest is BaseTest {

deal(LEGACY_MORPHO, migrater, amount);

bundle.push(_erc20TransferFrom(LEGACY_MORPHO, amount));
bundle.push(_erc20WrapperDepositFor(address(wrapper), amount));
bundle.push(EncodeLib._erc20TransferFrom(LEGACY_MORPHO, amount));
bundle.push(EncodeLib._erc20WrapperDepositFor(address(wrapper), amount));

vm.startPrank(migrater);
legacyMorpho.approve(address(bundler), amount);
Expand All @@ -107,14 +103,6 @@ contract MorphoTokenMigrationTest is BaseTest {
assertEq(legacyMorpho.balanceOf(address(wrapper)), amount, "legacyMorpho.balanceOf(wrapper)");
assertEq(newMorpho.balanceOf(migrater), amount, "newMorpho.balanceOf(migrater)");
}

function _erc20WrapperDepositFor(address asset, uint256 amount) internal pure returns (bytes memory) {
return abi.encodeCall(ERC20WrapperBundler.erc20WrapperDepositFor, (asset, amount));
}

function _erc20TransferFrom(address asset, uint256 amount) internal pure returns (bytes memory) {
return abi.encodeCall(TransferBundler.erc20TransferFrom, (asset, amount));
}
}

interface RolesAuthority {
Expand Down
6 changes: 6 additions & 0 deletions test/helpers/interfaces/IERC20WrapperBundler.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

interface IERC20WrapperBundler {
function erc20WrapperDepositFor(address wrapper, uint256 amount) external;
}
12 changes: 12 additions & 0 deletions test/helpers/interfaces/IMulticall.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title IMulticall
/// @author Morpho Labs
/// @custom:contact security@morpho.org
/// @notice Interface of Multicall.
interface IMulticall {
/// @notice Executes an ordered batch of delegatecalls to this contract.
/// @param data The ordered array of calldata to execute.
function multicall(bytes[] calldata data) external payable;
}
6 changes: 6 additions & 0 deletions test/helpers/interfaces/ITransferBundler.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

interface ITransferBundler {
function erc20TransferFrom(address asset, uint256 amount) external;
}
15 changes: 15 additions & 0 deletions test/helpers/libraries/EncodeLib.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import {IERC20WrapperBundler} from "../interfaces/IERC20WrapperBundler.sol";
import {ITransferBundler} from "../interfaces/ITransferBundler.sol";

library EncodeLib {
function _erc20WrapperDepositFor(address asset, uint256 amount) internal pure returns (bytes memory) {
return abi.encodeCall(IERC20WrapperBundler.erc20WrapperDepositFor, (asset, amount));
}

function _erc20TransferFrom(address asset, uint256 amount) internal pure returns (bytes memory) {
return abi.encodeCall(ITransferBundler.erc20TransferFrom, (asset, amount));
}
}

0 comments on commit 08a9cb8

Please sign in to comment.