```\nfunction uniswapV3MintCallback(\n    uint256 amount0,\n    uint256 amount1,\n    bytes calldata data\n) external override {\n    require(msg.sender == address(pool));\n    address payer = abi.decode(data, (address));\n\n    if (payer == address(this)) {\n        if (amount0 > 0) token0.safeTransfer(msg.sender, amount0);\n        if (amount1 > 0) token1.safeTransfer(msg.sender, amount1);\n    } else {\n        if (amount0 > 0) token0.safeTransferFrom(payer, msg.sender, amount0);\n        if (amount1 > 0) token1.safeTransferFrom(payer, msg.sender, amount1);\n    }\n}\n\nfunction uniswapV3SwapCallback(\n    int256 amount0Delta,\n    int256 amount1Delta,\n    bytes calldata data\n) external override {\n    require(msg.sender == address(pool));\n    address payer = abi.decode(data, (address));\n\n    if (amount0Delta > 0) {\n        if (payer == address(this)) {\n            token0.safeTransfer(msg.sender, uint256(amount0Delta));\n        } else {\n            token0.safeTransferFrom(payer, msg.sender, uint256(amount0Delta));\n        }\n    } else if (amount1Delta > 0) {\n        if (payer == address(this)) {\n            token1.safeTransfer(msg.sender, uint256(amount1Delta));\n        } else {\n            token1.safeTransferFrom(payer, msg.sender, uint256(amount1Delta));\n        }\n    }\n}\n```\n