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

delegation_manager.gno

Types

DelegationManager

DelegationManager manages the mapping between users and their delegation IDs. It provides efficient lookup and management of user delegations organized by delegator and delegatee addresses.

source

Methods

AddDelegationID

AddDelegationID appends a delegation ID to the delegator-delegatee pair, skipping duplicates. The whole get-modify-set runs inside this domain method so the nested BPTree mutation never escapes the owning realm. Performing the lookup in one realm and the write in another (e.g. re-fetching the inner tree across a realm boundary and mutating it) would hit the cross-realm write guard for the persisted leaf slot.

Parameters

Name
Type
Description

delegator

string

delegator address string used to select the nested tree.

delegatee

string

delegatee address string used as the nested-tree key.

delegationID

int64

delegation ID to append when it is not already present.

source

GetDelegationIDs

GetDelegationIDs returns IDs recorded for one delegator/delegatee pair.

Parameters

Name
Type
Description

delegator

string

delegator address string used to select the nested tree.

delegatee

string

delegatee address string used as the nested-tree key.

Return Values

Name
Type
Description

[]int64

[]int64

delegation IDs stored for the pair.

bool

bool

true when the pair exists with a valid ID slice.

source

GetDelegatorDelegations

GetDelegatorDelegations returns the delegatee tree for one delegator.

Parameters

Name
Type
Description

delegator

string

delegator address string used as the root-tree key.

Return Values

Name
Type
Description

*bptree.BPTree

*bptree.BPTree

delegatee-to-delegation-ID tree when present and correctly typed.

bool

bool

true when the delegator entry exists with the expected tree type.

source

GetUserDelegations

GetUserDelegations returns the entire user delegations tree.

Return Values

Name
Type
Description

*bptree.BPTree

*bptree.BPTree

tree keyed by delegator address string.

source

RemoveDelegationID

RemoveDelegationID removes a delegation ID from the delegator-delegatee pair. Like AddDelegationID, the read-modify-write is kept inside this domain method. RemoveDelegationID removes one ID from a delegator/delegatee pair. Missing pairs and IDs are left unchanged.

Parameters

Name
Type
Description

delegator

string

delegator address string used to select the nested tree.

delegatee

string

delegatee address string used as the nested-tree key.

delegationID

int64

delegation ID to remove when it is present.

source

SetDelegationIDs

SetDelegationIDs stores the complete ID slice for a delegator/delegatee pair. A missing delegator entry is initialized with a new nested tree.

Parameters

Name
Type
Description

delegator

string

delegator address string used to select or create the nested tree.

delegatee

string

delegatee address string used as the nested-tree key.

ids

[]int64

delegation IDs to store for the pair.

source

SetUserDelegations

SetUserDelegations replaces the root delegator-to-delegations tree.

Parameters

Name
Type
Description

userDelegations

*bptree.BPTree

tree keyed by delegator address string and containing delegatee trees.

source

Constructors

  • func NewDelegationManager() *DelegationManager (source)

Last updated