feat: Transfer Optimizations in MaverickV2

- Also added integration test to test the optimizations, where we can see the in and out transfers being optimized if we enable verbose foundry testing
- Fixed typo in swap encoder builder initialization
This commit is contained in:
TAMARA LIPOWSKI
2025-04-29 15:36:21 -04:00
parent b6a3ce624d
commit bcef8f69f6
10 changed files with 152 additions and 24 deletions

View File

@@ -15,6 +15,7 @@ import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol";
import {WETH} from "../lib/permit2/lib/solmate/src/tokens/WETH.sol";
import {Permit2TestHelper} from "./Permit2TestHelper.sol";
import "./TestUtils.sol";
import {MaverickV2Executor} from "../src/executors/MaverickV2Executor.sol";
contract TychoRouterExposed is TychoRouter {
constructor(address _permit2, address weth) TychoRouter(_permit2, weth) {}
@@ -53,6 +54,7 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
BalancerV2Executor public balancerv2Executor;
EkuboExecutor public ekuboExecutor;
CurveExecutor public curveExecutor;
MaverickV2Executor public maverickv2Executor;
MockERC20[] tokens;
function setUp() public {
@@ -110,8 +112,10 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
balancerv2Executor = new BalancerV2Executor(PERMIT2_ADDRESS);
ekuboExecutor = new EkuboExecutor(ekuboCore, PERMIT2_ADDRESS);
curveExecutor = new CurveExecutor(ETH_ADDR_FOR_CURVE, PERMIT2_ADDRESS);
maverickv2Executor =
new MaverickV2Executor(MAVERICK_V2_FACTORY, PERMIT2_ADDRESS);
address[] memory executors = new address[](7);
address[] memory executors = new address[](8);
executors[0] = address(usv2Executor);
executors[1] = address(usv3Executor);
executors[2] = address(pancakev3Executor);
@@ -119,6 +123,7 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
executors[4] = address(balancerv2Executor);
executors[5] = address(ekuboExecutor);
executors[6] = address(curveExecutor);
executors[7] = address(maverickv2Executor);
return executors;
}