Skip to content
Lattice

SessionKeyStorage

Git Source

ERC-7201 namespaced storage for session keys.

Note:

  • storage-location: erc7201:lattice.storage.SessionKey
struct SessionKeyStorage {
    /// @notice Validity window per key. APPEND-ONLY.
    mapping(address key => SessionKeyData) _keys;
    /// @notice Allowlist: `_allowed[key][_permHash(target, selector, _epoch[key])]`; epoch 0 keeps the original
    ///         `keccak256(abi.encode(target, selector))` hash. APPEND-ONLY.
    mapping(address key => mapping(bytes32 permHash => bool)) _allowed;
    /// @notice Per-token cumulative spend caps. APPEND-ONLY.
    mapping(address key => mapping(address token => SpendLimit)) _spend;
    /// @notice Distinct tokens with a configured cap per key, so a batch's actual balance decrease can be
    ///         settled against every capped token (balance-diff accounting). APPEND-ONLY.
    mapping(address key => address[]) _cappedTokens;
    /// @notice Grant generation per key. {SessionKeyLib.revokeSessionKey} bumps it so the key's earlier
    ///         `_allowed` entries stop matching. APPEND-ONLY.
    mapping(address key => uint256) _epoch;
}

Properties

NameTypeDescription
_keysmapping(address key => SessionKeyData)
_allowedmapping(address key => mapping(bytes32 permHash => bool))
_spendmapping(address key => mapping(address token => SpendLimit))
_cappedTokensmapping(address key => address[])
_epochmapping(address key => uint256)