Skip to main content
Helpful?

PositionInfoLibrary

Git Source | Generated with forge doc

State Variables

EMPTY_POSITION_INFO

PositionInfo internal constant EMPTY_POSITION_INFO = PositionInfo.wrap(0);

MASK_UPPER_200_BITS

uint256 internal constant MASK_UPPER_200_BITS = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000;

MASK_8_BITS

uint256 internal constant MASK_8_BITS = 0xFF;

MASK_24_BITS

uint24 internal constant MASK_24_BITS = 0xFFFFFF;

SET_UNSUBSCRIBE

uint256 internal constant SET_UNSUBSCRIBE = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00;

SET_SUBSCRIBE

uint256 internal constant SET_SUBSCRIBE = 0x01;

TICK_LOWER_OFFSET

uint8 internal constant TICK_LOWER_OFFSET = 8;

TICK_UPPER_OFFSET

uint8 internal constant TICK_UPPER_OFFSET = 32;

Functions

poolId

This poolId is NOT compatible with the poolId used in UniswapV4 core. It is truncated to 25 bytes, and just used to lookup PoolKey in the poolKeys mapping.

function poolId(PositionInfo info) internal pure returns (bytes25 _poolId);

tickLower

function tickLower(PositionInfo info) internal pure returns (int24 _tickLower);

tickUpper

function tickUpper(PositionInfo info) internal pure returns (int24 _tickUpper);

hasSubscriber

function hasSubscriber(PositionInfo info) internal pure returns (bool _hasSubscriber);

setSubscribe

this does not actually set any storage

function setSubscribe(PositionInfo info) internal pure returns (PositionInfo _info);

setUnsubscribe

this does not actually set any storage

function setUnsubscribe(PositionInfo info) internal pure returns (PositionInfo _info);

initialize

Creates the default PositionInfo struct

Called when minting a new position

function initialize(PoolKey memory _poolKey, int24 _tickLower, int24 _tickUpper)
internal
pure
returns (PositionInfo info);

Parameters

NameTypeDescription
_poolKeyPoolKeythe pool key of the position
_tickLowerint24the lower tick of the position
_tickUpperint24the upper tick of the position

Returns

NameTypeDescription
infoPositionInfopacked position info, with the truncated poolId and the hasSubscriber flag set to false
Helpful?