From bc2c6bc62b635839ec04f2d9c1ca726f868b4142 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 5 Mar 2024 10:19:32 +0100 Subject: [PATCH 1/4] style: rename contracts, option 1 --- ...ereumBundler.sol => EthereumBundlerV2.sol} | 4 +-- ...{GoerliBundler.sol => GoerliBundlerV2.sol} | 4 +-- ...ndler.sol => AaveV2MigrationBundlerV2.sol} | 4 +-- ...ndler.sol => AaveV3MigrationBundlerV2.sol} | 4 +-- ... => AaveV3OptimizerMigrationBundlerV2.sol} | 4 +-- ...r.sol => CompoundV2MigrationBundlerV2.sol} | 4 +-- ...r.sol => CompoundV3MigrationBundlerV2.sol} | 4 +-- src/sepolia/SepoliaBundler.sol | 4 +-- .../ethereum/EthereumBundlerEthereumTest.sol | 4 +-- .../AaveV2MigrationBundlerEthereumTest.sol | 12 +++---- .../AaveV3MigrationBundlerEthereumTest.sol | 10 +++--- ...3OptimizerMigrationBundlerEthereumTest.sol | 32 ++++++++----------- ...BorrowableMigrationBundlerEthereumTest.sol | 10 +++--- ...CollateralMigrationBundlerEthereumTest.sol | 8 ++--- ...undV2NoEthMigrationBundlerEthereumTest.sol | 8 ++--- ...CompoundV3MigrationBundlerEthereumTest.sol | 18 +++++------ 16 files changed, 65 insertions(+), 69 deletions(-) rename src/ethereum/{EthereumBundler.sol => EthereumBundlerV2.sol} (95%) rename src/goerli/{GoerliBundler.sol => GoerliBundlerV2.sol} (96%) rename src/migration/{AaveV2MigrationBundler.sol => AaveV2MigrationBundlerV2.sol} (96%) rename src/migration/{AaveV3MigrationBundler.sol => AaveV3MigrationBundlerV2.sol} (96%) rename src/migration/{AaveV3OptimizerMigrationBundler.sol => AaveV3OptimizerMigrationBundlerV2.sol} (97%) rename src/migration/{CompoundV2MigrationBundler.sol => CompoundV2MigrationBundlerV2.sol} (96%) rename src/migration/{CompoundV3MigrationBundler.sol => CompoundV3MigrationBundlerV2.sol} (97%) diff --git a/src/ethereum/EthereumBundler.sol b/src/ethereum/EthereumBundlerV2.sol similarity index 95% rename from src/ethereum/EthereumBundler.sol rename to src/ethereum/EthereumBundlerV2.sol index 084c89a5..94d9c262 100644 --- a/src/ethereum/EthereumBundler.sol +++ b/src/ethereum/EthereumBundlerV2.sol @@ -14,11 +14,11 @@ import {UrdBundler} from "../UrdBundler.sol"; import {MorphoBundler} from "../MorphoBundler.sol"; import {ERC20WrapperBundler} from "../ERC20WrapperBundler.sol"; -/// @title EthereumBundler +/// @title EthereumBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract specific to Ethereum. -contract EthereumBundler is +contract EthereumBundlerV2 is TransferBundler, EthereumPermitBundler, Permit2Bundler, diff --git a/src/goerli/GoerliBundler.sol b/src/goerli/GoerliBundlerV2.sol similarity index 96% rename from src/goerli/GoerliBundler.sol rename to src/goerli/GoerliBundlerV2.sol index 27c6814f..973d0a0e 100644 --- a/src/goerli/GoerliBundler.sol +++ b/src/goerli/GoerliBundlerV2.sol @@ -14,11 +14,11 @@ import {UrdBundler} from "../UrdBundler.sol"; import {MorphoBundler} from "../MorphoBundler.sol"; import {ERC20WrapperBundler} from "../ERC20WrapperBundler.sol"; -/// @title GoerliBundler +/// @title GoerliBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract specific to the Goerli testnet. -contract GoerliBundler is +contract GoerliBundlerV2 is TransferBundler, PermitBundler, Permit2Bundler, diff --git a/src/migration/AaveV2MigrationBundler.sol b/src/migration/AaveV2MigrationBundlerV2.sol similarity index 96% rename from src/migration/AaveV2MigrationBundler.sol rename to src/migration/AaveV2MigrationBundlerV2.sol index b33605ee..0ed2869e 100644 --- a/src/migration/AaveV2MigrationBundler.sol +++ b/src/migration/AaveV2MigrationBundlerV2.sol @@ -10,12 +10,12 @@ import {BaseBundler} from "../BaseBundler.sol"; import {StEthBundler} from "../StEthBundler.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; -/// @title AaveV2MigrationBundler +/// @title AaveV2MigrationBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Contract allowing to migrate a position from Aave V2 to Morpho Blue easily. /// If deploying to Ethereum, deploy `AaveV2EthereumMigrationBundler` instead. -contract AaveV2MigrationBundler is MigrationBundler, StEthBundler { +contract AaveV2MigrationBundlerV2 is MigrationBundler, StEthBundler { /* IMMUTABLES */ /// @dev The AaveV2 contract address. diff --git a/src/migration/AaveV3MigrationBundler.sol b/src/migration/AaveV3MigrationBundlerV2.sol similarity index 96% rename from src/migration/AaveV3MigrationBundler.sol rename to src/migration/AaveV3MigrationBundlerV2.sol index 3fbeae43..82161f86 100644 --- a/src/migration/AaveV3MigrationBundler.sol +++ b/src/migration/AaveV3MigrationBundlerV2.sol @@ -8,11 +8,11 @@ import {ErrorsLib} from "../libraries/ErrorsLib.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; -/// @title AaveV3MigrationBundler +/// @title AaveV3MigrationBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Contract allowing to migrate a position from Aave V3 to Morpho Blue easily. -contract AaveV3MigrationBundler is MigrationBundler { +contract AaveV3MigrationBundlerV2 is MigrationBundler { /* IMMUTABLES */ /// @dev The AaveV3 contract address. diff --git a/src/migration/AaveV3OptimizerMigrationBundler.sol b/src/migration/AaveV3OptimizerMigrationBundlerV2.sol similarity index 97% rename from src/migration/AaveV3OptimizerMigrationBundler.sol rename to src/migration/AaveV3OptimizerMigrationBundlerV2.sol index 6329f54e..4691f2e7 100644 --- a/src/migration/AaveV3OptimizerMigrationBundler.sol +++ b/src/migration/AaveV3OptimizerMigrationBundlerV2.sol @@ -8,11 +8,11 @@ import {ErrorsLib} from "../libraries/ErrorsLib.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; -/// @title AaveV3OptimizerMigrationBundler +/// @title AaveV3OptimizerMigrationBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Contract allowing to migrate a position from AaveV3 Optimizer to Morpho Blue easily. -contract AaveV3OptimizerMigrationBundler is MigrationBundler { +contract AaveV3OptimizerMigrationBundlerV2 is MigrationBundler { /* IMMUTABLES */ /// @dev The AaveV3 optimizer contract address. diff --git a/src/migration/CompoundV2MigrationBundler.sol b/src/migration/CompoundV2MigrationBundlerV2.sol similarity index 96% rename from src/migration/CompoundV2MigrationBundler.sol rename to src/migration/CompoundV2MigrationBundlerV2.sol index a461524b..b6d63923 100644 --- a/src/migration/CompoundV2MigrationBundler.sol +++ b/src/migration/CompoundV2MigrationBundlerV2.sol @@ -11,11 +11,11 @@ import {BaseBundler} from "../BaseBundler.sol"; import {WNativeBundler} from "../WNativeBundler.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; -/// @title CompoundV2MigrationBundler +/// @title CompoundV2MigrationBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Contract allowing to migrate a position from Compound V2 to Morpho Blue easily. -contract CompoundV2MigrationBundler is WNativeBundler, MigrationBundler { +contract CompoundV2MigrationBundlerV2 is WNativeBundler, MigrationBundler { /* IMMUTABLES */ /// @dev The address of the cETH contract. diff --git a/src/migration/CompoundV3MigrationBundler.sol b/src/migration/CompoundV3MigrationBundlerV2.sol similarity index 97% rename from src/migration/CompoundV3MigrationBundler.sol rename to src/migration/CompoundV3MigrationBundlerV2.sol index e6c39989..85ec91a1 100644 --- a/src/migration/CompoundV3MigrationBundler.sol +++ b/src/migration/CompoundV3MigrationBundlerV2.sol @@ -8,11 +8,11 @@ import {ErrorsLib} from "../libraries/ErrorsLib.sol"; import {MigrationBundler, ERC20} from "./MigrationBundler.sol"; -/// @title CompoundV3MigrationBundler +/// @title CompoundV3MigrationBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Contract allowing to migrate a position from Compound V3 to Morpho Blue easily. -contract CompoundV3MigrationBundler is MigrationBundler { +contract CompoundV3MigrationBundlerV2 is MigrationBundler { /* CONSTRUCTOR */ /// @param morpho The Morpho contract Address. diff --git a/src/sepolia/SepoliaBundler.sol b/src/sepolia/SepoliaBundler.sol index ac320be3..4a33d9f2 100644 --- a/src/sepolia/SepoliaBundler.sol +++ b/src/sepolia/SepoliaBundler.sol @@ -14,11 +14,11 @@ import {UrdBundler} from "../UrdBundler.sol"; import {MorphoBundler} from "../MorphoBundler.sol"; import {ERC20WrapperBundler} from "../ERC20WrapperBundler.sol"; -/// @title SepoliaBundler +/// @title SepoliaBundlerV2 /// @author Morpho Labs /// @custom:contact security@morpho.org /// @notice Bundler contract specific to the Sepolia testnet. -contract SepoliaBundler is +contract SepoliaBundlerV2 is TransferBundler, PermitBundler, Permit2Bundler, diff --git a/test/forge/ethereum/EthereumBundlerEthereumTest.sol b/test/forge/ethereum/EthereumBundlerEthereumTest.sol index ac9ab9aa..60e8c47b 100644 --- a/test/forge/ethereum/EthereumBundlerEthereumTest.sol +++ b/test/forge/ethereum/EthereumBundlerEthereumTest.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IAllowanceTransfer} from "../../../lib/permit2/src/interfaces/IAllowanceTransfer.sol"; -import "../../../src/ethereum/EthereumBundler.sol"; +import "../../../src/ethereum/EthereumBundlerV2.sol"; import "./helpers/EthereumTest.sol"; @@ -17,7 +17,7 @@ contract EthereumBundlerEthereumTest is EthereumTest { function setUp() public override { super.setUp(); - bundler = new EthereumBundler(address(morpho)); + bundler = new EthereumBundlerV2(address(morpho)); vm.prank(USER); morpho.setAuthorization(address(bundler), true); diff --git a/test/forge/ethereum/migration/AaveV2MigrationBundlerEthereumTest.sol b/test/forge/ethereum/migration/AaveV2MigrationBundlerEthereumTest.sol index 43d0dcde..0815b54a 100644 --- a/test/forge/ethereum/migration/AaveV2MigrationBundlerEthereumTest.sol +++ b/test/forge/ethereum/migration/AaveV2MigrationBundlerEthereumTest.sol @@ -5,7 +5,7 @@ import {IStEth} from "../../../../src/interfaces/IStEth.sol"; import {IAaveV2} from "../../../../src/migration/interfaces/IAaveV2.sol"; import {IERC4626} from "../../../../lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol"; -import "../../../../src/migration/AaveV2MigrationBundler.sol"; +import "../../../../src/migration/AaveV2MigrationBundlerV2.sol"; import "./helpers/EthereumMigrationTest.sol"; @@ -27,21 +27,21 @@ contract AaveV2MigrationBundlerEthereumTest is EthereumMigrationTest { vm.label(AAVE_V2_POOL, "Aave V2 Pool"); - bundler = new AaveV2MigrationBundler(address(morpho), AAVE_V2_POOL, WST_ETH); + bundler = new AaveV2MigrationBundlerV2(address(morpho), AAVE_V2_POOL, WST_ETH); } function testAaveV2RepayUninitiated(uint256 amount) public { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - AaveV2MigrationBundler(address(bundler)).aaveV2Repay(marketParams.loanToken, amount, 1); + AaveV2MigrationBundlerV2(address(bundler)).aaveV2Repay(marketParams.loanToken, amount, 1); } function testAaveV2WithdrawUninitiated(uint256 amount) public { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - AaveV2MigrationBundler(address(bundler)).aaveV2Withdraw(marketParams.loanToken, amount); + AaveV2MigrationBundlerV2(address(bundler)).aaveV2Withdraw(marketParams.loanToken, amount); } function testAaveV2RepayZeroAmount() public { @@ -240,10 +240,10 @@ contract AaveV2MigrationBundlerEthereumTest is EthereumMigrationTest { /* ACTIONS */ function _aaveV2Repay(address asset, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(AaveV2MigrationBundler.aaveV2Repay, (asset, amount, RATE_MODE)); + return abi.encodeCall(AaveV2MigrationBundlerV2.aaveV2Repay, (asset, amount, RATE_MODE)); } function _aaveV2Withdraw(address asset, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(AaveV2MigrationBundler.aaveV2Withdraw, (asset, amount)); + return abi.encodeCall(AaveV2MigrationBundlerV2.aaveV2Withdraw, (asset, amount)); } } diff --git a/test/forge/ethereum/migration/AaveV3MigrationBundlerEthereumTest.sol b/test/forge/ethereum/migration/AaveV3MigrationBundlerEthereumTest.sol index ac24dfd7..76a9ffb3 100644 --- a/test/forge/ethereum/migration/AaveV3MigrationBundlerEthereumTest.sol +++ b/test/forge/ethereum/migration/AaveV3MigrationBundlerEthereumTest.sol @@ -5,7 +5,7 @@ import {IAToken} from "./interfaces/IAToken.sol"; import {IAaveV3} from "../../../../src/migration/interfaces/IAaveV3.sol"; import {SigUtils, Permit} from "../../helpers/SigUtils.sol"; -import "../../../../src/migration/AaveV3MigrationBundler.sol"; +import "../../../../src/migration/AaveV3MigrationBundlerV2.sol"; import "./helpers/EthereumMigrationTest.sol"; @@ -27,7 +27,7 @@ contract AaveV3MigrationBundlerEthereumTest is EthereumMigrationTest { vm.label(AAVE_V3_POOL, "Aave V3 Pool"); - bundler = new AaveV3MigrationBundler(address(morpho), address(AAVE_V3_POOL)); + bundler = new AaveV3MigrationBundlerV2(address(morpho), address(AAVE_V3_POOL)); vm.label(address(bundler), "Aave V3 Migration Bundler"); } @@ -35,7 +35,7 @@ contract AaveV3MigrationBundlerEthereumTest is EthereumMigrationTest { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - AaveV3MigrationBundler(address(bundler)).aaveV3Repay(marketParams.loanToken, amount, 1); + AaveV3MigrationBundlerV2(address(bundler)).aaveV3Repay(marketParams.loanToken, amount, 1); } function testAaveV3RepayZeroAmount() public { @@ -290,10 +290,10 @@ contract AaveV3MigrationBundlerEthereumTest is EthereumMigrationTest { } function _aaveV3Repay(address asset, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(AaveV3MigrationBundler.aaveV3Repay, (asset, amount, RATE_MODE)); + return abi.encodeCall(AaveV3MigrationBundlerV2.aaveV3Repay, (asset, amount, RATE_MODE)); } function _aaveV3Withdraw(address asset, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(AaveV3MigrationBundler.aaveV3Withdraw, (asset, amount)); + return abi.encodeCall(AaveV3MigrationBundlerV2.aaveV3Withdraw, (asset, amount)); } } diff --git a/test/forge/ethereum/migration/AaveV3OptimizerMigrationBundlerEthereumTest.sol b/test/forge/ethereum/migration/AaveV3OptimizerMigrationBundlerEthereumTest.sol index aa41cb7d..3102487e 100644 --- a/test/forge/ethereum/migration/AaveV3OptimizerMigrationBundlerEthereumTest.sol +++ b/test/forge/ethereum/migration/AaveV3OptimizerMigrationBundlerEthereumTest.sol @@ -3,11 +3,7 @@ pragma solidity ^0.8.0; import {Authorization as AaveV3OptimizerAuthorization} from "../../../../src/migration/interfaces/IAaveV3Optimizer.sol"; -import { - AaveV3OptimizerMigrationBundler, - IAaveV3Optimizer, - Signature as MA3Signature -} from "../../../../src/migration/AaveV3OptimizerMigrationBundler.sol"; +import "../../../../src/migration/AaveV3OptimizerMigrationBundlerV2.sol"; import "./helpers/EthereumMigrationTest.sol"; @@ -29,14 +25,14 @@ contract AaveV3OptimizerMigrationBundlerEthereumTest is EthereumMigrationTest { vm.label(AAVE_V3_OPTIMIZER, "AaveV3Optimizer"); - bundler = new AaveV3OptimizerMigrationBundler(address(morpho), address(AAVE_V3_OPTIMIZER)); + bundler = new AaveV3OptimizerMigrationBundlerV2(address(morpho), address(AAVE_V3_OPTIMIZER)); } function testAaveV3OptimizerRepayUninitiated(uint256 amount) public { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - AaveV3OptimizerMigrationBundler(address(bundler)).aaveV3OptimizerRepay(marketParams.loanToken, amount); + AaveV3OptimizerMigrationBundlerV2(address(bundler)).aaveV3OptimizerRepay(marketParams.loanToken, amount); } function testAaveV3Optimizer3RepayZeroAmount() public { @@ -57,12 +53,12 @@ contract AaveV3OptimizerMigrationBundlerEthereumTest is EthereumMigrationTest { AaveV3OptimizerAuthorization(owner, address(this), true, 0, SIGNATURE_DEADLINE) ); - MA3Signature memory sig; + Signature memory sig; (sig.v, sig.r, sig.s) = vm.sign(privateKey, digest); bundle.push( abi.encodeCall( - AaveV3OptimizerMigrationBundler.aaveV3OptimizerApproveManagerWithSig, + AaveV3OptimizerMigrationBundlerV2.aaveV3OptimizerApproveManagerWithSig, (true, 0, SIGNATURE_DEADLINE, sig, false) ) ); @@ -188,10 +184,10 @@ contract AaveV3OptimizerMigrationBundlerEthereumTest is EthereumMigrationTest { function testAaveV3OptimizerApproveManagerUninitiated(uint256 amount) public { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); - MA3Signature memory sig; + Signature memory sig; vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - AaveV3OptimizerMigrationBundler(address(bundler)).aaveV3OptimizerApproveManagerWithSig( + AaveV3OptimizerMigrationBundlerV2(address(bundler)).aaveV3OptimizerApproveManagerWithSig( true, 0, SIGNATURE_DEADLINE, sig, false ); } @@ -200,7 +196,7 @@ contract AaveV3OptimizerMigrationBundlerEthereumTest is EthereumMigrationTest { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - AaveV3OptimizerMigrationBundler(address(bundler)).aaveV3OptimizerWithdraw( + AaveV3OptimizerMigrationBundlerV2(address(bundler)).aaveV3OptimizerWithdraw( marketParams.loanToken, amount, MAX_ITERATIONS ); } @@ -209,7 +205,7 @@ contract AaveV3OptimizerMigrationBundlerEthereumTest is EthereumMigrationTest { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - AaveV3OptimizerMigrationBundler(address(bundler)).aaveV3OptimizerWithdrawCollateral( + AaveV3OptimizerMigrationBundlerV2(address(bundler)).aaveV3OptimizerWithdrawCollateral( marketParams.loanToken, amount ); } @@ -228,22 +224,22 @@ contract AaveV3OptimizerMigrationBundlerEthereumTest is EthereumMigrationTest { AaveV3OptimizerAuthorization(vm.addr(privateKey), manager, isAllowed, nonce, SIGNATURE_DEADLINE) ); - MA3Signature memory sig; + Signature memory sig; (sig.v, sig.r, sig.s) = vm.sign(privateKey, digest); return abi.encodeCall( - AaveV3OptimizerMigrationBundler.aaveV3OptimizerApproveManagerWithSig, + AaveV3OptimizerMigrationBundlerV2.aaveV3OptimizerApproveManagerWithSig, (isAllowed, nonce, SIGNATURE_DEADLINE, sig, skipRevert) ); } function _aaveV3OptimizerRepay(address underlying, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(AaveV3OptimizerMigrationBundler.aaveV3OptimizerRepay, (underlying, amount)); + return abi.encodeCall(AaveV3OptimizerMigrationBundlerV2.aaveV3OptimizerRepay, (underlying, amount)); } function _aaveV3OptimizerWithdraw(address underlying, uint256 amount) internal pure returns (bytes memory) { return abi.encodeCall( - AaveV3OptimizerMigrationBundler.aaveV3OptimizerWithdraw, (underlying, amount, MAX_ITERATIONS) + AaveV3OptimizerMigrationBundlerV2.aaveV3OptimizerWithdraw, (underlying, amount, MAX_ITERATIONS) ); } @@ -252,6 +248,6 @@ contract AaveV3OptimizerMigrationBundlerEthereumTest is EthereumMigrationTest { pure returns (bytes memory) { - return abi.encodeCall(AaveV3OptimizerMigrationBundler.aaveV3OptimizerWithdrawCollateral, (underlying, amount)); + return abi.encodeCall(AaveV3OptimizerMigrationBundlerV2.aaveV3OptimizerWithdrawCollateral, (underlying, amount)); } } diff --git a/test/forge/ethereum/migration/CompoundV2EthBorrowableMigrationBundlerEthereumTest.sol b/test/forge/ethereum/migration/CompoundV2EthBorrowableMigrationBundlerEthereumTest.sol index 59a167ea..39d0d909 100644 --- a/test/forge/ethereum/migration/CompoundV2EthBorrowableMigrationBundlerEthereumTest.sol +++ b/test/forge/ethereum/migration/CompoundV2EthBorrowableMigrationBundlerEthereumTest.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IComptroller} from "../../../../src/migration/interfaces/IComptroller.sol"; -import "../../../../src/migration/CompoundV2MigrationBundler.sol"; +import "../../../../src/migration/CompoundV2MigrationBundlerV2.sol"; import "./helpers/EthereumMigrationTest.sol"; @@ -21,7 +21,7 @@ contract CompoundV2EthLoanMigrationBundlerEthereumTest is EthereumMigrationTest _initMarket(DAI, WETH); - bundler = new CompoundV2MigrationBundler(address(morpho), WETH, C_ETH_V2); + bundler = new CompoundV2MigrationBundlerV2(address(morpho), WETH, C_ETH_V2); enteredMarkets.push(C_DAI_V2); } @@ -30,7 +30,7 @@ contract CompoundV2EthLoanMigrationBundlerEthereumTest is EthereumMigrationTest amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - CompoundV2MigrationBundler(payable(address(bundler))).compoundV2Repay(C_DAI_V2, amount); + CompoundV2MigrationBundlerV2(payable(address(bundler))).compoundV2Repay(C_DAI_V2, amount); } function testCompoundV2RepayCEthZeroAmount() public { @@ -141,10 +141,10 @@ contract CompoundV2EthLoanMigrationBundlerEthereumTest is EthereumMigrationTest /* ACTIONS */ function _compoundV2Repay(address cToken, uint256 repayAmount) internal pure returns (bytes memory) { - return abi.encodeCall(CompoundV2MigrationBundler.compoundV2Repay, (cToken, repayAmount)); + return abi.encodeCall(CompoundV2MigrationBundlerV2.compoundV2Repay, (cToken, repayAmount)); } function _compoundV2Redeem(address cToken, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(CompoundV2MigrationBundler.compoundV2Redeem, (cToken, amount)); + return abi.encodeCall(CompoundV2MigrationBundlerV2.compoundV2Redeem, (cToken, amount)); } } diff --git a/test/forge/ethereum/migration/CompoundV2EthCollateralMigrationBundlerEthereumTest.sol b/test/forge/ethereum/migration/CompoundV2EthCollateralMigrationBundlerEthereumTest.sol index 519afcd7..e09d1e58 100644 --- a/test/forge/ethereum/migration/CompoundV2EthCollateralMigrationBundlerEthereumTest.sol +++ b/test/forge/ethereum/migration/CompoundV2EthCollateralMigrationBundlerEthereumTest.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IComptroller} from "../../../../src/migration/interfaces/IComptroller.sol"; -import "../../../../src/migration/CompoundV2MigrationBundler.sol"; +import "../../../../src/migration/CompoundV2MigrationBundlerV2.sol"; import "./helpers/EthereumMigrationTest.sol"; @@ -21,7 +21,7 @@ contract CompoundV2EthCollateralMigrationBundlerEthereumTest is EthereumMigratio _initMarket(WETH, DAI); - bundler = new CompoundV2MigrationBundler(address(morpho), WETH, C_ETH_V2); + bundler = new CompoundV2MigrationBundlerV2(address(morpho), WETH, C_ETH_V2); enteredMarkets.push(C_ETH_V2); } @@ -77,10 +77,10 @@ contract CompoundV2EthCollateralMigrationBundlerEthereumTest is EthereumMigratio /* ACTIONS */ function _compoundV2Repay(address cToken, uint256 repayAmount) internal pure returns (bytes memory) { - return abi.encodeCall(CompoundV2MigrationBundler.compoundV2Repay, (cToken, repayAmount)); + return abi.encodeCall(CompoundV2MigrationBundlerV2.compoundV2Repay, (cToken, repayAmount)); } function _compoundV2Redeem(address cToken, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(CompoundV2MigrationBundler.compoundV2Redeem, (cToken, amount)); + return abi.encodeCall(CompoundV2MigrationBundlerV2.compoundV2Redeem, (cToken, amount)); } } diff --git a/test/forge/ethereum/migration/CompoundV2NoEthMigrationBundlerEthereumTest.sol b/test/forge/ethereum/migration/CompoundV2NoEthMigrationBundlerEthereumTest.sol index 6936e994..ad19be65 100644 --- a/test/forge/ethereum/migration/CompoundV2NoEthMigrationBundlerEthereumTest.sol +++ b/test/forge/ethereum/migration/CompoundV2NoEthMigrationBundlerEthereumTest.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IComptroller} from "../../../../src/migration/interfaces/IComptroller.sol"; -import "../../../../src/migration/CompoundV2MigrationBundler.sol"; +import "../../../../src/migration/CompoundV2MigrationBundlerV2.sol"; import "./helpers/EthereumMigrationTest.sol"; @@ -21,7 +21,7 @@ contract CompoundV2NoEthMigrationBundlerEthereumTest is EthereumMigrationTest { _initMarket(DAI, USDC); - bundler = new CompoundV2MigrationBundler(address(morpho), WETH, C_ETH_V2); + bundler = new CompoundV2MigrationBundlerV2(address(morpho), WETH, C_ETH_V2); enteredMarkets.push(C_DAI_V2); } @@ -134,10 +134,10 @@ contract CompoundV2NoEthMigrationBundlerEthereumTest is EthereumMigrationTest { /* ACTIONS */ function _compoundV2Repay(address cToken, uint256 repayAmount) internal pure returns (bytes memory) { - return abi.encodeCall(CompoundV2MigrationBundler.compoundV2Repay, (cToken, repayAmount)); + return abi.encodeCall(CompoundV2MigrationBundlerV2.compoundV2Repay, (cToken, repayAmount)); } function _compoundV2Redeem(address cToken, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(CompoundV2MigrationBundler.compoundV2Redeem, (cToken, amount)); + return abi.encodeCall(CompoundV2MigrationBundlerV2.compoundV2Redeem, (cToken, amount)); } } diff --git a/test/forge/ethereum/migration/CompoundV3MigrationBundlerEthereumTest.sol b/test/forge/ethereum/migration/CompoundV3MigrationBundlerEthereumTest.sol index 23266d11..b0a49eb9 100644 --- a/test/forge/ethereum/migration/CompoundV3MigrationBundlerEthereumTest.sol +++ b/test/forge/ethereum/migration/CompoundV3MigrationBundlerEthereumTest.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {CompoundV3Authorization} from "../../helpers/SigUtils.sol"; -import "../../../../src/migration/CompoundV3MigrationBundler.sol"; +import "../../../../src/migration/CompoundV3MigrationBundlerV2.sol"; import "./helpers/EthereumMigrationTest.sol"; @@ -21,14 +21,14 @@ contract CompoundV3MigrationBundlerEthereumTest is EthereumMigrationTest { _initMarket(CB_ETH, WETH); - bundler = new CompoundV3MigrationBundler(address(morpho)); + bundler = new CompoundV3MigrationBundlerV2(address(morpho)); } function testCompoundV3RepayUninitiated(uint256 amount) public { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - CompoundV3MigrationBundler(address(bundler)).compoundV3Repay(C_WETH_V3, amount); + CompoundV3MigrationBundlerV2(address(bundler)).compoundV3Repay(C_WETH_V3, amount); } function testCompoundV3RepayZeroAmount() public { @@ -52,7 +52,7 @@ contract CompoundV3MigrationBundlerEthereumTest is EthereumMigrationTest { bundle.push( abi.encodeCall( - CompoundV3MigrationBundler.compoundV3AllowBySig, + CompoundV3MigrationBundlerV2.compoundV3AllowBySig, (C_WETH_V3, true, 0, SIGNATURE_DEADLINE, v, r, s, false) ) ); @@ -147,7 +147,7 @@ contract CompoundV3MigrationBundlerEthereumTest is EthereumMigrationTest { function testCompoundV3AllowUninitiated() public { vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - CompoundV3MigrationBundler(address(bundler)).compoundV3AllowBySig( + CompoundV3MigrationBundlerV2(address(bundler)).compoundV3AllowBySig( C_WETH_V3, true, 0, SIGNATURE_DEADLINE, 0, 0, 0, false ); } @@ -156,7 +156,7 @@ contract CompoundV3MigrationBundlerEthereumTest is EthereumMigrationTest { amount = bound(amount, MIN_AMOUNT, MAX_AMOUNT); vm.expectRevert(bytes(ErrorsLib.UNINITIATED)); - CompoundV3MigrationBundler(address(bundler)).compoundV3WithdrawFrom(C_WETH_V3, marketParams.loanToken, amount); + CompoundV3MigrationBundlerV2(address(bundler)).compoundV3WithdrawFrom(C_WETH_V3, marketParams.loanToken, amount); } /* ACTIONS */ @@ -176,13 +176,13 @@ contract CompoundV3MigrationBundlerEthereumTest is EthereumMigrationTest { (uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, digest); return abi.encodeCall( - CompoundV3MigrationBundler.compoundV3AllowBySig, + CompoundV3MigrationBundlerV2.compoundV3AllowBySig, (instance, isAllowed, nonce, SIGNATURE_DEADLINE, v, r, s, skipRevert) ); } function _compoundV3Repay(address instance, uint256 amount) internal pure returns (bytes memory) { - return abi.encodeCall(CompoundV3MigrationBundler.compoundV3Repay, (instance, amount)); + return abi.encodeCall(CompoundV3MigrationBundlerV2.compoundV3Repay, (instance, amount)); } function _compoundV3WithdrawFrom(address instance, address asset, uint256 amount) @@ -190,6 +190,6 @@ contract CompoundV3MigrationBundlerEthereumTest is EthereumMigrationTest { pure returns (bytes memory) { - return abi.encodeCall(CompoundV3MigrationBundler.compoundV3WithdrawFrom, (instance, asset, amount)); + return abi.encodeCall(CompoundV3MigrationBundlerV2.compoundV3WithdrawFrom, (instance, asset, amount)); } } From 624d3c0ce863fb94de235e57d96e55d129445242 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 5 Mar 2024 10:38:06 +0100 Subject: [PATCH 2/4] chore: rename sepolia bundler file --- src/sepolia/{SepoliaBundler.sol => SepoliaBundlerV2.sol} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/sepolia/{SepoliaBundler.sol => SepoliaBundlerV2.sol} (100%) diff --git a/src/sepolia/SepoliaBundler.sol b/src/sepolia/SepoliaBundlerV2.sol similarity index 100% rename from src/sepolia/SepoliaBundler.sol rename to src/sepolia/SepoliaBundlerV2.sol From 0129e590d2bcaac547b40371ea11c7541ce6477f Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 5 Mar 2024 10:43:35 +0100 Subject: [PATCH 3/4] chore: adapt hardhat --- pkg/BundlerAction.ts | 20 ++++++++++---------- test/hardhat/EthereumBundler.spec.ts | 12 ++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/BundlerAction.ts b/pkg/BundlerAction.ts index d92cb5e5..f003a7d6 100644 --- a/pkg/BundlerAction.ts +++ b/pkg/BundlerAction.ts @@ -9,11 +9,11 @@ import { UrdBundler__factory, WNativeBundler__factory, StEthBundler__factory, - AaveV2MigrationBundler__factory, - AaveV3MigrationBundler__factory, - AaveV3OptimizerMigrationBundler__factory, - CompoundV2MigrationBundler__factory, - CompoundV3MigrationBundler__factory, + AaveV2MigrationBundlerV2__factory, + AaveV3MigrationBundlerV2__factory, + AaveV3OptimizerMigrationBundlerV2__factory, + CompoundV2MigrationBundlerV2__factory, + CompoundV3MigrationBundlerV2__factory, EthereumPermitBundler__factory, IAllowanceTransfer, ERC20WrapperBundler__factory, @@ -34,11 +34,11 @@ export class BundlerAction { private static ST_ETH_BUNDLER_IFC = StEthBundler__factory.createInterface(); private static ETHEREUM_PERMIT_BUNDLER_IFC = EthereumPermitBundler__factory.createInterface(); - private static AAVE_V2_BUNDLER_IFC = AaveV2MigrationBundler__factory.createInterface(); - private static AAVE_V3_BUNDLER_IFC = AaveV3MigrationBundler__factory.createInterface(); - private static AAVE_V3_OPTIMIZER_BUNDLER_IFC = AaveV3OptimizerMigrationBundler__factory.createInterface(); - private static COMPOUND_V2_BUNDLER_IFC = CompoundV2MigrationBundler__factory.createInterface(); - private static COMPOUND_V3_BUNDLER_IFC = CompoundV3MigrationBundler__factory.createInterface(); + private static AAVE_V2_BUNDLER_IFC = AaveV2MigrationBundlerV2__factory.createInterface(); + private static AAVE_V3_BUNDLER_IFC = AaveV3MigrationBundlerV2__factory.createInterface(); + private static AAVE_V3_OPTIMIZER_BUNDLER_IFC = AaveV3OptimizerMigrationBundlerV2__factory.createInterface(); + private static COMPOUND_V2_BUNDLER_IFC = CompoundV2MigrationBundlerV2__factory.createInterface(); + private static COMPOUND_V3_BUNDLER_IFC = CompoundV3MigrationBundlerV2__factory.createInterface(); /* ERC20 */ diff --git a/test/hardhat/EthereumBundler.spec.ts b/test/hardhat/EthereumBundler.spec.ts index 25df01c4..a7260d0e 100644 --- a/test/hardhat/EthereumBundler.spec.ts +++ b/test/hardhat/EthereumBundler.spec.ts @@ -5,11 +5,11 @@ import { BundlerAction } from "pkg"; import { ERC20Mock, ERC4626Mock, - EthereumBundler, + EthereumBundlerV2, MorphoMock, OracleMock, AdaptiveCurveIrmMock, - EthereumBundler__factory, + EthereumBundlerV2__factory, } from "types"; import { MarketParamsStruct } from "types/lib/morpho-blue/src/Morpho"; @@ -150,7 +150,7 @@ describe("EthereumBundler", () => { let erc4626: ERC4626Mock; let erc4626Address: string; - let bundler: EthereumBundler; + let bundler: EthereumBundlerV2; let bundlerAddress: string; let marketParams: MarketParamsStruct; @@ -220,9 +220,9 @@ describe("EthereumBundler", () => { await morpho.enableLltv(marketParams.lltv); await morpho.createMarket(marketParams); - const EthereumBundlerFactory = await hre.ethers.getContractFactory("EthereumBundler", admin); + const EthereumBundlerV2Factory = await hre.ethers.getContractFactory("EthereumBundlerV2", admin); - bundler = await EthereumBundlerFactory.deploy(morphoAddress); + bundler = await EthereumBundlerV2Factory.deploy(morphoAddress); bundlerAddress = await bundler.getAddress(); @@ -345,7 +345,7 @@ describe("EthereumBundler", () => { }); it("should have all batched functions payable", async () => { - EthereumBundler__factory.createInterface().forEachFunction((func) => { + EthereumBundlerV2__factory.createInterface().forEachFunction((func) => { if (func.stateMutability === "view" || func.stateMutability === "pure") return; const shouldPayable = !func.name.startsWith("onMorpho"); From e3803d9cdbb71c97d02823ac7da278f0c3ca1040 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Mar 2024 11:32:45 +0100 Subject: [PATCH 4/4] style: a couple text instance to rename --- README.md | 2 +- test/hardhat/EthereumBundler.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e5470f8..ed9343ba 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Each Bundler is a domain-specific abstract layer of contract that implements som 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)). -User-end bundlers are provided in each chain-specific folder, instanciating all the intermediary domain-specific bundlers and associated parameters (such as chain-specific protocol addresses, e.g. [`EthereumBundler`](./src/ethereum/EthereumBundler.sol)). +User-end bundlers are provided in each chain-specific folder, instanciating all the intermediary domain-specific bundlers and associated parameters (such as chain-specific protocol addresses, e.g. [`EthereumBundlerV2`](./src/ethereum/EthereumBundlerV2.sol)). ## Getting Started diff --git a/test/hardhat/EthereumBundler.spec.ts b/test/hardhat/EthereumBundler.spec.ts index a7260d0e..3a672a23 100644 --- a/test/hardhat/EthereumBundler.spec.ts +++ b/test/hardhat/EthereumBundler.spec.ts @@ -240,7 +240,7 @@ describe("EthereumBundler", () => { hre.tracer.nameTags[loanAddress] = "Loan"; hre.tracer.nameTags[oracleAddress] = "Oracle"; hre.tracer.nameTags[irmAddress] = "AdaptiveCurveIrm"; - hre.tracer.nameTags[bundlerAddress] = "EthereumBundler"; + hre.tracer.nameTags[bundlerAddress] = "EthereumBundlerV2"; }); it("should simulate gas cost [morpho-supplyCollateral+borrow]", async () => {