Function: uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, byte[] _data)
This is the callback implementation for UniswapV3 pools.
Inputs
amount0DeltaConstraints: Either one of
amount0Deltaoramount1Deltashould be greater than zero.Impact: The amount of
token0received.
amount1DeltaConstraints: Either one of
amount0Deltaoramount1Deltashould be greater than zero.Impact: The amount of
token1received.
_dataConstraints: Should correctly decode to
tokenIn,tokenOut, andfee.Impact: The encoded pool address, fee, and
tokenOutaddress.
Branches and code coverage (including function calls)
Intended branches
The function requires either
amount0Deltaoramount1Deltato be greater than zero.
Negative behaviour
The function reverts if neither
amount0Deltanoramount1Deltaare greater than zero.The function reverts if the caller is the incorrect pool.
Function call analysis
decodePool(_data)What is controllable?
_data.If return value controllable, how is it used and how can it go wrong? The return value is used to extract
tokenIn,tokenOut, andfee; if manipulated, it could lead to incorrect token transfers.What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.
getPool(tokenIn, tokenOut, fee)What is controllable?
tokenIn,tokenOut, andfee.If return value controllable, how is it used and how can it go wrong? The return value is used as the caller of the function; if manipulated, an incorrect pool could be considered as the caller.
What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.
SafeTransferLib.safeTransfer(ERC20(tokenIn), msg.sender, amount0Delta > 0 ? uint256(amount0Delta) : uint256(amount1Delta))What is controllable?
tokenIn,msg.sender,amount0Delta, andamount1Delta.If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.