github.com/status-im/status-go@v1.1.0/contracts/uniswapV3/interfaces/pool/IUniswapV3PoolActions.sol (about)

     1  // SPDX-License-Identifier: GPL-2.0-or-later
     2  pragma solidity >=0.5.0;
     3  
     4  /// @title Permissionless pool actions
     5  /// @notice Contains pool methods that can be called by anyone
     6  interface IUniswapV3PoolActions {
     7      /// @notice Sets the initial price for the pool
     8      /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
     9      /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    10      function initialize(uint160 sqrtPriceX96) external;
    11  
    12      /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    13      /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    14      /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    15      /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    16      /// @param recipient The address for which the liquidity will be created
    17      /// @param tickLower The lower tick of the position in which to add liquidity
    18      /// @param tickUpper The upper tick of the position in which to add liquidity
    19      /// @param amount The amount of liquidity to mint
    20      /// @param data Any data that should be passed through to the callback
    21      /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    22      /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    23      function mint(
    24          address recipient,
    25          int24 tickLower,
    26          int24 tickUpper,
    27          uint128 amount,
    28          bytes calldata data
    29      ) external returns (uint256 amount0, uint256 amount1);
    30  
    31      /// @notice Collects tokens owed to a position
    32      /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    33      /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    34      /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    35      /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    36      /// @param recipient The address which should receive the fees collected
    37      /// @param tickLower The lower tick of the position for which to collect fees
    38      /// @param tickUpper The upper tick of the position for which to collect fees
    39      /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    40      /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    41      /// @return amount0 The amount of fees collected in token0
    42      /// @return amount1 The amount of fees collected in token1
    43      function collect(
    44          address recipient,
    45          int24 tickLower,
    46          int24 tickUpper,
    47          uint128 amount0Requested,
    48          uint128 amount1Requested
    49      ) external returns (uint128 amount0, uint128 amount1);
    50  
    51      /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    52      /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    53      /// @dev Fees must be collected separately via a call to #collect
    54      /// @param tickLower The lower tick of the position for which to burn liquidity
    55      /// @param tickUpper The upper tick of the position for which to burn liquidity
    56      /// @param amount How much liquidity to burn
    57      /// @return amount0 The amount of token0 sent to the recipient
    58      /// @return amount1 The amount of token1 sent to the recipient
    59      function burn(
    60          int24 tickLower,
    61          int24 tickUpper,
    62          uint128 amount
    63      ) external returns (uint256 amount0, uint256 amount1);
    64  
    65      /// @notice Swap token0 for token1, or token1 for token0
    66      /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    67      /// @param recipient The address to receive the output of the swap
    68      /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    69      /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    70      /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    71      /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    72      /// @param data Any data to be passed through to the callback
    73      /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    74      /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    75      function swap(
    76          address recipient,
    77          bool zeroForOne,
    78          int256 amountSpecified,
    79          uint160 sqrtPriceLimitX96,
    80          bytes calldata data
    81      ) external returns (int256 amount0, int256 amount1);
    82  
    83      /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    84      /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    85      /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    86      /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    87      /// @param recipient The address which will receive the token0 and token1 amounts
    88      /// @param amount0 The amount of token0 to send
    89      /// @param amount1 The amount of token1 to send
    90      /// @param data Any data to be passed through to the callback
    91      function flash(
    92          address recipient,
    93          uint256 amount0,
    94          uint256 amount1,
    95          bytes calldata data
    96      ) external;
    97  
    98      /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    99      /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
   100      /// the input observationCardinalityNext.
   101      /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
   102      function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
   103  }