account

package
v1.0.0-beta.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accounts

type Accounts struct {
	// contains filtered or unexported fields
}

Accounts represent a collection of accounts and their pools.

func AccountsFromBytes

func AccountsFromBytes(b []byte) (*Accounts, int, error)

func AccountsFromReader

func AccountsFromReader(reader io.Reader) (*Accounts, error)

func NewAccounts

func NewAccounts() *Accounts

NewAccounts creates a new Weights instance.

func (*Accounts) Bytes

func (a *Accounts) Bytes() ([]byte, error)

func (*Accounts) ForEach

func (a *Accounts) ForEach(callback func(id iotago.AccountID, pool *Pool) bool)

ForEach iterates over all weights and calls the given callback for each of them.

func (*Accounts) Get

func (a *Accounts) Get(id iotago.AccountID) (pool *Pool, exists bool)

Get returns the weight of the given identity.

func (*Accounts) Has

func (a *Accounts) Has(id iotago.AccountID) bool

func (*Accounts) IDs

func (a *Accounts) IDs() []iotago.AccountID

func (*Accounts) SeatedAccounts

func (a *Accounts) SeatedAccounts(optPrevCommittee ...*SeatedAccounts) *SeatedAccounts

SeatedAccounts creates a new SeatedAccounts instance, that maintains the seat indices of re-elected members from the previous committee, if provided.

func (*Accounts) Set

func (a *Accounts) Set(id iotago.AccountID, pool *Pool) error

Set sets the weight of the given identity.

func (*Accounts) Size

func (a *Accounts) Size() int

func (*Accounts) TotalStake

func (a *Accounts) TotalStake() iotago.BaseToken

func (*Accounts) TotalValidatorStake

func (a *Accounts) TotalValidatorStake() iotago.BaseToken

type Pool

type Pool struct {
	// Total stake of the pool, including delegators
	PoolStake iotago.BaseToken
	// Validator's stake
	ValidatorStake iotago.BaseToken
	FixedCost      iotago.Mana
}

Pool represents all the data we need for a given validator and epoch to calculate its rewards data.

func PoolFromBytes

func PoolFromBytes(bytes []byte) (*Pool, int, error)

func (*Pool) Bytes

func (p *Pool) Bytes() ([]byte, error)

type SeatIndex

type SeatIndex uint8

func SeatIndexFromBytes

func SeatIndexFromBytes(b []byte) (SeatIndex, int, error)

func (SeatIndex) Bytes

func (s SeatIndex) Bytes() ([]byte, error)

type SeatedAccounts

type SeatedAccounts struct {
	// contains filtered or unexported fields
}

func NewSeatedAccounts

func NewSeatedAccounts(accounts *Accounts, optMembers ...iotago.AccountID) *SeatedAccounts

func SeatedAccountsFromBytes

func SeatedAccountsFromBytes(b []byte) (*SeatedAccounts, int, error)

func SeatedAccountsFromReader

func SeatedAccountsFromReader(reader io.Reader) (*SeatedAccounts, error)

func (*SeatedAccounts) Accounts

func (s *SeatedAccounts) Accounts() (*Accounts, error)

func (*SeatedAccounts) Bytes

func (s *SeatedAccounts) Bytes() ([]byte, error)

func (*SeatedAccounts) Delete

func (s *SeatedAccounts) Delete(id iotago.AccountID) bool

func (*SeatedAccounts) GetSeat

func (s *SeatedAccounts) GetSeat(id iotago.AccountID) (seat SeatIndex, exists bool)

func (*SeatedAccounts) HasAccount

func (s *SeatedAccounts) HasAccount(id iotago.AccountID) (has bool)

func (*SeatedAccounts) IDs

func (s *SeatedAccounts) IDs() []iotago.AccountID

func (*SeatedAccounts) IsReused

func (s *SeatedAccounts) IsReused() bool

func (*SeatedAccounts) Reuse

func (s *SeatedAccounts) Reuse() (*SeatedAccounts, error)

func (*SeatedAccounts) SeatCount

func (s *SeatedAccounts) SeatCount() int

func (*SeatedAccounts) Set

func (s *SeatedAccounts) Set(seat SeatIndex, id iotago.AccountID) bool

func (*SeatedAccounts) SetReused

func (s *SeatedAccounts) SetReused()

func (*SeatedAccounts) String

func (s *SeatedAccounts) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL