IUniswapV3Pool :
The pool interface is broken up into many smaller pieces
burn(int24,int24,uint128) :
Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0Fees must be collected separately via a call to #collect
collect(address,int24,int24,uint128,uint128) :
Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
feeGrowthGlobal0X128() :
This value can overflow the uint256
feeGrowthGlobal1X128() :
This value can overflow the uint256
flash(address,uint256,uint256,bytes) :
The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallbackCan be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling with 0 amount{0,1} and sending the donation amount(s) from the callback
increaseObservationCardinalityNext(uint16) :
This method is no-op if the pool already has an observationCardinalityNext greater than or equal to the input observationCardinalityNext.
initialize(uint160) :
Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
liquidity() :
This value has no relationship to the total liquidity across all ticks
maxLiquidityPerTick() :
This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
mint(address,int24,int24,uint128,bytes) :
The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends on tickLower, tickUpper, the amount of liquidity, and the current price.
observations(uint256) :
You most likely want to use #observe() instead of this method to get an observation as of some amount of time ago, rather than at a specific index in the array.
observe(uint32[]) :
To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, you must call it with secondsAgos = [3600, 0].The time weighted average tick represents the geometric time weighted average price of the pool, in log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
protocolFees() :
Protocol fees will never exceed uint128 max in either token
snapshotCumulativesInside(int24,int24) :
Snapshots must only be compared to other snapshots, taken over a period for which a position existed. I.e., snapshots cannot be compared if a position is not held for the entire period between when the first snapshot is taken and the second snapshot is taken.
swap(address,bool,int256,uint160,bytes) :
The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
tickSpacing() :
Ticks can only be used at multiples of this value, minimum of 1 and always positive e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... This value is an int24 to avoid casting even though it is always positive.
IUniswapV3PoolDeployer :
This is used to avoid having constructor arguments in the pool contract, which results in the init code hash of the pool being constant allowing the CREATE2 address of the pool to be cheaply computed on-chain
parameters() :
Called by the pool constructor to fetch the parameters of the pool Returns factory The factory address Returns token0 The first token of the pool by address sort order Returns token1 The second token of the pool by address sort order Returns fee The fee collected upon every swap in the pool, denominated in hundredths of a bip Returns tickSpacing The minimum number of ticks between initialized ticks
BitMath :
This library provides functionality for computing bit properties of an unsigned integer
FixedPoint96 :
Used in SqrtPriceMath.sol
FullMath :
Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
Oracle :
Instances of stored oracle data, "observations", are collected in the oracle array Every pool is initialized with an oracle array length of 1. Anyone can pay the SSTOREs to increase the maximum length of the oracle array. New slots will be added when the array is fully populated. Observations are overwritten when the full length of the oracle array is populated. The most recent observation is available, independent of the length of the oracle array, by passing 0 to observe()
Position :
Positions store additional state for tracking fees owed to the position
TickBitmap :
The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.