test: add single, split and sequential scenarios

This commit is contained in:
pedrobergamini
2025-06-04 19:12:56 -03:00
parent af0f4c454e
commit 6f80137117
4 changed files with 75 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
pragma solidity ^0.8.26;
import "../src/executors/BalancerV2Executor.sol";
import "../src/executors/BebopExecutor.sol";
import "../src/executors/CurveExecutor.sol";
import "../src/executors/EkuboExecutor.sol";
import "../src/executors/UniswapV2Executor.sol";
@@ -63,6 +64,7 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
UniswapV3Executor public pancakev3Executor;
UniswapV4Executor public usv4Executor;
BalancerV2Executor public balancerv2Executor;
BebopExecutor public bebopExecutor;
EkuboExecutor public ekuboExecutor;
CurveExecutor public curveExecutor;
MaverickV2Executor public maverickv2Executor;
@@ -121,20 +123,22 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
factoryPancakeV3, initCodePancakeV3, PERMIT2_ADDRESS
);
balancerv2Executor = new BalancerV2Executor(PERMIT2_ADDRESS);
bebopExecutor = new BebopExecutor(BEBOP_SETTLEMENT, 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[](8);
address[] memory executors = new address[](9);
executors[0] = address(usv2Executor);
executors[1] = address(usv3Executor);
executors[2] = address(pancakev3Executor);
executors[3] = address(usv4Executor);
executors[4] = address(balancerv2Executor);
executors[5] = address(ekuboExecutor);
executors[6] = address(curveExecutor);
executors[7] = address(maverickv2Executor);
executors[5] = address(bebopExecutor);
executors[6] = address(ekuboExecutor);
executors[7] = address(curveExecutor);
executors[8] = address(maverickv2Executor);
return executors;
}
@@ -191,6 +195,30 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
);
}
function encodeBebopSwap(
address tokenIn,
address tokenOut,
RestrictTransferFrom.TransferType transferType,
BebopExecutor.OrderType orderType,
bytes memory quoteData,
uint8 signatureType,
bytes memory signature,
bool approvalNeeded
) internal pure returns (bytes memory) {
return abi.encodePacked(
tokenIn,
tokenOut,
transferType,
orderType,
uint32(quoteData.length),
quoteData,
signatureType,
uint32(signature.length),
signature,
approvalNeeded ? uint8(1) : uint8(0)
);
}
function encodeUniswapV2Swap(
address tokenIn,
address target,