Skip to main content

CCIPTokenPoolConfigKeyLib

Git Source

Title: CCIPTokenPoolConfigKeyLib

Derives the configuration domains and keys of CCIPTokenPoolConfigTimelock: the four domain constants, the destination-local key of each domain, and the destination-scoped key that the timelock reserves and that pendingActionId takes, scoped to the config policy the timelock is bound to.

A route contributes three domains, keyed per chain selector; the allowlist is one pool-wide domain whose local key is the domain constant itself. Shared by the timelock and the tooling that reads its reservations, so that both compute a key with one formula.

Constants​

RATE_LIMITS_DOMAIN​

The domain of the rate limits of a route: isEnabled, capacity and rate of both buckets.

bytes32 internal constant RATE_LIMITS_DOMAIN = keccak256("CCIP_TOKEN_POOL_CONFIG_RATE_LIMITS");

REMOTE_POOLS_DOMAIN​

The domain of the accepted remote pools of a route.

bytes32 internal constant REMOTE_POOLS_DOMAIN =
keccak256("CCIP_TOKEN_POOL_CONFIG_REMOTE_POOLS");

ROUTE_IDENTITY_DOMAIN​

The domain of the identity of a route: whether the route exists and its remote token.

bytes32 internal constant ROUTE_IDENTITY_DOMAIN =
keccak256("CCIP_TOKEN_POOL_CONFIG_ROUTE_IDENTITY");

ALLOWLIST_DOMAIN​

The domain of the pool-wide sender allowlist.

bytes32 internal constant ALLOWLIST_DOMAIN = keccak256("CCIP_TOKEN_POOL_CONFIG_ALLOWLIST");

Functions​

routeLocalKey​

Returns the destination-local key of a route domain.

function routeLocalKey(
bytes32 domain_,
uint64 chainSelector_
) internal pure returns (bytes32 localKey);

Parameters

NameTypeDescription
domain_bytes32The domain constant.
chainSelector_uint64The chain selector of the route.

Returns

NameTypeDescription
localKeybytes32The key keccak256(abi.encode(domain_, chainSelector_)).

rateLimitsLocalKey​

Returns the destination-local key of the rate limits domain of a route.

function rateLimitsLocalKey(uint64 chainSelector_) internal pure returns (bytes32 localKey);

Parameters

NameTypeDescription
chainSelector_uint64The chain selector of the route.

Returns

NameTypeDescription
localKeybytes32The local key.

remotePoolsLocalKey​

Returns the destination-local key of the remote pools domain of a route.

function remotePoolsLocalKey(uint64 chainSelector_) internal pure returns (bytes32 localKey);

Parameters

NameTypeDescription
chainSelector_uint64The chain selector of the route.

Returns

NameTypeDescription
localKeybytes32The local key.

routeIdentityLocalKey​

Returns the destination-local key of the identity domain of a route.

function routeIdentityLocalKey(uint64 chainSelector_) internal pure returns (bytes32 localKey);

Parameters

NameTypeDescription
chainSelector_uint64The chain selector of the route.

Returns

NameTypeDescription
localKeybytes32The local key.

allowListLocalKey​

Returns the destination-local key of the allowlist domain: the domain constant itself, since the domain has no chain selector.

function allowListLocalKey() internal pure returns (bytes32 localKey);

Returns

NameTypeDescription
localKeybytes32The local key.

rateLimitsKey​

Returns the reserved key of the rate limits domain of a route.

function rateLimitsKey(
address config_,
uint64 chainSelector_
) internal pure returns (bytes32 key);

Parameters

NameTypeDescription
config_addressThe config policy the timelock is bound to.
chainSelector_uint64The chain selector of the route.

Returns

NameTypeDescription
keybytes32The destination-scoped key.

remotePoolsKey​

Returns the reserved key of the remote pools domain of a route.

function remotePoolsKey(
address config_,
uint64 chainSelector_
) internal pure returns (bytes32 key);

Parameters

NameTypeDescription
config_addressThe config policy the timelock is bound to.
chainSelector_uint64The chain selector of the route.

Returns

NameTypeDescription
keybytes32The destination-scoped key.

routeIdentityKey​

Returns the reserved key of the identity domain of a route.

function routeIdentityKey(
address config_,
uint64 chainSelector_
) internal pure returns (bytes32 key);

Parameters

NameTypeDescription
config_addressThe config policy the timelock is bound to.
chainSelector_uint64The chain selector of the route.

Returns

NameTypeDescription
keybytes32The destination-scoped key.

allowListKey​

Returns the reserved key of the allowlist domain.

function allowListKey(address config_) internal pure returns (bytes32 key);

Parameters

NameTypeDescription
config_addressThe config policy the timelock is bound to.

Returns

NameTypeDescription
keybytes32The destination-scoped key.