Skip to main content

position_key

Function position_key 

Source
pub fn position_key(
    owner: Address,
    index: Uint<256, 4>,
    tick_lower: i32,
    tick_upper: i32,
) -> FixedBytes<32>
Expand description

Compute the Ramses-family pool position key.

keccak256(abi.encodePacked(owner, index, tick_lower, tick_upper)) — 20 + 32 + 3 + 3 = 58 bytes. Verified against RamsesExchange/ramses-v3-contracts/contracts/CL/core/libraries/Position.sol and contracts/CL/periphery/libraries/PositionKey.sol on 2026-04-28.

For NFPM-managed positions, owner is the NFPM contract address and index is the NFT tokenId. Raw pool depositors pass their own (owner, index).

Panics if either tick is outside the int24 range [-2^23, 2^23 - 1] — out-of-range ticks would silently truncate in i24_to_be_bytes and produce a wrong hash. Realistic Uniswap-style ticks live well inside int24 (±887_272).