account

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 13 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) IsReused

func (a *Accounts) IsReused() bool

func (*Accounts) SeatedAccounts

func (a *Accounts) SeatedAccounts(members ...iotago.AccountID) *SeatedAccounts

SeatedAccounts creates a new SeatedAccounts instance, that maintains the seats of the given members.

func (*Accounts) Set

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

Set sets the weight of the given identity.

func (*Accounts) SetReused

func (a *Accounts) SetReused()

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 (*SeatedAccounts) Accounts

func (s *SeatedAccounts) Accounts() (*Accounts, 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) SeatCount

func (s *SeatedAccounts) SeatCount() int

func (*SeatedAccounts) Set

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

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