For the complete documentation index, see llms.txt. This page is also available as Markdown.

DelegationLib

Overview

License: Apache 2.0

library DelegationLib

Library for managing granular per-selector delegated write access to pool adapters.

All writes maintain two enumerable index structures so callers can enumerate delegations in either direction without iterating unpredictably large arrays.

Functions info

add

function add(
    DelegationData storage self,
    bytes4 selector,
    address addr
) internal returns (bool added)

Grants delegated write access to selector for addr.

Return values:

Name
Type
Description

added

bool

True if the pair was newly granted (false = already existed, no storage change).

remove

Revokes delegated write access to selector for addr.

Return values:

Name
Type
Description

removed

bool

True if the pair was present and removed (false = was not delegated, no storage change).

removeAllByAddress

Revokes all delegations previously granted to addr (e.g. compromised wallet).

Iterates the (short) list of selectors for addr and cleans up both directions.

removeAllBySelector

Revokes all delegations for selector (e.g. adapter being replaced by governance).

Iterates the (short) list of addresses for selector and cleans up both directions.

getAddresses

Returns all addresses currently delegated for selector.

getSelectors

Returns all selectors currently delegated to addr.

Last updated