From 99cb382260ee246ccaa668bd720f8d7191e80f9b Mon Sep 17 00:00:00 2001 From: MathisGD Date: Mon, 13 May 2024 23:59:51 +0200 Subject: [PATCH 1/3] style: rename base bundler --- README.md | 2 +- src/ERC20WrapperBundler.sol | 4 ++-- src/ERC4626Bundler.sol | 4 ++-- src/MorphoBundler.sol | 6 +++--- src/Permit2Bundler.sol | 4 ++-- src/PermitBundler.sol | 4 ++-- src/{BaseBundler.sol => RootBundler.sol} | 4 ++-- src/StEthBundler.sol | 4 ++-- src/TransferBundler.sol | 4 ++-- src/UrdBundler.sol | 4 ++-- src/WNativeBundler.sol | 4 ++-- src/base/BaseBundlerV2.sol | 4 ++-- src/ethereum/EthereumBundlerV2.sol | 4 ++-- src/goerli/GoerliBundlerV2.sol | 4 ++-- src/migration/AaveV2MigrationBundlerV2.sol | 4 ++-- src/migration/CompoundV2MigrationBundlerV2.sol | 4 ++-- src/migration/MigrationBundler.sol | 4 ++-- src/mocks/bundlers/BaseBundlerMock.sol | 6 ------ src/mocks/bundlers/MorphoBundlerMock.sol | 2 +- src/mocks/bundlers/RootBundlerMock.sol | 6 ++++++ src/sepolia/SepoliaBundlerV2.sol | 4 ++-- test/forge/BaseBundlerEnshrinedLocalTest.sol | 4 ++-- test/forge/BaseBundlerLocalTest.sol | 8 ++++---- test/forge/fork/migration/helpers/MigrationForkTest.sol | 2 +- test/forge/helpers/BaseTest.sol | 4 ++-- 25 files changed, 52 insertions(+), 52 deletions(-) rename src/{BaseBundler.sol => RootBundler.sol} (98%) delete mode 100644 src/mocks/bundlers/BaseBundlerMock.sol create mode 100644 src/mocks/bundlers/RootBundlerMock.sol diff --git a/README.md b/README.md index ed9343ba..a36a4e1c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![image (4)](https://github.com/morpho-org/morpho-blue-bundlers/assets/44097430/5cb0796b-c20c-415e-840d-8b0705836dc8) -Each Bundler is a domain-specific abstract layer of contract that implements some functions that can be bundled in a single call by EOAs to a single contract. They all inherit from [`BaseBundler`](./src/BaseBundler.sol) that enables bundling multiple function calls into a single `multicall(bytes[] calldata data)` call to the end bundler contract. Each chain-specific bundler is available under their chain-specific folder (e.g. [`ethereum`](./src/ethereum/)). +Each Bundler is a domain-specific abstract layer of contract that implements some functions that can be bundled in a single call by EOAs to a single contract. They all inherit from [`RootBundler`](./src/RootBundler.sol) that enables bundling multiple function calls into a single `multicall(bytes[] calldata data)` call to the end bundler contract. Each chain-specific bundler is available under their chain-specific folder (e.g. [`ethereum`](./src/ethereum/)). Some chain-specific domains are also scoped to the chain-specific folder, because they are not expected to be used on any other chain (e.g. DAI and its specific `permit` function is only available on Ethereum - see [`EthereumPermitBundler`](./src/ethereum/EthereumPermitBundler.sol)). diff --git a/src/ERC20WrapperBundler.sol b/src/ERC20WrapperBundler.sol index da839e4d..41e72d2e 100644 --- a/src/ERC20WrapperBundler.sol +++ b/src/ERC20WrapperBundler.sol @@ -5,7 +5,7 @@ import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; import {ERC20Wrapper} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Wrapper.sol"; /// @title ERC20WrapperBundler @@ -14,7 +14,7 @@ import {ERC20Wrapper} from "../lib/openzeppelin-contracts/contracts/token/ERC20/ /// @notice Enables the wrapping and unwrapping of ERC20 tokens. The largest usecase is to wrap permissionless tokens to /// their permissioned counterparts and access permissioned markets on Morpho Blue. Permissioned tokens can be built /// using: https://github.com/morpho-org/erc20-permissioned -abstract contract ERC20WrapperBundler is BaseBundler { +abstract contract ERC20WrapperBundler is RootBundler { using SafeTransferLib for ERC20; /* WRAPPER ACTIONS */ diff --git a/src/ERC4626Bundler.sol b/src/ERC4626Bundler.sol index c61651b7..104f725a 100644 --- a/src/ERC4626Bundler.sol +++ b/src/ERC4626Bundler.sol @@ -7,13 +7,13 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title ERC4626Bundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract managing interactions with ERC4626 compliant tokens. -abstract contract ERC4626Bundler is BaseBundler { +abstract contract ERC4626Bundler is RootBundler { using SafeTransferLib for ERC20; /* ACTIONS */ diff --git a/src/MorphoBundler.sol b/src/MorphoBundler.sol index c223e7ee..74dc3a87 100644 --- a/src/MorphoBundler.sol +++ b/src/MorphoBundler.sol @@ -8,13 +8,13 @@ import {MarketParams, Signature, Authorization, IMorpho} from "../lib/morpho-blu import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title MorphoBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract managing interactions with Morpho. -abstract contract MorphoBundler is BaseBundler, IMorphoBundler { +abstract contract MorphoBundler is RootBundler, IMorphoBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ @@ -264,7 +264,7 @@ abstract contract MorphoBundler is BaseBundler, IMorphoBundler { _multicall(abi.decode(data, (bytes[]))); } - /// @inheritdoc BaseBundler + /// @inheritdoc RootBundler function _isSenderAuthorized() internal view virtual override returns (bool) { return super._isSenderAuthorized() || msg.sender == address(MORPHO); } diff --git a/src/Permit2Bundler.sol b/src/Permit2Bundler.sol index 5dde2030..04696dde 100644 --- a/src/Permit2Bundler.sol +++ b/src/Permit2Bundler.sol @@ -9,13 +9,13 @@ import {Permit2Lib} from "../lib/permit2/src/libraries/Permit2Lib.sol"; import {SafeCast160} from "../lib/permit2/src/libraries/SafeCast160.sol"; import {ERC20} from "../lib/solmate/src/tokens/ERC20.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title Permit2Bundler /// @author Morpho Labs /// @custom:contact security@morpho.xyz /// @notice Bundler contract managing interactions with Uniswap's Permit2. -abstract contract Permit2Bundler is BaseBundler { +abstract contract Permit2Bundler is RootBundler { using SafeCast160 for uint256; /* ACTIONS */ diff --git a/src/PermitBundler.sol b/src/PermitBundler.sol index bc74c7e9..943bd035 100644 --- a/src/PermitBundler.sol +++ b/src/PermitBundler.sol @@ -3,13 +3,13 @@ pragma solidity 0.8.24; import {IERC20Permit} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title PermitBundler /// @author Morpho Labs /// @custom:contact security@morpho.xyz /// @notice Bundler contract managing interactions with tokens implementing EIP-2612. -abstract contract PermitBundler is BaseBundler { +abstract contract PermitBundler is RootBundler { /// @notice Permits the given `amount` of `asset` from sender to be spent by the bundler via EIP-2612 Permit with /// the given `deadline` & EIP-712 signature's `v`, `r` & `s`. /// @param asset The address of the token to be permitted. diff --git a/src/BaseBundler.sol b/src/RootBundler.sol similarity index 98% rename from src/BaseBundler.sol rename to src/RootBundler.sol index e21231ec..07981994 100644 --- a/src/BaseBundler.sol +++ b/src/RootBundler.sol @@ -7,7 +7,7 @@ import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {UNSET_INITIATOR} from "./libraries/ConstantsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -/// @title BaseBundler +/// @title RootBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Enables calling multiple functions in a single call to the same contract (self). @@ -15,7 +15,7 @@ import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.s /// @dev Every bundler inheriting from this contract must have their external functions payable as they will be /// delegate called by the `multicall` function (which is payable, and thus might pass a non-null ETH value). It is /// recommended not to rely on `msg.value` as the same value can be reused for multiple calls. -abstract contract BaseBundler is IMulticall { +abstract contract RootBundler is IMulticall { using SafeTransferLib for ERC20; /* STORAGE */ diff --git a/src/StEthBundler.sol b/src/StEthBundler.sol index ecd04fd4..481da0a1 100644 --- a/src/StEthBundler.sol +++ b/src/StEthBundler.sol @@ -8,13 +8,13 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title StEthBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Contract allowing to bundle multiple interactions with stETH together. -abstract contract StEthBundler is BaseBundler { +abstract contract StEthBundler is RootBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ diff --git a/src/TransferBundler.sol b/src/TransferBundler.sol index 6fac0c2c..36ccad75 100644 --- a/src/TransferBundler.sol +++ b/src/TransferBundler.sol @@ -5,14 +5,14 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title TransferBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Enables transfer of ERC20 and native tokens. /// @dev Assumes that any tokens left on the contract can be seized by anyone. -abstract contract TransferBundler is BaseBundler { +abstract contract TransferBundler is RootBundler { using SafeTransferLib for ERC20; /* TRANSFER ACTIONS */ diff --git a/src/UrdBundler.sol b/src/UrdBundler.sol index 5e9ddaf3..57b18315 100644 --- a/src/UrdBundler.sol +++ b/src/UrdBundler.sol @@ -6,13 +6,13 @@ import {IUniversalRewardsDistributor} from import {ErrorsLib} from "./libraries/ErrorsLib.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title UrdBundler /// @author Morpho Labs /// @custom:contact security@morpho.xyz /// @notice Bundler that allows to claim token rewards on the Universal Rewards Distributor. -abstract contract UrdBundler is BaseBundler { +abstract contract UrdBundler is RootBundler { /// @notice Claims `amount` of `reward` on behalf of `account` on the given rewards distributor, using `proof`. /// @dev Assumes the given distributor implements IUniversalRewardsDistributor. /// @param distributor The address of the reward distributor contract. diff --git a/src/WNativeBundler.sol b/src/WNativeBundler.sol index 840065cd..666ef6c1 100644 --- a/src/WNativeBundler.sol +++ b/src/WNativeBundler.sol @@ -7,14 +7,14 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {BaseBundler} from "./BaseBundler.sol"; +import {RootBundler} from "./RootBundler.sol"; /// @title WNativeBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract managing interactions with network's wrapped native token. /// @notice "wrapped native" refers to forks of WETH. -abstract contract WNativeBundler is BaseBundler { +abstract contract WNativeBundler is RootBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ diff --git a/src/base/BaseBundlerV2.sol b/src/base/BaseBundlerV2.sol index 31596373..a2046410 100644 --- a/src/base/BaseBundlerV2.sol +++ b/src/base/BaseBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {BaseLib} from "./libraries/BaseLib.sol"; -import {BaseBundler} from "../BaseBundler.sol"; +import {RootBundler} from "../RootBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; import {ERC4626Bundler} from "../ERC4626Bundler.sol"; @@ -32,7 +32,7 @@ contract BaseBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(BaseBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/ethereum/EthereumBundlerV2.sol b/src/ethereum/EthereumBundlerV2.sol index 94d9c262..aed600d4 100644 --- a/src/ethereum/EthereumBundlerV2.sol +++ b/src/ethereum/EthereumBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {MainnetLib} from "./libraries/MainnetLib.sol"; -import {BaseBundler} from "../BaseBundler.sol"; +import {RootBundler} from "../RootBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {EthereumPermitBundler} from "./EthereumPermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -36,7 +36,7 @@ contract EthereumBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(BaseBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/goerli/GoerliBundlerV2.sol b/src/goerli/GoerliBundlerV2.sol index 973d0a0e..ea49b3a3 100644 --- a/src/goerli/GoerliBundlerV2.sol +++ b/src/goerli/GoerliBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {GoerliLib} from "./libraries/GoerliLib.sol"; -import {BaseBundler} from "../BaseBundler.sol"; +import {RootBundler} from "../RootBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {PermitBundler} from "../PermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -36,7 +36,7 @@ contract GoerliBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(BaseBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/migration/AaveV2MigrationBundlerV2.sol b/src/migration/AaveV2MigrationBundlerV2.sol index 0ed2869e..90010ef8 100644 --- a/src/migration/AaveV2MigrationBundlerV2.sol +++ b/src/migration/AaveV2MigrationBundlerV2.sol @@ -6,7 +6,7 @@ import {IAaveV2} from "./interfaces/IAaveV2.sol"; import {Math} from "../../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "../libraries/ErrorsLib.sol"; -import {BaseBundler} from "../BaseBundler.sol"; +import {RootBundler} from "../RootBundler.sol"; import {StEthBundler} from "../StEthBundler.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; @@ -62,7 +62,7 @@ contract AaveV2MigrationBundlerV2 is MigrationBundler, StEthBundler { /* INTERNAL */ /// @inheritdoc MigrationBundler - function _isSenderAuthorized() internal view virtual override(BaseBundler, MigrationBundler) returns (bool) { + function _isSenderAuthorized() internal view virtual override(RootBundler, MigrationBundler) returns (bool) { return MigrationBundler._isSenderAuthorized(); } } diff --git a/src/migration/CompoundV2MigrationBundlerV2.sol b/src/migration/CompoundV2MigrationBundlerV2.sol index b6d63923..3081a116 100644 --- a/src/migration/CompoundV2MigrationBundlerV2.sol +++ b/src/migration/CompoundV2MigrationBundlerV2.sol @@ -7,7 +7,7 @@ import {ICToken} from "./interfaces/ICToken.sol"; import {Math} from "../../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "../libraries/ErrorsLib.sol"; -import {BaseBundler} from "../BaseBundler.sol"; +import {RootBundler} from "../RootBundler.sol"; import {WNativeBundler} from "../WNativeBundler.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; @@ -80,7 +80,7 @@ contract CompoundV2MigrationBundlerV2 is WNativeBundler, MigrationBundler { /* INTERNAL */ /// @inheritdoc MigrationBundler - function _isSenderAuthorized() internal view override(BaseBundler, MigrationBundler) returns (bool) { + function _isSenderAuthorized() internal view override(RootBundler, MigrationBundler) returns (bool) { return MigrationBundler._isSenderAuthorized(); } } diff --git a/src/migration/MigrationBundler.sol b/src/migration/MigrationBundler.sol index 4955ef35..fae72d60 100644 --- a/src/migration/MigrationBundler.sol +++ b/src/migration/MigrationBundler.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {SafeTransferLib, ERC20} from "../../lib/solmate/src/utils/SafeTransferLib.sol"; -import {BaseBundler} from "../BaseBundler.sol"; +import {RootBundler} from "../RootBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {PermitBundler} from "../PermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -24,7 +24,7 @@ abstract contract MigrationBundler is TransferBundler, PermitBundler, Permit2Bun /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view virtual override(BaseBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view virtual override(RootBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/mocks/bundlers/BaseBundlerMock.sol b/src/mocks/bundlers/BaseBundlerMock.sol deleted file mode 100644 index 4106d1f2..00000000 --- a/src/mocks/bundlers/BaseBundlerMock.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity ^0.8.0; - -import "../../BaseBundler.sol"; - -contract BaseBundlerMock is BaseBundler {} diff --git a/src/mocks/bundlers/MorphoBundlerMock.sol b/src/mocks/bundlers/MorphoBundlerMock.sol index 44db0852..93ed3c8f 100644 --- a/src/mocks/bundlers/MorphoBundlerMock.sol +++ b/src/mocks/bundlers/MorphoBundlerMock.sol @@ -7,7 +7,7 @@ import {MorphoBundler} from "../../MorphoBundler.sol"; contract MorphoBundlerMock is TransferBundler, MorphoBundler { constructor(address morpho) MorphoBundler(morpho) {} - function _isSenderAuthorized() internal view override(BaseBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/mocks/bundlers/RootBundlerMock.sol b/src/mocks/bundlers/RootBundlerMock.sol new file mode 100644 index 00000000..f31001fc --- /dev/null +++ b/src/mocks/bundlers/RootBundlerMock.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity ^0.8.0; + +import "../../RootBundler.sol"; + +contract RootBundlerMock is RootBundler {} diff --git a/src/sepolia/SepoliaBundlerV2.sol b/src/sepolia/SepoliaBundlerV2.sol index 4a33d9f2..e649acb8 100644 --- a/src/sepolia/SepoliaBundlerV2.sol +++ b/src/sepolia/SepoliaBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {SepoliaLib} from "./libraries/SepoliaLib.sol"; -import {BaseBundler} from "../BaseBundler.sol"; +import {RootBundler} from "../RootBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {PermitBundler} from "../PermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -40,7 +40,7 @@ contract SepoliaBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(BaseBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/test/forge/BaseBundlerEnshrinedLocalTest.sol b/test/forge/BaseBundlerEnshrinedLocalTest.sol index 1eb048ee..b7d5a15f 100644 --- a/test/forge/BaseBundlerEnshrinedLocalTest.sol +++ b/test/forge/BaseBundlerEnshrinedLocalTest.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; -import {BaseBundler} from "src/mocks/bundlers/BaseBundlerMock.sol"; +import {RootBundler} from "src/mocks/bundlers/RootBundlerMock.sol"; import "./helpers/LocalTest.sol"; -contract BaseBundlerEnshrinedLocalTest is BaseBundler, LocalTest { +contract RootBundlerEnshrinedLocalTest is RootBundler, LocalTest { function checkInitiator(address expectedInitiator) public payable protected { require(initiator() == expectedInitiator, "unexpected initiator"); } diff --git a/test/forge/BaseBundlerLocalTest.sol b/test/forge/BaseBundlerLocalTest.sol index 61c20b93..a7d5ab72 100644 --- a/test/forge/BaseBundlerLocalTest.sol +++ b/test/forge/BaseBundlerLocalTest.sol @@ -3,15 +3,15 @@ pragma solidity ^0.8.0; import {ErrorsLib} from "src/libraries/ErrorsLib.sol"; -import "src/mocks/bundlers/BaseBundlerMock.sol"; +import "src/mocks/bundlers/RootBundlerMock.sol"; import "./helpers/LocalTest.sol"; -contract BaseBundlerLocalTest is LocalTest { +contract RootBundlerLocalTest is LocalTest { function setUp() public override { super.setUp(); - bundler = new BaseBundlerMock(); + bundler = new RootBundlerMock(); } function testMulticallEmpty() public { @@ -19,7 +19,7 @@ contract BaseBundlerLocalTest is LocalTest { } function testNestedMulticall() public { - bundle.push(abi.encodeCall(BaseBundler.multicall, (callbackBundle))); + bundle.push(abi.encodeCall(RootBundler.multicall, (callbackBundle))); vm.expectRevert(bytes(ErrorsLib.ALREADY_INITIATED)); bundler.multicall(bundle); diff --git a/test/forge/fork/migration/helpers/MigrationForkTest.sol b/test/forge/fork/migration/helpers/MigrationForkTest.sol index 6ccc0402..2d2b75db 100644 --- a/test/forge/fork/migration/helpers/MigrationForkTest.sol +++ b/test/forge/fork/migration/helpers/MigrationForkTest.sol @@ -9,7 +9,7 @@ import {Market} from "../../../../../lib/morpho-blue/src/interfaces/IMorpho.sol" import {MorphoBalancesLib} from "../../../../../lib/morpho-blue/src/libraries/periphery/MorphoBalancesLib.sol"; import "../../helpers/ForkTest.sol"; -import {BaseBundler} from "../../../../../src/BaseBundler.sol"; +import {RootBundler} from "../../../../../src/RootBundler.sol"; import {PermitBundler} from "../../../../../src/PermitBundler.sol"; import {Permit2Bundler} from "../../../../../src/Permit2Bundler.sol"; import {ERC4626Bundler} from "../../../../../src/ERC4626Bundler.sol"; diff --git a/test/forge/helpers/BaseTest.sol b/test/forge/helpers/BaseTest.sol index 884336f9..8806e216 100644 --- a/test/forge/helpers/BaseTest.sol +++ b/test/forge/helpers/BaseTest.sol @@ -27,7 +27,7 @@ import { import {IrmMock} from "../../../lib/morpho-blue/src/mocks/IrmMock.sol"; import {OracleMock} from "../../../lib/morpho-blue/src/mocks/OracleMock.sol"; -import {BaseBundler} from "../../../src/BaseBundler.sol"; +import {RootBundler} from "../../../src/RootBundler.sol"; import {TransferBundler} from "../../../src/TransferBundler.sol"; import {ERC4626Bundler} from "../../../src/ERC4626Bundler.sol"; import {UrdBundler} from "../../../src/UrdBundler.sol"; @@ -58,7 +58,7 @@ abstract contract BaseTest is Test { IrmMock internal irm; OracleMock internal oracle; - BaseBundler internal bundler; + RootBundler internal bundler; bytes[] internal bundle; bytes[] internal callbackBundle; From 7cc029aebfee4a04b7391481419960dfdf0faee6 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 14 May 2024 00:07:59 +0200 Subject: [PATCH 2/3] test: rename baseTest --- test/forge/fork/helpers/ForkTest.sol | 4 ++-- test/forge/helpers/{BaseTest.sol => CommonTest.sol} | 2 +- test/forge/helpers/LocalTest.sol | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename test/forge/helpers/{BaseTest.sol => CommonTest.sol} (99%) diff --git a/test/forge/fork/helpers/ForkTest.sol b/test/forge/fork/helpers/ForkTest.sol index 4ed66c39..64f3569a 100644 --- a/test/forge/fork/helpers/ForkTest.sol +++ b/test/forge/fork/helpers/ForkTest.sol @@ -12,9 +12,9 @@ import {WNativeBundler} from "../../../../src/WNativeBundler.sol"; import {StEthBundler} from "../../../../src/StEthBundler.sol"; import "../../../../config/Configured.sol"; -import "../../helpers/BaseTest.sol"; +import "../../helpers/CommonTest.sol"; -abstract contract ForkTest is BaseTest, Configured { +abstract contract ForkTest is CommonTest, Configured { using ConfigLib for Config; using SafeTransferLib for ERC20; diff --git a/test/forge/helpers/BaseTest.sol b/test/forge/helpers/CommonTest.sol similarity index 99% rename from test/forge/helpers/BaseTest.sol rename to test/forge/helpers/CommonTest.sol index 8806e216..be9c764e 100644 --- a/test/forge/helpers/BaseTest.sol +++ b/test/forge/helpers/CommonTest.sol @@ -41,7 +41,7 @@ uint256 constant MIN_AMOUNT = 1000; uint256 constant MAX_AMOUNT = 2 ** 64; // Must be less than or equal to type(uint160).max. uint256 constant SIGNATURE_DEADLINE = type(uint32).max; -abstract contract BaseTest is Test { +abstract contract CommonTest is Test { using MathLib for uint256; using SharesMathLib for uint256; using MarketParamsLib for MarketParams; diff --git a/test/forge/helpers/LocalTest.sol b/test/forge/helpers/LocalTest.sol index 10bdf4ff..d229d478 100644 --- a/test/forge/helpers/LocalTest.sol +++ b/test/forge/helpers/LocalTest.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.0; import {ERC20Mock} from "../../../src/mocks/ERC20Mock.sol"; -import "./BaseTest.sol"; +import "./CommonTest.sol"; -abstract contract LocalTest is BaseTest { +abstract contract LocalTest is CommonTest { using MathLib for uint256; using SharesMathLib for uint256; using MarketParamsLib for MarketParams; From 21dace21b329dd36c4965aba6d8ff70a8fb94ff4 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 14 May 2024 14:40:25 +0200 Subject: [PATCH 3/3] style: rename root => core --- README.md | 2 +- src/{RootBundler.sol => CoreBundler.sol} | 4 ++-- src/ERC20WrapperBundler.sol | 4 ++-- src/ERC4626Bundler.sol | 4 ++-- src/MorphoBundler.sol | 6 +++--- src/Permit2Bundler.sol | 4 ++-- src/PermitBundler.sol | 4 ++-- src/StEthBundler.sol | 4 ++-- src/TransferBundler.sol | 4 ++-- src/UrdBundler.sol | 4 ++-- src/WNativeBundler.sol | 4 ++-- src/base/BaseBundlerV2.sol | 4 ++-- src/ethereum/EthereumBundlerV2.sol | 4 ++-- src/goerli/GoerliBundlerV2.sol | 4 ++-- src/migration/AaveV2MigrationBundlerV2.sol | 4 ++-- src/migration/CompoundV2MigrationBundlerV2.sol | 4 ++-- src/migration/MigrationBundler.sol | 4 ++-- src/mocks/bundlers/CoreBundlerMock.sol | 6 ++++++ src/mocks/bundlers/MorphoBundlerMock.sol | 2 +- src/mocks/bundlers/RootBundlerMock.sol | 6 ------ src/sepolia/SepoliaBundlerV2.sol | 4 ++-- test/forge/BaseBundlerEnshrinedLocalTest.sol | 4 ++-- test/forge/BaseBundlerLocalTest.sol | 8 ++++---- test/forge/fork/migration/helpers/MigrationForkTest.sol | 2 +- test/forge/helpers/CommonTest.sol | 4 ++-- 25 files changed, 52 insertions(+), 52 deletions(-) rename src/{RootBundler.sol => CoreBundler.sol} (98%) create mode 100644 src/mocks/bundlers/CoreBundlerMock.sol delete mode 100644 src/mocks/bundlers/RootBundlerMock.sol diff --git a/README.md b/README.md index a36a4e1c..d82c0192 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![image (4)](https://github.com/morpho-org/morpho-blue-bundlers/assets/44097430/5cb0796b-c20c-415e-840d-8b0705836dc8) -Each Bundler is a domain-specific abstract layer of contract that implements some functions that can be bundled in a single call by EOAs to a single contract. They all inherit from [`RootBundler`](./src/RootBundler.sol) that enables bundling multiple function calls into a single `multicall(bytes[] calldata data)` call to the end bundler contract. Each chain-specific bundler is available under their chain-specific folder (e.g. [`ethereum`](./src/ethereum/)). +Each Bundler is a domain-specific abstract layer of contract that implements some functions that can be bundled in a single call by EOAs to a single contract. They all inherit from [`CoreBundler`](./src/CoreBundler.sol) that enables bundling multiple function calls into a single `multicall(bytes[] calldata data)` call to the end bundler contract. Each chain-specific bundler is available under their chain-specific folder (e.g. [`ethereum`](./src/ethereum/)). Some chain-specific domains are also scoped to the chain-specific folder, because they are not expected to be used on any other chain (e.g. DAI and its specific `permit` function is only available on Ethereum - see [`EthereumPermitBundler`](./src/ethereum/EthereumPermitBundler.sol)). diff --git a/src/RootBundler.sol b/src/CoreBundler.sol similarity index 98% rename from src/RootBundler.sol rename to src/CoreBundler.sol index 07981994..a5493b3e 100644 --- a/src/RootBundler.sol +++ b/src/CoreBundler.sol @@ -7,7 +7,7 @@ import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {UNSET_INITIATOR} from "./libraries/ConstantsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -/// @title RootBundler +/// @title CoreBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Enables calling multiple functions in a single call to the same contract (self). @@ -15,7 +15,7 @@ import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.s /// @dev Every bundler inheriting from this contract must have their external functions payable as they will be /// delegate called by the `multicall` function (which is payable, and thus might pass a non-null ETH value). It is /// recommended not to rely on `msg.value` as the same value can be reused for multiple calls. -abstract contract RootBundler is IMulticall { +abstract contract CoreBundler is IMulticall { using SafeTransferLib for ERC20; /* STORAGE */ diff --git a/src/ERC20WrapperBundler.sol b/src/ERC20WrapperBundler.sol index 41e72d2e..d173e19b 100644 --- a/src/ERC20WrapperBundler.sol +++ b/src/ERC20WrapperBundler.sol @@ -5,7 +5,7 @@ import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; import {ERC20Wrapper} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Wrapper.sol"; /// @title ERC20WrapperBundler @@ -14,7 +14,7 @@ import {ERC20Wrapper} from "../lib/openzeppelin-contracts/contracts/token/ERC20/ /// @notice Enables the wrapping and unwrapping of ERC20 tokens. The largest usecase is to wrap permissionless tokens to /// their permissioned counterparts and access permissioned markets on Morpho Blue. Permissioned tokens can be built /// using: https://github.com/morpho-org/erc20-permissioned -abstract contract ERC20WrapperBundler is RootBundler { +abstract contract ERC20WrapperBundler is CoreBundler { using SafeTransferLib for ERC20; /* WRAPPER ACTIONS */ diff --git a/src/ERC4626Bundler.sol b/src/ERC4626Bundler.sol index 104f725a..51d57fe5 100644 --- a/src/ERC4626Bundler.sol +++ b/src/ERC4626Bundler.sol @@ -7,13 +7,13 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title ERC4626Bundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract managing interactions with ERC4626 compliant tokens. -abstract contract ERC4626Bundler is RootBundler { +abstract contract ERC4626Bundler is CoreBundler { using SafeTransferLib for ERC20; /* ACTIONS */ diff --git a/src/MorphoBundler.sol b/src/MorphoBundler.sol index 74dc3a87..5dff3e9d 100644 --- a/src/MorphoBundler.sol +++ b/src/MorphoBundler.sol @@ -8,13 +8,13 @@ import {MarketParams, Signature, Authorization, IMorpho} from "../lib/morpho-blu import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title MorphoBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract managing interactions with Morpho. -abstract contract MorphoBundler is RootBundler, IMorphoBundler { +abstract contract MorphoBundler is CoreBundler, IMorphoBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ @@ -264,7 +264,7 @@ abstract contract MorphoBundler is RootBundler, IMorphoBundler { _multicall(abi.decode(data, (bytes[]))); } - /// @inheritdoc RootBundler + /// @inheritdoc CoreBundler function _isSenderAuthorized() internal view virtual override returns (bool) { return super._isSenderAuthorized() || msg.sender == address(MORPHO); } diff --git a/src/Permit2Bundler.sol b/src/Permit2Bundler.sol index 04696dde..a33ef04e 100644 --- a/src/Permit2Bundler.sol +++ b/src/Permit2Bundler.sol @@ -9,13 +9,13 @@ import {Permit2Lib} from "../lib/permit2/src/libraries/Permit2Lib.sol"; import {SafeCast160} from "../lib/permit2/src/libraries/SafeCast160.sol"; import {ERC20} from "../lib/solmate/src/tokens/ERC20.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title Permit2Bundler /// @author Morpho Labs /// @custom:contact security@morpho.xyz /// @notice Bundler contract managing interactions with Uniswap's Permit2. -abstract contract Permit2Bundler is RootBundler { +abstract contract Permit2Bundler is CoreBundler { using SafeCast160 for uint256; /* ACTIONS */ diff --git a/src/PermitBundler.sol b/src/PermitBundler.sol index 943bd035..b667e29c 100644 --- a/src/PermitBundler.sol +++ b/src/PermitBundler.sol @@ -3,13 +3,13 @@ pragma solidity 0.8.24; import {IERC20Permit} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title PermitBundler /// @author Morpho Labs /// @custom:contact security@morpho.xyz /// @notice Bundler contract managing interactions with tokens implementing EIP-2612. -abstract contract PermitBundler is RootBundler { +abstract contract PermitBundler is CoreBundler { /// @notice Permits the given `amount` of `asset` from sender to be spent by the bundler via EIP-2612 Permit with /// the given `deadline` & EIP-712 signature's `v`, `r` & `s`. /// @param asset The address of the token to be permitted. diff --git a/src/StEthBundler.sol b/src/StEthBundler.sol index 481da0a1..16a8f69b 100644 --- a/src/StEthBundler.sol +++ b/src/StEthBundler.sol @@ -8,13 +8,13 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title StEthBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Contract allowing to bundle multiple interactions with stETH together. -abstract contract StEthBundler is RootBundler { +abstract contract StEthBundler is CoreBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ diff --git a/src/TransferBundler.sol b/src/TransferBundler.sol index 36ccad75..30c559df 100644 --- a/src/TransferBundler.sol +++ b/src/TransferBundler.sol @@ -5,14 +5,14 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title TransferBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Enables transfer of ERC20 and native tokens. /// @dev Assumes that any tokens left on the contract can be seized by anyone. -abstract contract TransferBundler is RootBundler { +abstract contract TransferBundler is CoreBundler { using SafeTransferLib for ERC20; /* TRANSFER ACTIONS */ diff --git a/src/UrdBundler.sol b/src/UrdBundler.sol index 57b18315..994411ea 100644 --- a/src/UrdBundler.sol +++ b/src/UrdBundler.sol @@ -6,13 +6,13 @@ import {IUniversalRewardsDistributor} from import {ErrorsLib} from "./libraries/ErrorsLib.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title UrdBundler /// @author Morpho Labs /// @custom:contact security@morpho.xyz /// @notice Bundler that allows to claim token rewards on the Universal Rewards Distributor. -abstract contract UrdBundler is RootBundler { +abstract contract UrdBundler is CoreBundler { /// @notice Claims `amount` of `reward` on behalf of `account` on the given rewards distributor, using `proof`. /// @dev Assumes the given distributor implements IUniversalRewardsDistributor. /// @param distributor The address of the reward distributor contract. diff --git a/src/WNativeBundler.sol b/src/WNativeBundler.sol index 666ef6c1..d4dab8bb 100644 --- a/src/WNativeBundler.sol +++ b/src/WNativeBundler.sol @@ -7,14 +7,14 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "./libraries/ErrorsLib.sol"; import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; -import {RootBundler} from "./RootBundler.sol"; +import {CoreBundler} from "./CoreBundler.sol"; /// @title WNativeBundler /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract managing interactions with network's wrapped native token. /// @notice "wrapped native" refers to forks of WETH. -abstract contract WNativeBundler is RootBundler { +abstract contract WNativeBundler is CoreBundler { using SafeTransferLib for ERC20; /* IMMUTABLES */ diff --git a/src/base/BaseBundlerV2.sol b/src/base/BaseBundlerV2.sol index a2046410..68afc943 100644 --- a/src/base/BaseBundlerV2.sol +++ b/src/base/BaseBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {BaseLib} from "./libraries/BaseLib.sol"; -import {RootBundler} from "../RootBundler.sol"; +import {CoreBundler} from "../CoreBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; import {ERC4626Bundler} from "../ERC4626Bundler.sol"; @@ -32,7 +32,7 @@ contract BaseBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(CoreBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/ethereum/EthereumBundlerV2.sol b/src/ethereum/EthereumBundlerV2.sol index aed600d4..9b71fd33 100644 --- a/src/ethereum/EthereumBundlerV2.sol +++ b/src/ethereum/EthereumBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {MainnetLib} from "./libraries/MainnetLib.sol"; -import {RootBundler} from "../RootBundler.sol"; +import {CoreBundler} from "../CoreBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {EthereumPermitBundler} from "./EthereumPermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -36,7 +36,7 @@ contract EthereumBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(CoreBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/goerli/GoerliBundlerV2.sol b/src/goerli/GoerliBundlerV2.sol index ea49b3a3..d1bb5527 100644 --- a/src/goerli/GoerliBundlerV2.sol +++ b/src/goerli/GoerliBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {GoerliLib} from "./libraries/GoerliLib.sol"; -import {RootBundler} from "../RootBundler.sol"; +import {CoreBundler} from "../CoreBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {PermitBundler} from "../PermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -36,7 +36,7 @@ contract GoerliBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(CoreBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/migration/AaveV2MigrationBundlerV2.sol b/src/migration/AaveV2MigrationBundlerV2.sol index 90010ef8..e01b02f6 100644 --- a/src/migration/AaveV2MigrationBundlerV2.sol +++ b/src/migration/AaveV2MigrationBundlerV2.sol @@ -6,7 +6,7 @@ import {IAaveV2} from "./interfaces/IAaveV2.sol"; import {Math} from "../../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "../libraries/ErrorsLib.sol"; -import {RootBundler} from "../RootBundler.sol"; +import {CoreBundler} from "../CoreBundler.sol"; import {StEthBundler} from "../StEthBundler.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; @@ -62,7 +62,7 @@ contract AaveV2MigrationBundlerV2 is MigrationBundler, StEthBundler { /* INTERNAL */ /// @inheritdoc MigrationBundler - function _isSenderAuthorized() internal view virtual override(RootBundler, MigrationBundler) returns (bool) { + function _isSenderAuthorized() internal view virtual override(CoreBundler, MigrationBundler) returns (bool) { return MigrationBundler._isSenderAuthorized(); } } diff --git a/src/migration/CompoundV2MigrationBundlerV2.sol b/src/migration/CompoundV2MigrationBundlerV2.sol index 3081a116..15acaeaa 100644 --- a/src/migration/CompoundV2MigrationBundlerV2.sol +++ b/src/migration/CompoundV2MigrationBundlerV2.sol @@ -7,7 +7,7 @@ import {ICToken} from "./interfaces/ICToken.sol"; import {Math} from "../../lib/morpho-utils/src/math/Math.sol"; import {ErrorsLib} from "../libraries/ErrorsLib.sol"; -import {RootBundler} from "../RootBundler.sol"; +import {CoreBundler} from "../CoreBundler.sol"; import {WNativeBundler} from "../WNativeBundler.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; @@ -80,7 +80,7 @@ contract CompoundV2MigrationBundlerV2 is WNativeBundler, MigrationBundler { /* INTERNAL */ /// @inheritdoc MigrationBundler - function _isSenderAuthorized() internal view override(RootBundler, MigrationBundler) returns (bool) { + function _isSenderAuthorized() internal view override(CoreBundler, MigrationBundler) returns (bool) { return MigrationBundler._isSenderAuthorized(); } } diff --git a/src/migration/MigrationBundler.sol b/src/migration/MigrationBundler.sol index fae72d60..545054dc 100644 --- a/src/migration/MigrationBundler.sol +++ b/src/migration/MigrationBundler.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {SafeTransferLib, ERC20} from "../../lib/solmate/src/utils/SafeTransferLib.sol"; -import {RootBundler} from "../RootBundler.sol"; +import {CoreBundler} from "../CoreBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {PermitBundler} from "../PermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -24,7 +24,7 @@ abstract contract MigrationBundler is TransferBundler, PermitBundler, Permit2Bun /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view virtual override(RootBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view virtual override(CoreBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/mocks/bundlers/CoreBundlerMock.sol b/src/mocks/bundlers/CoreBundlerMock.sol new file mode 100644 index 00000000..580c9cf7 --- /dev/null +++ b/src/mocks/bundlers/CoreBundlerMock.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity ^0.8.0; + +import "../../CoreBundler.sol"; + +contract CoreBundlerMock is CoreBundler {} diff --git a/src/mocks/bundlers/MorphoBundlerMock.sol b/src/mocks/bundlers/MorphoBundlerMock.sol index 93ed3c8f..3e2d946b 100644 --- a/src/mocks/bundlers/MorphoBundlerMock.sol +++ b/src/mocks/bundlers/MorphoBundlerMock.sol @@ -7,7 +7,7 @@ import {MorphoBundler} from "../../MorphoBundler.sol"; contract MorphoBundlerMock is TransferBundler, MorphoBundler { constructor(address morpho) MorphoBundler(morpho) {} - function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(CoreBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/src/mocks/bundlers/RootBundlerMock.sol b/src/mocks/bundlers/RootBundlerMock.sol deleted file mode 100644 index f31001fc..00000000 --- a/src/mocks/bundlers/RootBundlerMock.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity ^0.8.0; - -import "../../RootBundler.sol"; - -contract RootBundlerMock is RootBundler {} diff --git a/src/sepolia/SepoliaBundlerV2.sol b/src/sepolia/SepoliaBundlerV2.sol index e649acb8..df1237c2 100644 --- a/src/sepolia/SepoliaBundlerV2.sol +++ b/src/sepolia/SepoliaBundlerV2.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {SepoliaLib} from "./libraries/SepoliaLib.sol"; -import {RootBundler} from "../RootBundler.sol"; +import {CoreBundler} from "../CoreBundler.sol"; import {TransferBundler} from "../TransferBundler.sol"; import {PermitBundler} from "../PermitBundler.sol"; import {Permit2Bundler} from "../Permit2Bundler.sol"; @@ -40,7 +40,7 @@ contract SepoliaBundlerV2 is /* INTERNAL */ /// @inheritdoc MorphoBundler - function _isSenderAuthorized() internal view override(RootBundler, MorphoBundler) returns (bool) { + function _isSenderAuthorized() internal view override(CoreBundler, MorphoBundler) returns (bool) { return MorphoBundler._isSenderAuthorized(); } } diff --git a/test/forge/BaseBundlerEnshrinedLocalTest.sol b/test/forge/BaseBundlerEnshrinedLocalTest.sol index b7d5a15f..40faffdd 100644 --- a/test/forge/BaseBundlerEnshrinedLocalTest.sol +++ b/test/forge/BaseBundlerEnshrinedLocalTest.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; -import {RootBundler} from "src/mocks/bundlers/RootBundlerMock.sol"; +import {CoreBundler} from "src/mocks/bundlers/CoreBundlerMock.sol"; import "./helpers/LocalTest.sol"; -contract RootBundlerEnshrinedLocalTest is RootBundler, LocalTest { +contract CoreBundlerEnshrinedLocalTest is CoreBundler, LocalTest { function checkInitiator(address expectedInitiator) public payable protected { require(initiator() == expectedInitiator, "unexpected initiator"); } diff --git a/test/forge/BaseBundlerLocalTest.sol b/test/forge/BaseBundlerLocalTest.sol index a7d5ab72..f8d8a175 100644 --- a/test/forge/BaseBundlerLocalTest.sol +++ b/test/forge/BaseBundlerLocalTest.sol @@ -3,15 +3,15 @@ pragma solidity ^0.8.0; import {ErrorsLib} from "src/libraries/ErrorsLib.sol"; -import "src/mocks/bundlers/RootBundlerMock.sol"; +import "src/mocks/bundlers/CoreBundlerMock.sol"; import "./helpers/LocalTest.sol"; -contract RootBundlerLocalTest is LocalTest { +contract CoreBundlerLocalTest is LocalTest { function setUp() public override { super.setUp(); - bundler = new RootBundlerMock(); + bundler = new CoreBundlerMock(); } function testMulticallEmpty() public { @@ -19,7 +19,7 @@ contract RootBundlerLocalTest is LocalTest { } function testNestedMulticall() public { - bundle.push(abi.encodeCall(RootBundler.multicall, (callbackBundle))); + bundle.push(abi.encodeCall(CoreBundler.multicall, (callbackBundle))); vm.expectRevert(bytes(ErrorsLib.ALREADY_INITIATED)); bundler.multicall(bundle); diff --git a/test/forge/fork/migration/helpers/MigrationForkTest.sol b/test/forge/fork/migration/helpers/MigrationForkTest.sol index 2d2b75db..ae241ec7 100644 --- a/test/forge/fork/migration/helpers/MigrationForkTest.sol +++ b/test/forge/fork/migration/helpers/MigrationForkTest.sol @@ -9,7 +9,7 @@ import {Market} from "../../../../../lib/morpho-blue/src/interfaces/IMorpho.sol" import {MorphoBalancesLib} from "../../../../../lib/morpho-blue/src/libraries/periphery/MorphoBalancesLib.sol"; import "../../helpers/ForkTest.sol"; -import {RootBundler} from "../../../../../src/RootBundler.sol"; +import {CoreBundler} from "../../../../../src/CoreBundler.sol"; import {PermitBundler} from "../../../../../src/PermitBundler.sol"; import {Permit2Bundler} from "../../../../../src/Permit2Bundler.sol"; import {ERC4626Bundler} from "../../../../../src/ERC4626Bundler.sol"; diff --git a/test/forge/helpers/CommonTest.sol b/test/forge/helpers/CommonTest.sol index be9c764e..54d91da3 100644 --- a/test/forge/helpers/CommonTest.sol +++ b/test/forge/helpers/CommonTest.sol @@ -27,7 +27,7 @@ import { import {IrmMock} from "../../../lib/morpho-blue/src/mocks/IrmMock.sol"; import {OracleMock} from "../../../lib/morpho-blue/src/mocks/OracleMock.sol"; -import {RootBundler} from "../../../src/RootBundler.sol"; +import {CoreBundler} from "../../../src/CoreBundler.sol"; import {TransferBundler} from "../../../src/TransferBundler.sol"; import {ERC4626Bundler} from "../../../src/ERC4626Bundler.sol"; import {UrdBundler} from "../../../src/UrdBundler.sol"; @@ -58,7 +58,7 @@ abstract contract CommonTest is Test { IrmMock internal irm; OracleMock internal oracle; - RootBundler internal bundler; + CoreBundler internal bundler; bytes[] internal bundle; bytes[] internal callbackBundle;