feat: Proper USV2Executor transfer decoding + tests

- Properly decode, update tests with proper decoding
- Added test case for each transfer method
- Also fully tested permit2 transferFrom and it works perfectly.

TODO:
- Fix integration tests once encoding is implemented.
This commit is contained in:
TAMARA LIPOWSKI
2025-04-07 20:42:54 -04:00
committed by Diana Carvalho
parent 8969186654
commit ca1d474f08
5 changed files with 216 additions and 24 deletions

View File

@@ -70,15 +70,14 @@ contract UniswapV2Executor is IExecutor, ExecutorTransferMethods {
TransferMethod method
)
{
if (data.length != 61) {
if (data.length != 62) {
revert UniswapV2Executor__InvalidDataLength();
}
inToken = IERC20(address(bytes20(data[0:20])));
target = address(bytes20(data[20:40]));
receiver = address(bytes20(data[40:60]));
zeroForOne = uint8(data[60]) > 0;
// TODO properly decode, assume encoded using just 1 byte.
method = TransferMethod.TRANSFER;
method = TransferMethod(uint8(data[61]));
}
function _getAmountOut(address target, uint256 amountIn, bool zeroForOne)