forge fmt
This commit is contained in:
@@ -8,7 +8,10 @@ import {CurveExecutor} from "../src/executors/CurveExecutor.sol";
|
|||||||
import {EkuboExecutor} from "../src/executors/EkuboExecutor.sol";
|
import {EkuboExecutor} from "../src/executors/EkuboExecutor.sol";
|
||||||
import {MaverickV2Executor} from "../src/executors/MaverickV2Executor.sol";
|
import {MaverickV2Executor} from "../src/executors/MaverickV2Executor.sol";
|
||||||
import {UniswapV2Executor} from "../src/executors/UniswapV2Executor.sol";
|
import {UniswapV2Executor} from "../src/executors/UniswapV2Executor.sol";
|
||||||
import {UniswapV3Executor, IUniswapV3Pool} from "../src/executors/UniswapV3Executor.sol";
|
import {
|
||||||
|
UniswapV3Executor,
|
||||||
|
IUniswapV3Pool
|
||||||
|
} from "../src/executors/UniswapV3Executor.sol";
|
||||||
import {UniswapV4Executor} from "../src/executors/UniswapV4Executor.sol";
|
import {UniswapV4Executor} from "../src/executors/UniswapV4Executor.sol";
|
||||||
|
|
||||||
// Test utilities and mocks
|
// Test utilities and mocks
|
||||||
@@ -38,10 +41,7 @@ contract TychoRouterExposed is TychoRouter {
|
|||||||
bool transferFromNeeded
|
bool transferFromNeeded
|
||||||
) external {
|
) external {
|
||||||
_tstoreTransferFromInfo(
|
_tstoreTransferFromInfo(
|
||||||
tokenIn,
|
tokenIn, amountIn, isPermit2, transferFromNeeded
|
||||||
amountIn,
|
|
||||||
isPermit2,
|
|
||||||
transferFromNeeded
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,10 +53,10 @@ contract TychoRouterExposed is TychoRouter {
|
|||||||
return _splitSwap(amountIn, nTokens, swaps);
|
return _splitSwap(amountIn, nTokens, swaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
function exposedSequentialSwap(
|
function exposedSequentialSwap(uint256 amountIn, bytes calldata swaps)
|
||||||
uint256 amountIn,
|
external
|
||||||
bytes calldata swaps
|
returns (uint256)
|
||||||
) external returns (uint256) {
|
{
|
||||||
return _sequentialSwap(amountIn, swaps);
|
return _sequentialSwap(amountIn, swaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,8 +100,7 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
|
|||||||
tychoRouter.grantRole(keccak256("PAUSER_ROLE"), PAUSER);
|
tychoRouter.grantRole(keccak256("PAUSER_ROLE"), PAUSER);
|
||||||
tychoRouter.grantRole(keccak256("UNPAUSER_ROLE"), UNPAUSER);
|
tychoRouter.grantRole(keccak256("UNPAUSER_ROLE"), UNPAUSER);
|
||||||
tychoRouter.grantRole(
|
tychoRouter.grantRole(
|
||||||
keccak256("EXECUTOR_SETTER_ROLE"),
|
keccak256("EXECUTOR_SETTER_ROLE"), EXECUTOR_SETTER
|
||||||
EXECUTOR_SETTER
|
|
||||||
);
|
);
|
||||||
return tychoRouter;
|
return tychoRouter;
|
||||||
}
|
}
|
||||||
@@ -118,34 +117,20 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
|
|||||||
address ekuboMevResist = 0x553a2EFc570c9e104942cEC6aC1c18118e54C091;
|
address ekuboMevResist = 0x553a2EFc570c9e104942cEC6aC1c18118e54C091;
|
||||||
|
|
||||||
IPoolManager poolManager = IPoolManager(poolManagerAddress);
|
IPoolManager poolManager = IPoolManager(poolManagerAddress);
|
||||||
usv2Executor = new UniswapV2Executor(
|
usv2Executor =
|
||||||
factoryV2,
|
new UniswapV2Executor(factoryV2, initCodeV2, PERMIT2_ADDRESS, 30);
|
||||||
initCodeV2,
|
usv3Executor =
|
||||||
PERMIT2_ADDRESS,
|
new UniswapV3Executor(factoryV3, initCodeV3, PERMIT2_ADDRESS);
|
||||||
30
|
|
||||||
);
|
|
||||||
usv3Executor = new UniswapV3Executor(
|
|
||||||
factoryV3,
|
|
||||||
initCodeV3,
|
|
||||||
PERMIT2_ADDRESS
|
|
||||||
);
|
|
||||||
usv4Executor = new UniswapV4Executor(poolManager, PERMIT2_ADDRESS);
|
usv4Executor = new UniswapV4Executor(poolManager, PERMIT2_ADDRESS);
|
||||||
pancakev3Executor = new UniswapV3Executor(
|
pancakev3Executor = new UniswapV3Executor(
|
||||||
factoryPancakeV3,
|
factoryPancakeV3, initCodePancakeV3, PERMIT2_ADDRESS
|
||||||
initCodePancakeV3,
|
|
||||||
PERMIT2_ADDRESS
|
|
||||||
);
|
);
|
||||||
balancerv2Executor = new BalancerV2Executor(PERMIT2_ADDRESS);
|
balancerv2Executor = new BalancerV2Executor(PERMIT2_ADDRESS);
|
||||||
ekuboExecutor = new EkuboExecutor(
|
ekuboExecutor =
|
||||||
ekuboCore,
|
new EkuboExecutor(ekuboCore, ekuboMevResist, PERMIT2_ADDRESS);
|
||||||
ekuboMevResist,
|
|
||||||
PERMIT2_ADDRESS
|
|
||||||
);
|
|
||||||
curveExecutor = new CurveExecutor(ETH_ADDR_FOR_CURVE, PERMIT2_ADDRESS);
|
curveExecutor = new CurveExecutor(ETH_ADDR_FOR_CURVE, PERMIT2_ADDRESS);
|
||||||
maverickv2Executor = new MaverickV2Executor(
|
maverickv2Executor =
|
||||||
MAVERICK_V2_FACTORY,
|
new MaverickV2Executor(MAVERICK_V2_FACTORY, PERMIT2_ADDRESS);
|
||||||
PERMIT2_ADDRESS
|
|
||||||
);
|
|
||||||
balancerV3Executor = new BalancerV3Executor(PERMIT2_ADDRESS);
|
balancerV3Executor = new BalancerV3Executor(PERMIT2_ADDRESS);
|
||||||
|
|
||||||
address[] memory executors = new address[](9);
|
address[] memory executors = new address[](9);
|
||||||
@@ -162,9 +147,11 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
|
|||||||
return executors;
|
return executors;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pleEncode(
|
function pleEncode(bytes[] memory data)
|
||||||
bytes[] memory data
|
public
|
||||||
) public pure returns (bytes memory encoded) {
|
pure
|
||||||
|
returns (bytes memory encoded)
|
||||||
|
{
|
||||||
for (uint256 i = 0; i < data.length; i++) {
|
for (uint256 i = 0; i < data.length; i++) {
|
||||||
encoded = bytes.concat(
|
encoded = bytes.concat(
|
||||||
encoded,
|
encoded,
|
||||||
@@ -173,17 +160,19 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeSingleSwap(
|
function encodeSingleSwap(address executor, bytes memory protocolData)
|
||||||
address executor,
|
internal
|
||||||
bytes memory protocolData
|
pure
|
||||||
) internal pure returns (bytes memory) {
|
returns (bytes memory)
|
||||||
|
{
|
||||||
return abi.encodePacked(executor, protocolData);
|
return abi.encodePacked(executor, protocolData);
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeSequentialSwap(
|
function encodeSequentialSwap(address executor, bytes memory protocolData)
|
||||||
address executor,
|
internal
|
||||||
bytes memory protocolData
|
pure
|
||||||
) internal pure returns (bytes memory) {
|
returns (bytes memory)
|
||||||
|
{
|
||||||
return abi.encodePacked(executor, protocolData);
|
return abi.encodePacked(executor, protocolData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,13 +183,8 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
|
|||||||
address executor,
|
address executor,
|
||||||
bytes memory protocolData
|
bytes memory protocolData
|
||||||
) internal pure returns (bytes memory) {
|
) internal pure returns (bytes memory) {
|
||||||
return
|
return abi.encodePacked(
|
||||||
abi.encodePacked(
|
tokenInIndex, tokenOutIndex, split, executor, protocolData
|
||||||
tokenInIndex,
|
|
||||||
tokenOutIndex,
|
|
||||||
split,
|
|
||||||
executor,
|
|
||||||
protocolData
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,8 +208,7 @@ contract TychoRouterTestSetup is Constants, Permit2TestHelper, TestUtils {
|
|||||||
RestrictTransferFrom.TransferType transferType
|
RestrictTransferFrom.TransferType transferType
|
||||||
) internal view returns (bytes memory) {
|
) internal view returns (bytes memory) {
|
||||||
IUniswapV3Pool pool = IUniswapV3Pool(target);
|
IUniswapV3Pool pool = IUniswapV3Pool(target);
|
||||||
return
|
return abi.encodePacked(
|
||||||
abi.encodePacked(
|
|
||||||
tokenIn,
|
tokenIn,
|
||||||
tokenOut,
|
tokenOut,
|
||||||
pool.fee(),
|
pool.fee(),
|
||||||
|
|||||||
Reference in New Issue
Block a user