Skip to content
Lattice

SessionKeyLib Constants

Git Source

SESSION_KEY_STORAGE_SLOT

keccak256(abi.encode(uint256(keccak256("lattice.storage.SessionKey")) - 1)) & ~bytes32(uint256(0xff)).

bytes32 constant SESSION_KEY_STORAGE_SLOT = 0xd72f45b3818762a6cc49804ed52c577908badd7fff8bbd7849829b4fc764ae00;

ANY_TARGET

Wildcard sentinels: a permission registered with ANY_TARGET matches any target except the account itself; with ANY_SELECTOR, any selector.

address constant ANY_TARGET = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;

ANY_SELECTOR

bytes4 constant ANY_SELECTOR = 0xffffffff;

NATIVE_TOKEN

Native-value spend sentinel (the conventional "ETH" pseudo-address).

address constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

_ERC20_TRANSFER

ERC-20 selectors used for direct-transfer spend accounting.

bytes4 constant _ERC20_TRANSFER = 0xa9059cbb;

_ERC20_TRANSFER_FROM

bytes4 constant _ERC20_TRANSFER_FROM = 0x23b872dd;

_ERC20_APPROVE

Allowance-granting ERC-20 selectors. On a capped token they are reset to 0 after a session-key batch.

bytes4 constant _ERC20_APPROVE = 0x095ea7b3;

_ERC20_INCREASE_ALLOWANCE

bytes4 constant _ERC20_INCREASE_ALLOWANCE = 0x39509351;

_PERMIT2_APPROVE

Approval selectors a session key may not call over a token it has a cap on.

bytes4 constant _PERMIT2_APPROVE = 0x87517c45;

_SET_APPROVAL_FOR_ALL

bytes4 constant _SET_APPROVAL_FOR_ALL = 0xa22cb465;

_UNMEASURABLE

Sentinel for a capped token whose balance cannot be read (non-contract / reverting / malformed balanceOf). Balance-diff then defers to the calldata sum for that token instead of reverting and bricking the key. A real balance can never equal this (token supplies are far below 2^256 - 1).

uint256 constant _UNMEASURABLE = type(uint256).max;