icreward

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeVoted int = iota
	TypeDelegating
	TypeBonding
	TypeIScore
)

Variables

View Source
var (
	VotedKey      = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x10})
	DelegatingKey = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x20})
	BondingKey    = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x30})
	IScoreKey     = containerdb.ToKey(containerdb.RLPBuilder, []byte{0x40})
)

Functions

func NewObjectImpl

func NewObjectImpl(tag icobject.Tag) (icobject.Impl, error)

Types

type Bonding

type Bonding struct {
	icobject.NoDatabase
	icstate.Bonds
}

func NewBonding

func NewBonding() *Bonding

func ToBonding

func ToBonding(obj trie.Object) *Bonding

func (*Bonding) ApplyVotes

func (d *Bonding) ApplyVotes(deltas icstage.VoteList) error

func (*Bonding) Clone

func (d *Bonding) Clone() *Bonding

func (*Bonding) Equal

func (d *Bonding) Equal(o icobject.Impl) bool

func (*Bonding) IsEmpty

func (d *Bonding) IsEmpty() bool

func (*Bonding) RLPDecodeFields

func (d *Bonding) RLPDecodeFields(decoder codec.Decoder) error

func (*Bonding) RLPEncodeFields

func (d *Bonding) RLPEncodeFields(encoder codec.Encoder) error

func (*Bonding) Version

func (d *Bonding) Version() int

type Delegating

type Delegating struct {
	icobject.NoDatabase
	icstate.Delegations
}

func NewDelegating

func NewDelegating() *Delegating

func ToDelegating

func ToDelegating(obj trie.Object) *Delegating

func (*Delegating) ApplyVotes

func (d *Delegating) ApplyVotes(deltas icstage.VoteList) error

func (*Delegating) Clone

func (d *Delegating) Clone() *Delegating

func (*Delegating) Equal

func (d *Delegating) Equal(o icobject.Impl) bool

func (*Delegating) IsEmpty

func (d *Delegating) IsEmpty() bool

func (*Delegating) RLPDecodeFields

func (d *Delegating) RLPDecodeFields(decoder codec.Decoder) error

func (*Delegating) RLPEncodeFields

func (d *Delegating) RLPEncodeFields(encoder codec.Encoder) error

func (*Delegating) Version

func (d *Delegating) Version() int

type IScore

type IScore struct {
	icobject.ObjectBigInt
}

func NewIScore

func NewIScore() *IScore

func ToIScore

func ToIScore(obj trie.Object) *IScore

func (*IScore) Added

func (is *IScore) Added(amount *big.Int) *IScore

func (*IScore) Clone

func (is *IScore) Clone() *IScore

func (*IScore) Equal

func (is *IScore) Equal(o icobject.Impl) bool

type Snapshot

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

func NewSnapshot

func NewSnapshot(database db.Database, hash []byte) *Snapshot

func NewSnapshotWithBuilder

func NewSnapshotWithBuilder(builder merkle.Builder, hash []byte) *Snapshot

func (*Snapshot) Bytes

func (ss *Snapshot) Bytes() []byte

func (*Snapshot) Filter

func (ss *Snapshot) Filter(prefix []byte) trie.IteratorForObject

func (*Snapshot) Flush

func (ss *Snapshot) Flush() error

func (*Snapshot) NewState

func (ss *Snapshot) NewState() *State

type State

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

func NewState

func NewState(database db.Database, hash []byte) *State

func NewStateFromSnapshot

func NewStateFromSnapshot(ss *Snapshot) *State

func (*State) DeleteBonding

func (s *State) DeleteBonding(addr module.Address) error

func (*State) DeleteDelegating

func (s *State) DeleteDelegating(addr module.Address) error

func (*State) DeleteIScore

func (s *State) DeleteIScore(addr module.Address) error

func (*State) DeleteVoted

func (s *State) DeleteVoted(addr module.Address) error

func (*State) GetBonding

func (s *State) GetBonding(addr module.Address) (*Bonding, error)

func (*State) GetDelegating

func (s *State) GetDelegating(addr module.Address) (*Delegating, error)

func (*State) GetIScore

func (s *State) GetIScore(addr module.Address) (*IScore, error)

func (*State) GetSnapshot

func (s *State) GetSnapshot() *Snapshot

func (*State) GetVoted

func (s *State) GetVoted(addr module.Address) (*Voted, error)

func (*State) Reset

func (s *State) Reset(ss *Snapshot)

func (*State) SetBonding

func (s *State) SetBonding(addr module.Address, bonding *Bonding) error

func (*State) SetDelegating

func (s *State) SetDelegating(addr module.Address, delegating *Delegating) error

func (*State) SetIScore

func (s *State) SetIScore(addr module.Address, iScore *IScore) error

func (*State) SetVoted

func (s *State) SetVoted(addr module.Address, voted *Voted) error

type Voted

type Voted struct {
	icobject.NoDatabase
	Enable           bool     // update via ENABLE event
	Delegated        *big.Int // update via DELEGATE event
	Bonded           *big.Int // update via BOND event
	BondedDelegation *big.Int // update when start calculation for P-Rep voted reward
}

func NewVoted

func NewVoted() *Voted

func ToVoted

func ToVoted(obj trie.Object) *Voted

func (*Voted) Clone

func (v *Voted) Clone() *Voted

func (*Voted) Equal

func (v *Voted) Equal(o icobject.Impl) bool

func (*Voted) GetVoted

func (v *Voted) GetVoted() *big.Int

func (*Voted) IsEmpty

func (v *Voted) IsEmpty() bool

func (*Voted) RLPDecodeFields

func (v *Voted) RLPDecodeFields(decoder codec.Decoder) error

func (*Voted) RLPEncodeFields

func (v *Voted) RLPEncodeFields(encoder codec.Encoder) error

func (*Voted) SetBonded

func (v *Voted) SetBonded(bonded *big.Int)

func (*Voted) SetEnable

func (v *Voted) SetEnable(enable bool)

func (*Voted) UpdateBondedDelegation

func (v *Voted) UpdateBondedDelegation(bondRequirement int)

func (*Voted) Version

func (v *Voted) Version() int

type Voting

type Voting interface {
	Iterator() icstate.VotingIterator
	ApplyVotes(deltas icstage.VoteList) error
}

Jump to

Keyboard shortcuts

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