feat: Proper USV3Executor 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.

NOTE:
UniswapV3 doesn't support NONE as a transfer method.

TODO:
- Fix integration tests once encoding is implemented.
This commit is contained in:
TAMARA LIPOWSKI
2025-04-08 16:40:01 -04:00
committed by Diana Carvalho
parent 30557e7e54
commit e3ac394d27
4 changed files with 115 additions and 12 deletions

View File

@@ -40,7 +40,7 @@ contract ExecutorTransferMethods {
if (method == TransferMethod.TRANSFER) {
tokenIn.safeTransfer(receiver, amount);
} else if (method == TransferMethod.TRANSFERFROM) {
tokenIn.safeTransferFrom(msg.sender, receiver, amount);
tokenIn.safeTransferFrom(sender, receiver, amount);
} else if (method == TransferMethod.TRANSFERPERMIT2) {
// Permit2.permit is already called from the TychoRouter
permit2.transferFrom(

View File

@@ -149,7 +149,7 @@ contract UniswapV3Executor is IExecutor, ICallback, ExecutorTransferMethods {
TransferMethod method
)
{
if (data.length != 84) {
if (data.length != 85) {
revert UniswapV3Executor__InvalidDataLength();
}
tokenIn = address(bytes20(data[0:20]));
@@ -158,7 +158,7 @@ contract UniswapV3Executor is IExecutor, ICallback, ExecutorTransferMethods {
receiver = address(bytes20(data[43:63]));
target = address(bytes20(data[63:83]));
zeroForOne = uint8(data[83]) > 0;
method = TransferMethod.TRANSFER;
method = TransferMethod(uint8(data[84]));
}
function _makeV3CallbackData(