Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tech.ramses.xyz/llms.txt

Use this file to discover all available pages before exploring further.

These methods compose the pool’s state, and can change with any frequency including multiple times per transaction

Functions

slot0

  function slot0(
  ) external view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint24 feeProtocol, bool unlocked)
The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas when accessed externally.

Return Values:

NameTypeDescription
sqrtPriceX96uint160The current price of the pool as a sqrt(token1/token0) Q64.96 value
tickint24The current tick of the pool, i.e. according to the last tick transition that was run. This value may not always be equal to SqrtTickMath getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick boundary.
observationIndexuint16The index of the last oracle observation that was written,
observationCardinalityuint16The current maximum number of observations stored in the pool,
observationCardinalityNextuint16The next maximum number of observations, to be updated when the observation.
feeProtocoluint24The protocol fee for the pool, denominated in 1e-6 precision. Determines the fraction of swap fees directed to the protocol.
unlockedboolWhether the pool is currently locked to reentrancy

feeGrowthGlobal0X128

  function feeGrowthGlobal0X128(
  ) external view returns (uint256)
The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool This value can overflow the uint256

feeGrowthGlobal1X128

  function feeGrowthGlobal1X128(
  ) external view returns (uint256)
The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool This value can overflow the uint256

grossFeeGrowthGlobal0X128

  function grossFeeGrowthGlobal0X128(
  ) external view returns (uint256)
The gross fee growth of token0 as a Q128.128, tracking fees before protocol fee deduction. Ramses-specific.

grossFeeGrowthGlobal1X128

  function grossFeeGrowthGlobal1X128(
  ) external view returns (uint256)
The gross fee growth of token1 as a Q128.128, tracking fees before protocol fee deduction. Ramses-specific.

protocolFees

  function protocolFees(
  ) external view returns (uint128 token0, uint128 token1)
The amounts of token0 and token1 that are owed to the protocol Protocol fees will never exceed uint128 max in either token

liquidity

  function liquidity(
  ) external view returns (uint128)
The currently in range liquidity available to the pool This value has no relationship to the total liquidity across all ticks

ticks

  function ticks(
    int24 tick
  ) external view returns (uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized)
Look up information about a specific tick in the pool

Parameters:

NameTypeDescription
tickint24The tick to look up

Return Values:

NameTypeDescription
liquidityGrossuint128the total amount of position liquidity that uses the pool either as tick lower or tick upper,
liquidityNetint128how much liquidity changes when the pool price crosses the tick,
feeGrowthOutside0X128uint256the fee growth on the other side of the tick from the current tick in token0,
feeGrowthOutside1X128uint256the fee growth on the other side of the tick from the current tick in token1, feeGrowthOutsideX128 values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. In addition, these values are only relative and are used to compute snapshots.
tickCumulativeOutsideint56
secondsPerLiquidityOutsideX128uint160
secondsOutsideuint32
initializedbool
a specific position.

tickBitmap

  function tickBitmap(
      int16 wordPosition
  ) external view returns (uint256)
Returns 256 packed tick initialized boolean values. See TickBitmap for more information

positions

  function positions(
    bytes32 key
  ) external view returns (uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)
Returns the information about a position by the position’s key In Ramses V3, the position key is computed as: keccak256(abi.encodePacked(owner, index, tickLower, tickUpper)) — note the extra index parameter compared to Uniswap V3.

Parameters:

NameTypeDescription
keybytes32The position’s key is a hash of a preimage composed by the owner, index, tickLower and tickUpper

Return Values:

NameTypeDescription
liquidityuint128The amount of liquidity in the position,
feeGrowthInside0LastX128uint256fee growth of token0 inside the tick range as of the last mint/burn/poke,
feeGrowthInside1LastX128uint256fee growth of token1 inside the tick range as of the last mint/burn/poke,
tokensOwed0uint128the computed amount of token0 owed to the position as of the last mint/burn/poke,
tokensOwed1uint128the computed amount of token1 owed to the position as of the last mint/burn/poke

observations

  function observations(
    uint256 index
  ) external view returns (uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized)
Returns data about a specific observation index 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.

Parameters:

NameTypeDescription
indexuint256The element of the observations array to fetch

Return Values:

NameTypeDescription
blockTimestampuint256The timestamp of the observation,
tickCumulativeint56the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
secondsPerLiquidityCumulativeX128uint160the seconds per in range liquidity for the life of the pool as of the observation timestamp
initializedboolwhether the observation has been initialized and the values are safe to use

positionPeriodSecondsInRange

  function positionPeriodSecondsInRange(
    uint256 period,
    address owner,
    uint256 index,
    int24 tickLower,
    int24 tickUpper
  ) external view returns (uint256 periodSecondsInsideX96)
Returns the seconds a specific position was in range during a given period. Used by GaugeV3 for proportional reward distribution.

Parameters:

NameTypeDescription
perioduint256The period number
owneraddressThe position owner address
indexuint256The position index
tickLowerint24Lower bound of range
tickUpperint24Upper bound of range

Return Values:

NameTypeDescription
periodSecondsInsideX96uint256Seconds the position was in range for the period

periods

The pool maintains an array of period snapshots that store cumulative data per weekly epoch. These are used by the GaugeV3 contract to distribute rewards proportionally based on time-weighted in-range liquidity during each period.