The primary state storage packed into a single slot:
Fee Accumulators
Global fee accumulation per unit of liquidity, in Q128.128 format.
Protocol Fees
Liquidity
Currently active liquidity (positions covering the current tick).
Ticks
Tick Bitmap
Positions
Observations
Functions
initialize
Sets the initial price for the pool. Can only be called once.
Access Control: Only callable by factory owner
Parameters:
Name
Type
Description
sqrtPriceX96
uint160
Initial √price in Q64.96 format
Requirements:
Caller must be factory owner
Pool must not already be initialized
sqrtPriceX96 must be within valid tick range
Events Emitted:
Initialize(sqrtPriceX96, tick)
Example:
mint
Adds liquidity to a position.
Parameters:
Name
Type
Description
recipient
address
Position owner
tickLower
int24
Lower tick boundary
tickUpper
int24
Upper tick boundary
amount
uint128
Liquidity amount to add
data
bytes
Callback data
Returns:
Name
Type
Description
amount0
uint256
Token0 amount required
amount1
uint256
Token1 amount required
Callback: The pool calls IUniswapV3MintCallback.uniswapV3MintCallback(amount0, amount1, data) on msg.sender. The caller must transfer the required tokens to the pool in this callback.
Note: VinuSwap uses Uniswap V3's callback interfaces for compatibility.
Less than current price, greater than MIN_SQRT_RATIO
zeroForOne = false
Greater than current price, less than MAX_SQRT_RATIO
Callback: The pool calls IUniswapV3SwapCallback.uniswapV3SwapCallback(amount0, amount1, data) on msg.sender. The caller must transfer the required input tokens to the pool.
struct Slot0 {
// Current sqrt(price) as Q64.96
uint160 sqrtPriceX96;
// Current tick
int24 tick;
// Most recent observation index
uint16 observationIndex;
// Maximum observations stored
uint16 observationCardinality;
// Next maximum observations
uint16 observationCardinalityNext;
// Protocol fee (4 bits each for token0/token1)
uint8 feeProtocol;
// Reentrancy lock
bool unlocked;
}
Slot0 public override slot0;
uint256 public override feeGrowthGlobal0X128;
uint256 public override feeGrowthGlobal1X128;