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

delegation.gno

NewDelegationTree

func NewDelegationTree() *bptree.BPTree

NewDelegationTree creates an empty tree for delegatee-to-delegation-ID mappings.

Return Values

Name
Type
Description

*bptree.BPTree

*bptree.BPTree

empty tree configured for delegation lookup entries.

source

NewUserDelegationTree

NewUserDelegationTree creates an empty tree for user delegation mappings.

Return Values

Name
Type
Description

*bptree.BPTree

*bptree.BPTree

empty tree configured for user delegation entries.

source

Types

Delegation

Delegation represents a delegation between two addresses

source

Methods

AddWithdraw

AddWithdraw appends a withdrawal record to the delegation history.

Parameters

Name
Type
Description

withdraw

DelegationWithdraw

withdrawal record to append, including its amount and unlock timing.

source

Clone

Clone returns a deep copy of the delegation and its withdrawal slice.

Return Values

Name
Type
Description

*Delegation

*Delegation

copied delegation, or nil when the receiver is nil.

source

CollectedAmount

CollectedAmount returns the amount already collected from undelegation.

Return Values

Name
Type
Description

int64

int64

token amount released from this delegation.

source

CreatedAt

CreatedAt returns the Unix timestamp recorded when the delegation was created.

Return Values

Name
Type
Description

int64

int64

creation timestamp in Unix seconds.

source

DelegateFrom

DelegateFrom returns the address that supplied the delegated tokens.

Return Values

Name
Type
Description

address

address

delegator address recorded on the delegation.

source

DelegateTo

DelegateTo returns the address receiving the delegated voting power.

Return Values

Name
Type
Description

address

address

delegatee address recorded on the delegation.

source

ID

Basic getters ID returns the unique identifier of the delegation record.

Return Values

Name
Type
Description

int64

int64

delegation identifier assigned at creation.

source

SetCollectedAmount

SetCollectedAmount replaces the amount already collected from this delegation.

Parameters

Name
Type
Description

amount

int64

released token amount in the smallest token unit.

source

SetUnDelegateAmount

Setters SetUnDelegateAmount replaces the amount currently in undelegation lockup.

Parameters

Name
Type
Description

amount

int64

token amount awaiting collection in the smallest token unit.

source

SetWithdraw

SetWithdraw replaces one withdrawal record at the supplied slice index.

Parameters

Name
Type
Description

index

int

zero-based index of the withdrawal entry to replace.

withdraw

DelegationWithdraw

replacement withdrawal record.

source

SetWithdraws

SetWithdraws replaces the complete withdrawal history.

Parameters

Name
Type
Description

withdraws

[]DelegationWithdraw

withdrawal records to store for this delegation.

source

TotalDelegatedAmount

Amount getters TotalDelegatedAmount returns the current amount still actively delegated.

Return Values

Name
Type
Description

int64

int64

active delegated token amount in the smallest token unit.

source

UnDelegatedAmount

UnDelegatedAmount returns the amount moved into undelegation lockup.

Return Values

Name
Type
Description

int64

int64

token amount awaiting collection after its lockup period.

source

Withdraws

Withdraws getters Withdraws returns the delegation's withdrawal records.

Return Values

Name
Type
Description

[]DelegationWithdraw

[]DelegationWithdraw

withdrawal entries tracked for this delegation.

source

Constructors

  • func NewDelegation(id int64, delegateFrom address, delegateTo address, delegateAmount int64, createdHeight int64, createdAt int64) *Delegation (source)

DelegationType

DelegationType represents the type of delegation operation

source

Methods

IsDelegate

IsDelegate reports whether the operation type is DelegateType.

Return Values

Name
Type
Description

bool

bool

true only when d represents a delegation operation.

source

IsUnDelegate

IsUnDelegate reports whether the operation type is UnDelegateType.

Return Values

Name
Type
Description

bool

bool

true only when d represents an undelegation operation.

source

String

String returns the textual operation name represented by the delegation type.

Return Values

Name
Type
Description

string

string

"DELEGATE", "UNDELEGATE", or the underlying value for another type.

source

Last updated