feat: allow to pass msg.sender to USV3 callback

- So that we can possibly do a transferFrom
- This should still be safe since the user can't control what is passed here
This commit is contained in:
TAMARA LIPOWSKI
2025-03-13 12:19:55 -04:00
committed by Diana Carvalho
parent 389009901e
commit 8969186654
4 changed files with 10 additions and 6 deletions

View File

@@ -102,14 +102,14 @@ contract UniswapV3Executor is IExecutor, ICallback, ExecutorTransferMethods {
"InvalidTransferMethod"
);
TransferMethod method = TransferMethod(uint8(msgData[171]));
address sender = address(bytes20(msgData[172:192]));
verifyCallback(msgData[132:]);
uint256 amountOwed =
amount0Delta > 0 ? uint256(amount0Delta) : uint256(amount1Delta);
// TODO This must never be a safeTransfer. Figure out how to ensure this.
_transfer(IERC20(tokenIn), msg.sender, amountOwed, method);
_transfer(IERC20(tokenIn), sender, msg.sender, amountOwed, method);
return abi.encode(amountOwed, tokenIn);
}
@@ -167,7 +167,9 @@ contract UniswapV3Executor is IExecutor, ICallback, ExecutorTransferMethods {
uint24 fee,
TransferMethod method
) internal pure returns (bytes memory) {
return abi.encodePacked(tokenIn, tokenOut, fee, uint8(method), self);
return abi.encodePacked(
tokenIn, tokenOut, fee, uint8(method), msg.sender, self
);
}
function _verifyPairAddress(