Skip to main content

Lockers

Lockers

This library manages a custom storage implementation for a queue that tracks current lockers. The "sentinel" storage slot for this data structure, always passed in as IPoolManager.LockData storage self, stores not just the current length of the queue but also the global count of non-zero deltas across all lockers. The values of the data structure start at OFFSET, and each value is a locker address.

LOCK_DATA_SLOT

uint256 LOCK_DATA_SLOT

struct LockData { /// @notice The current number of active lockers uint128 length; /// @notice The total number of nonzero deltas over all active + completed lockers uint128 nonzeroDeltaCount; }

LOCKERS_SLOT

uint256 LOCKERS_SLOT

LOCKER_STRUCT_SIZE

uint256 LOCKER_STRUCT_SIZE

HOOK_ADDRESS_SLOT

uint256 HOOK_ADDRESS_SLOT

NONZERO_DELTA_COUNT_OFFSET

uint256 NONZERO_DELTA_COUNT_OFFSET

LENGTH_MASK

uint256 LENGTH_MASK

push

function push(address locker, address lockCaller) internal

Pushes a locker onto the end of the queue, and updates the sentinel storage slot.

lockData

function lockData() internal view returns (uint128 l, uint128 nonzeroDeltaCount)

length

function length() internal view returns (uint128 l)

pop

function pop() internal

Pops a locker off the end of the queue. Note that no storage gets cleared.

getLocker

function getLocker(uint256 i) internal view returns (address locker)

getLockCaller

function getLockCaller(uint256 i) internal view returns (address locker)

getCurrentLocker

function getCurrentLocker() internal view returns (address)

getCurrentLockCaller

function getCurrentLockCaller() internal view returns (address)

incrementNonzeroDeltaCount

function incrementNonzeroDeltaCount() internal

decrementNonzeroDeltaCount

function decrementNonzeroDeltaCount() internal

getCurrentHook

function getCurrentHook() internal view returns (contract IHooks currentHook)

getHook

function getHook(uint256 i) internal view returns (address hook)

setCurrentHook

function setCurrentHook(contract IHooks currentHook) internal returns (bool set)

clearCurrentHook

function clearCurrentHook() internal