icstate

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VarIRep                                  = "irep"
	VarRRep                                  = "rrep"
	VarMainPRepCount                         = "main_prep_count"
	VarSubPRepCount                          = "sub_prep_count"
	VarExtraMainPRepCount                    = "extra_main_prep_count"
	VarTotalStake                            = "total_stake"
	VarIISSVersion                           = "iiss_version"
	VarTermPeriod                            = "term_period"
	VarBondRequirement                       = "bond_requirement"
	VarUnbondingPeriodMultiplier             = "unbonding_period_multiplier"
	VarLockMinMultiplier                     = "lockMinMultiplier"
	VarLockMaxMultiplier                     = "lockMaxMultiplier"
	VarRewardFund                            = "reward_fund"
	VarUnbondingMax                          = "unbonding_max"
	VarValidationPenaltyCondition            = "validation_penalty_condition"
	VarConsistentValidationPenaltyCondition  = "consistent_validation_penalty_condition"
	VarConsistentValidationPenaltyMask       = "consistent_validation_penalty_mask"
	VarConsistentValidationPenaltySlashRatio = "consistent_validation_penalty_slashRatio"
	VarDelegationSlotMax                     = "delegation_slot_max"
	DictNetworkScores                        = "network_scores"
	VarNonVotePenaltySlashRatio              = "nonvote_penalty_slashRatio"
)
View Source
const (
	IISSVersion2 int = iota + 2
	IISSVersion3
)
View Source
const (
	CPSKey        = "cps"
	RelayKey      = "relay"
	GovernanceKey = "governance"
)
View Source
const (
	TypeAccount int = iota
	TypePRepBase
	TypePRepStatus
	TypeTimer
	TypeIssue
	TypeTerm
	TypeRewardCalcInfo
	TypeValidators
	TypeBlockVoters
	TypeIllegalDelegation
)

Variables

View Source
var (
	IssueKey          = containerdb.ToKey(containerdb.HashBuilder, "issue_icx").Build()
	RewardCalcInfoKey = containerdb.ToKey(containerdb.HashBuilder, "reward_calc_info").Build()
	ValidatorsKey     = containerdb.ToKey(
		containerdb.HashBuilder, scoredb.VarDBPrefix, "validators",
	)
	UnstakeSlotMaxKey = containerdb.ToKey(
		containerdb.HashBuilder, scoredb.VarDBPrefix, "unstake_slot_max",
	)
	TotalDelegationKey = containerdb.ToKey(
		containerdb.HashBuilder, scoredb.VarDBPrefix, "total_delegation",
	)
	TotalBondKey = containerdb.ToKey(
		containerdb.HashBuilder, scoredb.VarDBPrefix, "total_bond",
	)
	LastBlockVotersKey = containerdb.ToKey(
		containerdb.HashBuilder, scoredb.VarDBPrefix, "lastBlockVoters",
	)
)
View Source
var AccountDictPrefix = containerdb.ToKey(
	containerdb.HashBuilder,
	scoredb.DictDBPrefix,
	"account_db",
)
View Source
var AdditionalNetworkScoreKeys = []string{CPSKey, RelayKey}
View Source
var IllegalDelegationPrefix = containerdb.ToKey(
	containerdb.HashBuilder,
	scoredb.DictDBPrefix,
	"illegal_delegation",
)

Functions

func CalcUnstakeLockPeriod added in v0.9.10

func CalcUnstakeLockPeriod(lMin *big.Int, lMax *big.Int, totalStake *big.Int, totalSupply *big.Int) int64

func NewObjectImpl

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

func NewPRepSetEntry added in v1.3.0

func NewPRepSetEntry(prep *PRep, pubKey bool) *prepSetEntry

func NewStringPtr added in v0.9.8

func NewStringPtr(s string) *string

func NewVotingIterator

func NewVotingIterator(votings []Voting) *votingIterator

func ScheduleTimerJob

func ScheduleTimerJob(t *TimerState, info TimerJobInfo, address module.Address)

Types

type AccountCache

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

func (*AccountCache) Clear

func (c *AccountCache) Clear()

func (*AccountCache) Flush

func (c *AccountCache) Flush()

func (*AccountCache) Get

func (c *AccountCache) Get(owner module.Address, createIfNotExist bool) *AccountState

func (*AccountCache) GetSnapshot added in v0.9.7

func (c *AccountCache) GetSnapshot(owner module.Address) *AccountSnapshot

func (*AccountCache) Reset

func (c *AccountCache) Reset()

type AccountSnapshot added in v0.9.7

type AccountSnapshot struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func GetEmptyAccountSnapshot added in v0.9.7

func GetEmptyAccountSnapshot() *AccountSnapshot

func ToAccount

func ToAccount(object trie.Object) *AccountSnapshot

func (*AccountSnapshot) Bond added in v0.9.7

func (a *AccountSnapshot) Bond() *big.Int

func (*AccountSnapshot) Bonds added in v0.9.7

func (a *AccountSnapshot) Bonds() Bonds

func (*AccountSnapshot) Delegating added in v0.9.7

func (a *AccountSnapshot) Delegating() *big.Int

func (*AccountSnapshot) Delegations added in v0.9.7

func (a *AccountSnapshot) Delegations() Delegations

func (*AccountSnapshot) Equal added in v0.9.7

func (a *AccountSnapshot) Equal(object icobject.Impl) bool

func (*AccountSnapshot) Format added in v0.9.7

func (a *AccountSnapshot) Format(f fmt.State, c rune)

func (*AccountSnapshot) GetBondInJSON added in v1.1.1

func (a *AccountSnapshot) GetBondInJSON() map[string]interface{}

func (AccountSnapshot) GetDelegationInJSON added in v0.9.7

func (a AccountSnapshot) GetDelegationInJSON() map[string]interface{}

func (AccountSnapshot) GetStakeInJSON added in v0.9.7

func (a AccountSnapshot) GetStakeInJSON(blockHeight int64) map[string]interface{}

func (AccountSnapshot) GetTotalStake added in v0.9.7

func (a AccountSnapshot) GetTotalStake() *big.Int

func (*AccountSnapshot) GetUnbondsInJSON added in v0.9.7

func (a *AccountSnapshot) GetUnbondsInJSON() []interface{}

func (AccountSnapshot) GetUnstakeAmount added in v0.9.7

func (a AccountSnapshot) GetUnstakeAmount() *big.Int

func (*AccountSnapshot) GetVoting added in v0.9.7

func (a *AccountSnapshot) GetVoting() *big.Int

func (*AccountSnapshot) GetVotingPower added in v0.9.7

func (a *AccountSnapshot) GetVotingPower() *big.Int

func (AccountSnapshot) IsEmpty added in v0.9.7

func (a AccountSnapshot) IsEmpty() bool

func (*AccountSnapshot) RLPDecodeFields added in v0.9.7

func (a *AccountSnapshot) RLPDecodeFields(decoder codec.Decoder) error

func (*AccountSnapshot) RLPEncodeFields added in v0.9.7

func (a *AccountSnapshot) RLPEncodeFields(encoder codec.Encoder) error

func (AccountSnapshot) Stake added in v0.9.7

func (a AccountSnapshot) Stake() *big.Int

func (*AccountSnapshot) String added in v0.9.7

func (a *AccountSnapshot) String() string

func (AccountSnapshot) UnStakes added in v0.9.8

func (a AccountSnapshot) UnStakes() Unstakes

func (*AccountSnapshot) Unbond added in v0.9.7

func (a *AccountSnapshot) Unbond() *big.Int

func (*AccountSnapshot) Unbonds added in v0.9.7

func (a *AccountSnapshot) Unbonds() Unbonds

func (*AccountSnapshot) UsingStake added in v0.9.7

func (a *AccountSnapshot) UsingStake() *big.Int

func (*AccountSnapshot) Version added in v0.9.7

func (a *AccountSnapshot) Version() int

type AccountState added in v0.9.7

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

func (*AccountState) Bond added in v0.9.7

func (a *AccountState) Bond() *big.Int

func (*AccountState) Bonds added in v0.9.7

func (a *AccountState) Bonds() Bonds

func (*AccountState) Clear added in v0.9.7

func (a *AccountState) Clear()

func (*AccountState) DecreaseUnstake added in v0.9.7

func (a *AccountState) DecreaseUnstake(stakeInc *big.Int, expireHeight int64, revision int) ([]TimerJobInfo, error)

func (*AccountState) Delegating added in v0.9.7

func (a *AccountState) Delegating() *big.Int

func (*AccountState) Delegations added in v0.9.7

func (a *AccountState) Delegations() Delegations

func (*AccountState) Format added in v0.9.7

func (a *AccountState) Format(f fmt.State, c rune)

func (*AccountState) GetBondInJSON added in v1.1.1

func (a *AccountState) GetBondInJSON() map[string]interface{}

func (AccountState) GetDelegationInJSON added in v0.9.7

func (a AccountState) GetDelegationInJSON() map[string]interface{}

func (*AccountState) GetSnapshot added in v0.9.7

func (a *AccountState) GetSnapshot() *AccountSnapshot

func (AccountState) GetStakeInJSON added in v0.9.7

func (a AccountState) GetStakeInJSON(blockHeight int64) map[string]interface{}

func (AccountState) GetTotalStake added in v0.9.7

func (a AccountState) GetTotalStake() *big.Int

func (*AccountState) GetUnbondsInJSON added in v0.9.7

func (a *AccountState) GetUnbondsInJSON() []interface{}

func (AccountState) GetUnstakeAmount added in v0.9.7

func (a AccountState) GetUnstakeAmount() *big.Int

func (*AccountState) GetVoting added in v0.9.7

func (a *AccountState) GetVoting() *big.Int

func (*AccountState) GetVotingPower added in v0.9.7

func (a *AccountState) GetVotingPower() *big.Int

func (*AccountState) IncreaseUnstake added in v0.9.7

func (a *AccountState) IncreaseUnstake(stakeInc *big.Int, expireHeight int64, slotMax, revision int) ([]TimerJobInfo, error)

func (AccountState) IsEmpty added in v0.9.7

func (a AccountState) IsEmpty() bool

func (*AccountState) RemoveUnbond added in v0.9.7

func (a *AccountState) RemoveUnbond(height int64) error

func (*AccountState) RemoveUnstake added in v0.9.7

func (a *AccountState) RemoveUnstake(height int64) (ra *big.Int, err error)

func (*AccountState) Reset added in v0.9.7

func (a *AccountState) Reset(s *AccountSnapshot)

func (*AccountState) SetBonds added in v0.9.7

func (a *AccountState) SetBonds(bonds Bonds)

func (*AccountState) SetDelegation added in v0.9.7

func (a *AccountState) SetDelegation(ds Delegations)

func (*AccountState) SetStake added in v0.9.7

func (a *AccountState) SetStake(v *big.Int) error

func (*AccountState) SlashBond added in v0.9.7

func (a *AccountState) SlashBond(address module.Address, ratio int) *big.Int

func (*AccountState) SlashStake added in v0.9.7

func (a *AccountState) SlashStake(amount *big.Int) error

func (*AccountState) SlashUnbond added in v0.9.7

func (a *AccountState) SlashUnbond(address module.Address, ratio int) (*big.Int, int64)

func (AccountState) Stake added in v0.9.7

func (a AccountState) Stake() *big.Int

func (*AccountState) String added in v0.9.7

func (a *AccountState) String() string

func (AccountState) UnStakes added in v0.9.8

func (a AccountState) UnStakes() Unstakes

func (*AccountState) Unbond added in v0.9.7

func (a *AccountState) Unbond() *big.Int

func (*AccountState) Unbonds added in v0.9.7

func (a *AccountState) Unbonds() Unbonds

func (*AccountState) UpdateUnbonds added in v0.9.7

func (a *AccountState) UpdateUnbonds(bondDelta map[string]*big.Int, expireHeight int64) ([]TimerJobInfo, error)

func (*AccountState) UsingStake added in v0.9.7

func (a *AccountState) UsingStake() *big.Int

type AllPRepCache added in v0.9.8

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

func NewAllPRepCache added in v0.9.8

func NewAllPRepCache(store containerdb.ObjectStoreState) *AllPRepCache

func (*AllPRepCache) Add added in v0.9.8

func (c *AllPRepCache) Add(owner module.Address) error

Add add a new active PRep to State Duplicated address check MUST BE done before adding

func (*AllPRepCache) Get added in v0.9.8

func (c *AllPRepCache) Get(i int) module.Address

func (*AllPRepCache) Size added in v0.9.8

func (c *AllPRepCache) Size() int

type Arrayable added in v0.9.7

type Arrayable interface {
	IndexOf(value interface{}) int
	Get(i int) interface{}
	Len() int
}

type BlockVotersSnapshot added in v0.9.8

type BlockVotersSnapshot struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewBlockVotersSnapshot added in v0.9.8

func NewBlockVotersSnapshot(voters []module.Address) *BlockVotersSnapshot

func NewBlockVotersWithTag added in v0.9.8

func NewBlockVotersWithTag(_ icobject.Tag) *BlockVotersSnapshot

func ToBlockVoters added in v0.9.8

func ToBlockVoters(object trie.Object) *BlockVotersSnapshot

func (*BlockVotersSnapshot) Equal added in v0.9.8

func (bvs *BlockVotersSnapshot) Equal(object icobject.Impl) bool

func (*BlockVotersSnapshot) Format added in v0.9.8

func (bvs *BlockVotersSnapshot) Format(f fmt.State, verb rune)

func (BlockVotersSnapshot) Get added in v0.9.8

func (bvd BlockVotersSnapshot) Get(i int) module.Address

func (BlockVotersSnapshot) IndexOf added in v0.9.8

func (bvd BlockVotersSnapshot) IndexOf(owner module.Address) int

func (BlockVotersSnapshot) Len added in v0.9.8

func (bvd BlockVotersSnapshot) Len() int

func (*BlockVotersSnapshot) RLPDecodeFields added in v0.9.8

func (bvs *BlockVotersSnapshot) RLPDecodeFields(decoder codec.Decoder) error

func (*BlockVotersSnapshot) RLPEncodeFields added in v0.9.8

func (bvs *BlockVotersSnapshot) RLPEncodeFields(encoder codec.Encoder) error

func (*BlockVotersSnapshot) Version added in v0.9.8

func (bvs *BlockVotersSnapshot) Version() int

type Bond

type Bond struct {
	Address *common.Address `json:"address"`
	Value   *common.HexInt  `json:"value"`
}

func NewBond

func NewBond(addr *common.Address, v *big.Int) *Bond

func (*Bond) Amount

func (b *Bond) Amount() *big.Int

func (*Bond) Clone

func (b *Bond) Clone() *Bond

func (*Bond) Equal

func (b *Bond) Equal(b2 *Bond) bool

func (*Bond) Format added in v0.9.7

func (b *Bond) Format(f fmt.State, c rune)

func (*Bond) Slash

func (b *Bond) Slash(ratio int) *big.Int

func (*Bond) String

func (b *Bond) String() string

func (*Bond) To

func (b *Bond) To() module.Address

func (*Bond) ToJSON

func (b *Bond) ToJSON() map[string]interface{}

type BonderList

type BonderList []*common.Address

func NewBonderList

func NewBonderList(param []interface{}) (BonderList, error)

func (BonderList) Clone

func (bl BonderList) Clone() BonderList

func (BonderList) Contains

func (bl BonderList) Contains(a module.Address) bool

func (BonderList) Equal

func (bl BonderList) Equal(bl2 BonderList) bool

func (BonderList) IsEmpty added in v0.9.8

func (bl BonderList) IsEmpty() bool

func (BonderList) ToJSON

func (bl BonderList) ToJSON() []interface{}

type Bonds

type Bonds []*Bond

func NewBonds

func NewBonds(param []interface{}, revision int) (Bonds, error)

func (*Bonds) Clone

func (bs *Bonds) Clone() Bonds

func (Bonds) Contains added in v1.0.0

func (bs Bonds) Contains(addr module.Address) bool

func (*Bonds) Delete

func (bs *Bonds) Delete(i int) error

func (Bonds) Delta added in v0.9.10

func (bs Bonds) Delta(bs2 Bonds) map[string]*big.Int

func (*Bonds) Equal

func (bs *Bonds) Equal(bl2 Bonds) bool

func (*Bonds) GetBondAmount

func (bs *Bonds) GetBondAmount() *big.Int

func (*Bonds) Has

func (bs *Bonds) Has() bool

func (*Bonds) Iterator

func (bs *Bonds) Iterator() VotingIterator

func (*Bonds) Slash

func (bs *Bonds) Slash(address module.Address, ratio int) (Bonds, *big.Int)

func (*Bonds) ToJSON

func (bs *Bonds) ToJSON(v module.JSONVersion) []interface{}

func (*Bonds) ToMap added in v0.9.7

func (bs *Bonds) ToMap() map[string]*Bond

type Delegation

type Delegation struct {
	Address *common.Address `json:"address"`
	Value   *common.HexInt  `json:"value"`
}

func NewDelegation

func NewDelegation(addr *common.Address, v *big.Int) *Delegation

func (*Delegation) Amount

func (dg *Delegation) Amount() *big.Int

func (*Delegation) Clone

func (dg *Delegation) Clone() *Delegation

func (*Delegation) Equal

func (dg *Delegation) Equal(d2 *Delegation) bool

func (*Delegation) Format added in v0.9.7

func (dg *Delegation) Format(f fmt.State, c rune)

func (*Delegation) String added in v0.9.7

func (dg *Delegation) String() string

func (*Delegation) To

func (dg *Delegation) To() module.Address

func (*Delegation) ToJSON

func (dg *Delegation) ToJSON() map[string]interface{}

type Delegations

type Delegations []*Delegation

func NewDelegations

func NewDelegations(param []interface{}, max int) (Delegations, error)

func (Delegations) Clone

func (ds Delegations) Clone() Delegations

func (*Delegations) Delete

func (ds *Delegations) Delete(i int) error

func (Delegations) Delta added in v0.9.10

func (ds Delegations) Delta(ds2 Delegations) map[string]*big.Int

func (Delegations) Equal

func (ds Delegations) Equal(ds2 Delegations) bool

func (Delegations) GetDelegationAmount

func (ds Delegations) GetDelegationAmount() *big.Int

func (Delegations) Has

func (ds Delegations) Has() bool

func (*Delegations) Iterator

func (ds *Delegations) Iterator() VotingIterator

func (Delegations) ToJSON

func (ds Delegations) ToJSON(_ module.JSONVersion) []interface{}

func (*Delegations) ToMap added in v0.9.7

func (ds *Delegations) ToMap() map[string]*Delegation

type Grade

type Grade int
const (
	GradeMain Grade = iota
	GradeSub
	GradeCandidate
	GradeNone
)

func (Grade) Cmp added in v1.3.0

func (g Grade) Cmp(g2 Grade) int

func (Grade) String

func (g Grade) String() string

type IllegalDelegation added in v0.9.10

type IllegalDelegation struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewIllegalDelegation added in v0.9.10

func NewIllegalDelegation(addr module.Address, ds Delegations) *IllegalDelegation

func NewIllegalDelegationWithTag added in v0.9.10

func NewIllegalDelegationWithTag(_ icobject.Tag) *IllegalDelegation

func ToIllegalDelegation added in v0.9.10

func ToIllegalDelegation(object trie.Object) *IllegalDelegation

func (*IllegalDelegation) Address added in v0.9.10

func (d *IllegalDelegation) Address() module.Address

func (*IllegalDelegation) Clone added in v0.9.10

func (*IllegalDelegation) Delegations added in v0.9.10

func (d *IllegalDelegation) Delegations() Delegations

func (*IllegalDelegation) Equal added in v0.9.10

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

func (*IllegalDelegation) Format added in v0.9.10

func (d *IllegalDelegation) Format(f fmt.State, c rune)

func (*IllegalDelegation) RLPDecodeFields added in v0.9.10

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

func (*IllegalDelegation) RLPEncodeFields added in v0.9.10

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

func (*IllegalDelegation) SetDelegations added in v0.9.10

func (d *IllegalDelegation) SetDelegations(ds Delegations)

func (*IllegalDelegation) Version added in v0.9.10

func (d *IllegalDelegation) Version() int

type Issue

type Issue struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewIssue

func NewIssue() *Issue

func ToIssue

func ToIssue(object trie.Object) *Issue

func (*Issue) Clone

func (i *Issue) Clone() *Issue

func (*Issue) Equal

func (i *Issue) Equal(o icobject.Impl) bool

func (*Issue) Format added in v0.9.7

func (i *Issue) Format(f fmt.State, c rune)

func (*Issue) GetOverIssuedICX added in v0.9.8

func (i *Issue) GetOverIssuedICX() *big.Int

func (*Issue) OverIssuedIScore added in v0.9.8

func (i *Issue) OverIssuedIScore() *big.Int

func (*Issue) PrevBlockFee

func (i *Issue) PrevBlockFee() *big.Int

func (*Issue) PrevTotalReward added in v0.9.8

func (i *Issue) PrevTotalReward() *big.Int

func (*Issue) RLPDecodeFields

func (i *Issue) RLPDecodeFields(decoder codec.Decoder) error

func (*Issue) RLPEncodeFields

func (i *Issue) RLPEncodeFields(encoder codec.Encoder) error

func (*Issue) ResetTotalReward added in v0.9.8

func (i *Issue) ResetTotalReward()

func (*Issue) SetOverIssuedIScore added in v0.9.8

func (i *Issue) SetOverIssuedIScore(v *big.Int)

func (*Issue) SetPrevBlockFee added in v0.9.7

func (i *Issue) SetPrevBlockFee(v *big.Int)

func (*Issue) SetPrevTotalReward added in v0.9.8

func (i *Issue) SetPrevTotalReward(v *big.Int)

func (*Issue) SetTotalReward added in v0.9.8

func (i *Issue) SetTotalReward(v *big.Int)

func (*Issue) TotalReward added in v0.9.8

func (i *Issue) TotalReward() *big.Int

func (*Issue) Update added in v0.9.7

func (i *Issue) Update(totalReward *big.Int, byFee *big.Int, byOverIssued *big.Int) *Issue

func (*Issue) Version

func (i *Issue) Version() int

type JobType

type JobType int
const (
	JobTypeAdd JobType = iota + 1
	JobTypeRemove
)

type Mappable added in v0.9.7

type Mappable interface {
	Has(key interface{}) bool
	Get(key interface{}) interface{}
	Len() int
}

type NodeOwnerCache

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

TODO: Remove old nodes which is not used anymore

func (*NodeOwnerCache) Add

func (c *NodeOwnerCache) Add(node, owner module.Address) error

Add adds alias, node-to-owner. It doesn't record alias to self. If there is same alias, it ignores the request.

func (*NodeOwnerCache) Clear

func (c *NodeOwnerCache) Clear()

func (*NodeOwnerCache) Contains added in v0.9.7

func (c *NodeOwnerCache) Contains(node module.Address) bool

func (*NodeOwnerCache) Flush

func (c *NodeOwnerCache) Flush()

func (*NodeOwnerCache) Get

func (*NodeOwnerCache) Reset

func (c *NodeOwnerCache) Reset()

type OwnerToNodeMappable added in v0.9.7

type OwnerToNodeMappable interface {
	GetNodeByOwner(owner module.Address) module.Address
}

type PRep added in v0.9.7

type PRep struct {
	*PRepStatusState
	// contains filtered or unexported fields
}

func NewPRep added in v0.9.8

func NewPRep(owner module.Address, state *State) *PRep

func (PRep) Bonded added in v0.9.7

func (ps PRep) Bonded() *big.Int

func (PRep) Delegated added in v0.9.7

func (ps PRep) Delegated() *big.Int

func (PRep) EffectiveDelegated added in v0.9.10

func (ps PRep) EffectiveDelegated() *big.Int

func (PRep) Format added in v0.9.8

func (ps PRep) Format(f fmt.State, c rune)

func (PRep) GetBondedDelegation added in v0.9.7

func (ps PRep) GetBondedDelegation(bondRequirement int64) *big.Int

GetBondedDelegation return amount of bonded delegation Bonded delegation formula totalVoted = bond + delegation bondRatio = bond / totalVoted * 100 bondedDelegation = totalVoted * (bondRatio / bondRequirement)

= bond * 100 / bondRequirement

if bondedDelegation > totalVoted

bondedDelegation = totalVoted

func (PRep) GetDSAMask added in v1.3.0

func (ps PRep) GetDSAMask() int64

func (PRep) GetPower added in v1.1.0

func (ps PRep) GetPower(bondRequirement int64) *big.Int

GetPower returns the power score of a PRep. Power is the same as delegated of a given PRep before rev 14 and will be bondedDelegation since rev 14. But the calculation formula for power can be changed in the future.

func (PRep) GetStatsInJSON added in v0.9.7

func (ps PRep) GetStatsInJSON(blockHeight int64) map[string]interface{}

func (PRep) GetVFail added in v0.9.7

func (ps PRep) GetVFail(blockHeight int64) int64

GetVFail returns the calculated number of validation failures

func (PRep) GetVFailCont added in v0.9.7

func (ps PRep) GetVFailCont(blockHeight int64) int64

GetVFailCont returns the number of consecutive validation failures

func (PRep) GetVPenaltyCount added in v0.9.7

func (ps PRep) GetVPenaltyCount() int

func (PRep) GetVTotal added in v0.9.7

func (ps PRep) GetVTotal(blockHeight int64) int64

GetVTotal returns the calculated number of validation

func (PRep) Grade added in v0.9.7

func (ps PRep) Grade() Grade

func (*PRep) IRep added in v0.9.8

func (p *PRep) IRep() *big.Int

func (*PRep) Info added in v1.3.0

func (p *PRep) Info() *PRepInfo

func (PRep) IsActive added in v0.9.7

func (ps PRep) IsActive() bool

func (PRep) IsAlreadyPenalized added in v0.9.7

func (ps PRep) IsAlreadyPenalized() bool

IsAlreadyPenalized returns true if this PRep got penalized during this term

func (PRep) IsEmpty added in v1.3.0

func (ps PRep) IsEmpty() bool

func (PRep) LastHeight added in v0.9.7

func (ps PRep) LastHeight() int64

func (PRep) LastState added in v0.9.7

func (ps PRep) LastState() VoteState

func (*PRep) NodeAddress added in v1.3.0

func (p *PRep) NodeAddress() module.Address

func (*PRep) Owner added in v0.9.7

func (p *PRep) Owner() module.Address

func (PRep) Status added in v0.9.7

func (ps PRep) Status() Status

func (PRep) String added in v0.9.8

func (ps PRep) String() string

func (*PRep) ToJSON added in v0.9.7

func (p *PRep) ToJSON(blockHeight int64, bondRequirement int64, activeDSAMask int64) map[string]interface{}

func (PRep) VFail added in v0.9.7

func (ps PRep) VFail() int64

func (PRep) VTotal added in v0.9.7

func (ps PRep) VTotal() int64

type PRepBaseCache

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

func (*PRepBaseCache) Clear

func (c *PRepBaseCache) Clear()

func (*PRepBaseCache) Flush

func (c *PRepBaseCache) Flush()

func (*PRepBaseCache) Get

func (c *PRepBaseCache) Get(owner module.Address, createIfNotExist bool) *PRepBaseState

func (*PRepBaseCache) Reset

func (c *PRepBaseCache) Reset()

type PRepBaseData added in v0.9.8

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

func (*PRepBaseData) BonderList added in v0.9.8

func (p *PRepBaseData) BonderList() BonderList

func (*PRepBaseData) Format added in v0.9.8

func (p *PRepBaseData) Format(f fmt.State, c rune)

func (*PRepBaseData) GetBonderListInJSON added in v0.9.8

func (p *PRepBaseData) GetBonderListInJSON() []interface{}

func (*PRepBaseData) GetNode added in v0.9.8

func (p *PRepBaseData) GetNode(owner module.Address) module.Address

func (*PRepBaseData) IRep added in v0.9.8

func (p *PRepBaseData) IRep() *big.Int

func (*PRepBaseData) IRepHeight added in v0.9.8

func (p *PRepBaseData) IRepHeight() int64

func (*PRepBaseData) IsEmpty added in v0.9.8

func (p *PRepBaseData) IsEmpty() bool

func (*PRepBaseData) Name added in v0.9.8

func (p *PRepBaseData) Name() string

func (*PRepBaseData) P2PEndpoint added in v0.9.8

func (p *PRepBaseData) P2PEndpoint() string

func (*PRepBaseData) String added in v0.9.8

func (p *PRepBaseData) String() string

func (*PRepBaseData) ToJSON added in v0.9.8

func (p *PRepBaseData) ToJSON(owner module.Address) map[string]interface{}

type PRepBaseSnapshot added in v0.9.8

type PRepBaseSnapshot struct {
	icobject.NoDatabase
	PRepBaseData
}

func ToPRepBase

func ToPRepBase(object trie.Object) *PRepBaseSnapshot

func (*PRepBaseSnapshot) Equal added in v0.9.8

func (p *PRepBaseSnapshot) Equal(object icobject.Impl) bool

func (*PRepBaseSnapshot) RLPDecodeFields added in v0.9.8

func (p *PRepBaseSnapshot) RLPDecodeFields(d codec.Decoder) error

func (*PRepBaseSnapshot) RLPEncodeFields added in v0.9.8

func (p *PRepBaseSnapshot) RLPEncodeFields(e codec.Encoder) error

func (*PRepBaseSnapshot) Version added in v0.9.8

func (p *PRepBaseSnapshot) Version() int

type PRepBaseState added in v0.9.8

type PRepBaseState struct {
	PRepBaseData
	// contains filtered or unexported fields
}

func NewPRepBaseState added in v0.9.8

func NewPRepBaseState() *PRepBaseState

func (*PRepBaseState) Clear added in v0.9.8

func (p *PRepBaseState) Clear()

func (*PRepBaseState) GetSnapshot added in v0.9.8

func (p *PRepBaseState) GetSnapshot() *PRepBaseSnapshot

func (*PRepBaseState) Reset added in v0.9.8

func (p *PRepBaseState) Reset(snapshot *PRepBaseSnapshot) *PRepBaseState

func (*PRepBaseState) SetBonderList added in v0.9.8

func (p *PRepBaseState) SetBonderList(bonderList BonderList)

func (*PRepBaseState) SetIrep added in v0.9.8

func (p *PRepBaseState) SetIrep(irep *big.Int, irepHeight int64)

func (*PRepBaseState) UpdateInfo added in v0.9.8

func (p *PRepBaseState) UpdateInfo(info *PRepInfo)

type PRepInfo added in v0.9.8

type PRepInfo struct {
	City        *string
	Country     *string
	Details     *string
	Email       *string
	Name        *string
	P2PEndpoint *string
	WebSite     *string
	Node        module.Address
}

func (*PRepInfo) GetNode added in v0.9.8

func (r *PRepInfo) GetNode(owner module.Address) module.Address

func (*PRepInfo) String added in v0.9.8

func (r *PRepInfo) String() string

func (*PRepInfo) Validate added in v0.9.8

func (r *PRepInfo) Validate(revision int, reg bool) error

Validate check validity of fields reg: whether it's for registration revision: revision value

type PRepSet added in v0.9.8

type PRepSet interface {
	OnTermEnd(revision, mainPRepCount, subPRepCount, extraMainPRepCount, limit int, br int64) error
	GetPRepSize(grade Grade) int
	GetElectedPRepSize() int
	Size() int
	TotalBonded() *big.Int
	TotalDelegated() *big.Int
	GetTotalPower(br int64) *big.Int
	GetByIndex(i int) PRepSetEntry
	ToPRepSnapshots(electedPRepCount int, br int64) PRepSnapshots
	Sort(mainPRepCount, subPRepCount, extraMainPRepCount int, br int64, revision int)
	SortForQuery(br int64, revision int)
}

func NewPRepSet added in v1.3.0

func NewPRepSet(prepList []PRepSetEntry) PRepSet

type PRepSetEntry added in v1.3.0

type PRepSetEntry interface {
	PRep() *PRep
	Status() Status
	Grade() Grade
	Power(br int64) *big.Int
	Delegated() *big.Int
	Bonded() *big.Int
	Owner() module.Address
	HasPubKey() bool
}

type PRepSnapshot

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

func NewPRepSnapshot added in v0.9.7

func NewPRepSnapshot(owner module.Address, power *big.Int) *PRepSnapshot

func (*PRepSnapshot) BondedDelegation

func (pss *PRepSnapshot) BondedDelegation() *big.Int

func (*PRepSnapshot) Clone

func (pss *PRepSnapshot) Clone() *PRepSnapshot

func (*PRepSnapshot) Equal

func (pss *PRepSnapshot) Equal(other *PRepSnapshot) bool

func (*PRepSnapshot) Owner

func (pss *PRepSnapshot) Owner() module.Address

func (*PRepSnapshot) Power added in v1.1.0

func (pss *PRepSnapshot) Power() *big.Int

func (*PRepSnapshot) RLPDecodeSelf

func (pss *PRepSnapshot) RLPDecodeSelf(d codec.Decoder) error

func (*PRepSnapshot) RLPEncodeSelf

func (pss *PRepSnapshot) RLPEncodeSelf(e codec.Encoder) error

func (*PRepSnapshot) String added in v1.2.1

func (pss *PRepSnapshot) String() string

func (*PRepSnapshot) ToJSON

func (pss *PRepSnapshot) ToJSON() map[string]interface{}

type PRepSnapshots

type PRepSnapshots []*PRepSnapshot

func (PRepSnapshots) Clone

func (p PRepSnapshots) Clone() PRepSnapshots

func (PRepSnapshots) Equal

func (p PRepSnapshots) Equal(other PRepSnapshots) bool

func (PRepSnapshots) String added in v1.2.1

func (p PRepSnapshots) String() string

type PRepStats added in v1.3.7

type PRepStats struct {
	*PRepStatusState
	// contains filtered or unexported fields
}

func NewPRepStats added in v1.3.7

func NewPRepStats(owner module.Address, ps *PRepStatusState) *PRepStats

func (PRepStats) Bonded added in v1.3.7

func (ps PRepStats) Bonded() *big.Int

func (PRepStats) Delegated added in v1.3.7

func (ps PRepStats) Delegated() *big.Int

func (PRepStats) EffectiveDelegated added in v1.3.7

func (ps PRepStats) EffectiveDelegated() *big.Int

func (PRepStats) Format added in v1.3.7

func (ps PRepStats) Format(f fmt.State, c rune)

func (PRepStats) GetBondedDelegation added in v1.3.7

func (ps PRepStats) GetBondedDelegation(bondRequirement int64) *big.Int

GetBondedDelegation return amount of bonded delegation Bonded delegation formula totalVoted = bond + delegation bondRatio = bond / totalVoted * 100 bondedDelegation = totalVoted * (bondRatio / bondRequirement)

= bond * 100 / bondRequirement

if bondedDelegation > totalVoted

bondedDelegation = totalVoted

func (PRepStats) GetDSAMask added in v1.3.7

func (ps PRepStats) GetDSAMask() int64

func (PRepStats) GetPower added in v1.3.7

func (ps PRepStats) GetPower(bondRequirement int64) *big.Int

GetPower returns the power score of a PRep. Power is the same as delegated of a given PRep before rev 14 and will be bondedDelegation since rev 14. But the calculation formula for power can be changed in the future.

func (PRepStats) GetStatsInJSON added in v1.3.7

func (ps PRepStats) GetStatsInJSON(blockHeight int64) map[string]interface{}

func (PRepStats) GetVFail added in v1.3.7

func (ps PRepStats) GetVFail(blockHeight int64) int64

GetVFail returns the calculated number of validation failures

func (PRepStats) GetVFailCont added in v1.3.7

func (ps PRepStats) GetVFailCont(blockHeight int64) int64

GetVFailCont returns the number of consecutive validation failures

func (PRepStats) GetVPenaltyCount added in v1.3.7

func (ps PRepStats) GetVPenaltyCount() int

func (PRepStats) GetVTotal added in v1.3.7

func (ps PRepStats) GetVTotal(blockHeight int64) int64

GetVTotal returns the calculated number of validation

func (PRepStats) Grade added in v1.3.7

func (ps PRepStats) Grade() Grade

func (PRepStats) IsActive added in v1.3.7

func (ps PRepStats) IsActive() bool

func (PRepStats) IsAlreadyPenalized added in v1.3.7

func (ps PRepStats) IsAlreadyPenalized() bool

IsAlreadyPenalized returns true if this PRep got penalized during this term

func (PRepStats) IsEmpty added in v1.3.7

func (ps PRepStats) IsEmpty() bool

func (PRepStats) LastHeight added in v1.3.7

func (ps PRepStats) LastHeight() int64

func (PRepStats) LastState added in v1.3.7

func (ps PRepStats) LastState() VoteState

func (*PRepStats) Owner added in v1.3.7

func (p *PRepStats) Owner() module.Address

func (PRepStats) Status added in v1.3.7

func (ps PRepStats) Status() Status

func (PRepStats) String added in v1.3.7

func (ps PRepStats) String() string

func (*PRepStats) ToJSON added in v1.3.7

func (p *PRepStats) ToJSON(rev int, blockHeight int64) map[string]interface{}

func (PRepStats) VFail added in v1.3.7

func (ps PRepStats) VFail() int64

func (PRepStats) VTotal added in v1.3.7

func (ps PRepStats) VTotal() int64

type PRepStatusCache

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

func (*PRepStatusCache) Clear

func (c *PRepStatusCache) Clear()

func (*PRepStatusCache) Flush

func (c *PRepStatusCache) Flush()

func (*PRepStatusCache) Get

func (c *PRepStatusCache) Get(owner module.Address, createIfNotExist bool) *PRepStatusState

func (*PRepStatusCache) Reset

func (c *PRepStatusCache) Reset()

type PRepStatusSnapshot added in v0.9.7

type PRepStatusSnapshot struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func ToPRepStatus

func ToPRepStatus(object trie.Object) *PRepStatusSnapshot

func (*PRepStatusSnapshot) Bonded added in v0.9.7

func (ps *PRepStatusSnapshot) Bonded() *big.Int

func (*PRepStatusSnapshot) Delegated added in v0.9.7

func (ps *PRepStatusSnapshot) Delegated() *big.Int

func (*PRepStatusSnapshot) EffectiveDelegated added in v0.9.10

func (ps *PRepStatusSnapshot) EffectiveDelegated() *big.Int

func (*PRepStatusSnapshot) Equal added in v0.9.7

func (ps *PRepStatusSnapshot) Equal(o icobject.Impl) bool

func (*PRepStatusSnapshot) Format added in v0.9.7

func (ps *PRepStatusSnapshot) Format(f fmt.State, c rune)

func (*PRepStatusSnapshot) GetBondedDelegation added in v0.9.7

func (ps *PRepStatusSnapshot) GetBondedDelegation(bondRequirement int64) *big.Int

GetBondedDelegation return amount of bonded delegation Bonded delegation formula totalVoted = bond + delegation bondRatio = bond / totalVoted * 100 bondedDelegation = totalVoted * (bondRatio / bondRequirement)

= bond * 100 / bondRequirement

if bondedDelegation > totalVoted

bondedDelegation = totalVoted

func (*PRepStatusSnapshot) GetDSAMask added in v1.3.0

func (ps *PRepStatusSnapshot) GetDSAMask() int64

func (*PRepStatusSnapshot) GetPower added in v1.1.0

func (ps *PRepStatusSnapshot) GetPower(bondRequirement int64) *big.Int

GetPower returns the power score of a PRep. Power is the same as delegated of a given PRep before rev 14 and will be bondedDelegation since rev 14. But the calculation formula for power can be changed in the future.

func (*PRepStatusSnapshot) GetStatsInJSON added in v0.9.7

func (ps *PRepStatusSnapshot) GetStatsInJSON(blockHeight int64) map[string]interface{}

func (*PRepStatusSnapshot) GetVFail added in v0.9.7

func (ps *PRepStatusSnapshot) GetVFail(blockHeight int64) int64

GetVFail returns the calculated number of validation failures

func (*PRepStatusSnapshot) GetVFailCont added in v0.9.7

func (ps *PRepStatusSnapshot) GetVFailCont(blockHeight int64) int64

GetVFailCont returns the number of consecutive validation failures

func (*PRepStatusSnapshot) GetVPenaltyCount added in v0.9.7

func (ps *PRepStatusSnapshot) GetVPenaltyCount() int

func (*PRepStatusSnapshot) GetVTotal added in v0.9.7

func (ps *PRepStatusSnapshot) GetVTotal(blockHeight int64) int64

GetVTotal returns the calculated number of validation

func (*PRepStatusSnapshot) Grade added in v0.9.7

func (ps *PRepStatusSnapshot) Grade() Grade

func (*PRepStatusSnapshot) IsActive added in v0.9.7

func (ps *PRepStatusSnapshot) IsActive() bool

func (*PRepStatusSnapshot) IsAlreadyPenalized added in v0.9.7

func (ps *PRepStatusSnapshot) IsAlreadyPenalized() bool

IsAlreadyPenalized returns true if this PRep got penalized during this term

func (*PRepStatusSnapshot) IsEmpty added in v0.9.7

func (ps *PRepStatusSnapshot) IsEmpty() bool

func (*PRepStatusSnapshot) LastHeight added in v0.9.7

func (ps *PRepStatusSnapshot) LastHeight() int64

func (*PRepStatusSnapshot) LastState added in v0.9.7

func (ps *PRepStatusSnapshot) LastState() VoteState

func (*PRepStatusSnapshot) RLPDecodeFields added in v0.9.7

func (ps *PRepStatusSnapshot) RLPDecodeFields(decoder codec.Decoder) error

func (*PRepStatusSnapshot) RLPEncodeFields added in v0.9.7

func (ps *PRepStatusSnapshot) RLPEncodeFields(encoder codec.Encoder) error

func (*PRepStatusSnapshot) Status added in v0.9.7

func (ps *PRepStatusSnapshot) Status() Status

func (*PRepStatusSnapshot) String added in v0.9.7

func (ps *PRepStatusSnapshot) String() string

func (*PRepStatusSnapshot) ToJSON added in v0.9.7

func (ps *PRepStatusSnapshot) ToJSON(blockHeight int64, bondRequirement int64, dsaMask int64) map[string]interface{}

func (*PRepStatusSnapshot) VFail added in v0.9.7

func (ps *PRepStatusSnapshot) VFail() int64

func (*PRepStatusSnapshot) VTotal added in v0.9.7

func (ps *PRepStatusSnapshot) VTotal() int64

func (*PRepStatusSnapshot) Version added in v0.9.7

func (ps *PRepStatusSnapshot) Version() int

type PRepStatusState added in v0.9.7

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

func NewPRepStatus

func NewPRepStatus() *PRepStatusState

func NewPRepStatusWithSnapshot added in v0.9.7

func NewPRepStatusWithSnapshot(snapshot *PRepStatusSnapshot) *PRepStatusState

func (*PRepStatusState) Activate added in v0.9.8

func (ps *PRepStatusState) Activate() error

func (*PRepStatusState) Bonded added in v0.9.7

func (ps *PRepStatusState) Bonded() *big.Int

func (*PRepStatusState) Clear added in v0.9.7

func (ps *PRepStatusState) Clear()

func (*PRepStatusState) Delegated added in v0.9.7

func (ps *PRepStatusState) Delegated() *big.Int

func (*PRepStatusState) DisableAs added in v0.9.8

func (ps *PRepStatusState) DisableAs(status Status) (Grade, error)

func (*PRepStatusState) EffectiveDelegated added in v0.9.10

func (ps *PRepStatusState) EffectiveDelegated() *big.Int

func (*PRepStatusState) Format added in v0.9.7

func (ps *PRepStatusState) Format(f fmt.State, c rune)

func (*PRepStatusState) GetBondedDelegation added in v0.9.7

func (ps *PRepStatusState) GetBondedDelegation(bondRequirement int64) *big.Int

GetBondedDelegation return amount of bonded delegation Bonded delegation formula totalVoted = bond + delegation bondRatio = bond / totalVoted * 100 bondedDelegation = totalVoted * (bondRatio / bondRequirement)

= bond * 100 / bondRequirement

if bondedDelegation > totalVoted

bondedDelegation = totalVoted

func (*PRepStatusState) GetDSAMask added in v1.3.0

func (ps *PRepStatusState) GetDSAMask() int64

func (*PRepStatusState) GetPower added in v1.1.0

func (ps *PRepStatusState) GetPower(bondRequirement int64) *big.Int

GetPower returns the power score of a PRep. Power is the same as delegated of a given PRep before rev 14 and will be bondedDelegation since rev 14. But the calculation formula for power can be changed in the future.

func (*PRepStatusState) GetSnapshot added in v0.9.7

func (ps *PRepStatusState) GetSnapshot() *PRepStatusSnapshot

func (*PRepStatusState) GetStatsInJSON added in v0.9.7

func (ps *PRepStatusState) GetStatsInJSON(blockHeight int64) map[string]interface{}

func (*PRepStatusState) GetVFail added in v0.9.7

func (ps *PRepStatusState) GetVFail(blockHeight int64) int64

GetVFail returns the calculated number of validation failures

func (*PRepStatusState) GetVFailCont added in v0.9.7

func (ps *PRepStatusState) GetVFailCont(blockHeight int64) int64

GetVFailCont returns the number of consecutive validation failures

func (*PRepStatusState) GetVPenaltyCount added in v0.9.7

func (ps *PRepStatusState) GetVPenaltyCount() int

func (*PRepStatusState) GetVTotal added in v0.9.7

func (ps *PRepStatusState) GetVTotal(blockHeight int64) int64

GetVTotal returns the calculated number of validation

func (*PRepStatusState) Grade added in v0.9.7

func (ps *PRepStatusState) Grade() Grade

func (*PRepStatusState) IsActive added in v0.9.7

func (ps *PRepStatusState) IsActive() bool

func (*PRepStatusState) IsAlreadyPenalized added in v0.9.7

func (ps *PRepStatusState) IsAlreadyPenalized() bool

IsAlreadyPenalized returns true if this PRep got penalized during this term

func (*PRepStatusState) IsEmpty added in v0.9.7

func (ps *PRepStatusState) IsEmpty() bool

func (*PRepStatusState) LastHeight added in v0.9.7

func (ps *PRepStatusState) LastHeight() int64

func (*PRepStatusState) LastState added in v0.9.7

func (ps *PRepStatusState) LastState() VoteState

func (*PRepStatusState) OnBlockVote added in v0.9.8

func (ps *PRepStatusState) OnBlockVote(blockHeight int64, voted bool) error

func (*PRepStatusState) OnMainPRepIn added in v0.9.8

func (ps *PRepStatusState) OnMainPRepIn(limit int) error

OnMainPRepIn is called only in case of penalized main prep replacement

func (*PRepStatusState) OnPenaltyImposed added in v0.9.8

func (ps *PRepStatusState) OnPenaltyImposed(blockHeight int64) error

func (*PRepStatusState) OnTermEnd added in v0.9.8

func (ps *PRepStatusState) OnTermEnd(newGrade Grade, limit int) error

func (*PRepStatusState) OnValidatorOut added in v0.9.8

func (ps *PRepStatusState) OnValidatorOut(blockHeight int64) error

OnValidatorOut is called when this PRep node address disappears from ConsensusInfo

func (*PRepStatusState) Reset added in v0.9.7

func (*PRepStatusState) ResetVPenaltyMask added in v0.9.10

func (ps *PRepStatusState) ResetVPenaltyMask()

func (*PRepStatusState) SetBonded added in v0.9.7

func (ps *PRepStatusState) SetBonded(v *big.Int)

func (*PRepStatusState) SetDSAMask added in v1.3.0

func (ps *PRepStatusState) SetDSAMask(m int64)

func (*PRepStatusState) SetDelegated added in v0.9.7

func (ps *PRepStatusState) SetDelegated(delegated *big.Int)

func (*PRepStatusState) SetEffectiveDelegated added in v0.9.10

func (ps *PRepStatusState) SetEffectiveDelegated(value *big.Int)

func (*PRepStatusState) SetStatus added in v0.9.7

func (ps *PRepStatusState) SetStatus(s Status)

func (*PRepStatusState) SetVTotal added in v0.9.7

func (ps *PRepStatusState) SetVTotal(t int64)

func (*PRepStatusState) Status added in v0.9.7

func (ps *PRepStatusState) Status() Status

func (*PRepStatusState) String added in v0.9.7

func (ps *PRepStatusState) String() string

func (*PRepStatusState) ToJSON added in v0.9.7

func (ps *PRepStatusState) ToJSON(blockHeight int64, bondRequirement int64, dsaMask int64) map[string]interface{}

func (*PRepStatusState) VFail added in v0.9.7

func (ps *PRepStatusState) VFail() int64

func (*PRepStatusState) VTotal added in v0.9.7

func (ps *PRepStatusState) VTotal() int64

type RewardCalcInfo

type RewardCalcInfo struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewRewardCalcInfo

func NewRewardCalcInfo() *RewardCalcInfo

func ToRewardCalcInfo

func ToRewardCalcInfo(object trie.Object) *RewardCalcInfo

func (*RewardCalcInfo) Clone

func (rc *RewardCalcInfo) Clone() *RewardCalcInfo

func (*RewardCalcInfo) Equal

func (rc *RewardCalcInfo) Equal(o icobject.Impl) bool

func (*RewardCalcInfo) Format added in v0.9.7

func (rc *RewardCalcInfo) Format(f fmt.State, c rune)

func (*RewardCalcInfo) GetResultInJSON added in v0.9.7

func (rc *RewardCalcInfo) GetResultInJSON() map[string]interface{}

func (*RewardCalcInfo) PrevCalcReward

func (rc *RewardCalcInfo) PrevCalcReward() *big.Int

func (*RewardCalcInfo) PrevHash added in v0.9.7

func (rc *RewardCalcInfo) PrevHash() []byte

func (*RewardCalcInfo) PrevHeight

func (rc *RewardCalcInfo) PrevHeight() int64

func (*RewardCalcInfo) PrevPeriod added in v0.9.7

func (rc *RewardCalcInfo) PrevPeriod() int64

func (*RewardCalcInfo) RLPDecodeFields

func (rc *RewardCalcInfo) RLPDecodeFields(decoder codec.Decoder) error

func (*RewardCalcInfo) RLPEncodeFields

func (rc *RewardCalcInfo) RLPEncodeFields(encoder codec.Encoder) error

func (*RewardCalcInfo) SetPrevCalcReward added in v0.9.7

func (rc *RewardCalcInfo) SetPrevCalcReward(v *big.Int)

func (*RewardCalcInfo) SetPrevHash added in v0.9.7

func (rc *RewardCalcInfo) SetPrevHash(hash []byte)

func (*RewardCalcInfo) SetPrevHeight added in v0.9.7

func (rc *RewardCalcInfo) SetPrevHeight(height int64)

func (*RewardCalcInfo) SetStartHeight added in v0.9.7

func (rc *RewardCalcInfo) SetStartHeight(height int64)

func (*RewardCalcInfo) StartHeight

func (rc *RewardCalcInfo) StartHeight() int64

func (*RewardCalcInfo) Update added in v0.9.7

func (rc *RewardCalcInfo) Update(blockHeight int64, reward *big.Int, hash []byte)

func (*RewardCalcInfo) Version

func (rc *RewardCalcInfo) Version() int

type RewardFund

type RewardFund struct {
	Iglobal *big.Int
	Iprep   *big.Int
	Icps    *big.Int
	Irelay  *big.Int
	Ivoter  *big.Int
}

func NewRewardFund

func NewRewardFund() *RewardFund

func (*RewardFund) Bytes

func (rf *RewardFund) Bytes() []byte

func (*RewardFund) Clone

func (rf *RewardFund) Clone() *RewardFund

func (*RewardFund) Equal

func (rf *RewardFund) Equal(rc2 *RewardFund) bool

func (*RewardFund) Format added in v0.9.7

func (rf *RewardFund) Format(f fmt.State, c rune)

func (*RewardFund) GetPRepFund

func (rf *RewardFund) GetPRepFund() *big.Int

func (*RewardFund) GetVoterFund

func (rf *RewardFund) GetVoterFund() *big.Int

func (*RewardFund) IsEmpty

func (rf *RewardFund) IsEmpty() bool

func (*RewardFund) RLPDecodeSelf

func (rf *RewardFund) RLPDecodeSelf(d codec.Decoder) error

func (*RewardFund) RLPEncodeSelf

func (rf *RewardFund) RLPEncodeSelf(e codec.Encoder) error

func (*RewardFund) ToJSON

func (rf *RewardFund) ToJSON() map[string]interface{}

type Snapshot

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

func NewSnapshot

func NewSnapshot(dbase db.Database, h []byte) *Snapshot

func NewSnapshotWithBuilder

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

func (*Snapshot) Bytes

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

func (*Snapshot) Flush

func (ss *Snapshot) Flush() error

func (*Snapshot) GetValue

func (ss *Snapshot) GetValue(key []byte) ([]byte, error)

type State

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

func NewStateFromSnapshot

func NewStateFromSnapshot(ss *Snapshot, readonly bool, logger log.Logger) *State

func NewStateFromTrie

func NewStateFromTrie(t trie.MutableForObject, readonly bool, logger log.Logger) *State

func (*State) CheckConsistentValidationPenalty added in v0.9.7

func (s *State) CheckConsistentValidationPenalty(revision int, ps *PRepStatusState) bool

func (*State) CheckValidationPenalty added in v0.9.7

func (s *State) CheckValidationPenalty(ps *PRepStatusState, blockHeight int64) bool

func (*State) ClearCache added in v0.9.7

func (s *State) ClearCache()

func (*State) DeleteIllegalDelegation added in v0.9.10

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

func (*State) DisablePRep added in v0.9.7

func (s *State) DisablePRep(owner module.Address, status Status, blockHeight int64) error

func (*State) Flush

func (s *State) Flush() error

func (*State) GetAccountSnapshot added in v0.9.7

func (s *State) GetAccountSnapshot(addr module.Address) *AccountSnapshot

func (*State) GetAccountState added in v0.9.7

func (s *State) GetAccountState(addr module.Address) *AccountState

func (*State) GetBondRequirement

func (s *State) GetBondRequirement() int64

func (*State) GetConsistentValidationPenaltyCondition

func (s *State) GetConsistentValidationPenaltyCondition() int64

func (*State) GetConsistentValidationPenaltyMask

func (s *State) GetConsistentValidationPenaltyMask() int

func (*State) GetConsistentValidationPenaltySlashRatio

func (s *State) GetConsistentValidationPenaltySlashRatio() int

func (*State) GetDelegationSlotMax added in v0.9.7

func (s *State) GetDelegationSlotMax() int

func (*State) GetExtraMainPRepCount added in v0.9.8

func (s *State) GetExtraMainPRepCount() int64

GetExtraMainPRepCount returns # of extra main preps Extra MainPRep means the PRep which plays a validator least recently

func (*State) GetIISSVersion

func (s *State) GetIISSVersion() int

func (*State) GetIRep

func (s *State) GetIRep() *big.Int

func (*State) GetIllegalDelegation added in v0.9.10

func (s *State) GetIllegalDelegation(addr module.Address) *IllegalDelegation

func (*State) GetIssue

func (s *State) GetIssue() (*Issue, error)

func (*State) GetLastBlockVotersSnapshot added in v0.9.8

func (s *State) GetLastBlockVotersSnapshot() *BlockVotersSnapshot

func (*State) GetLockMaxMultiplier

func (s *State) GetLockMaxMultiplier() *big.Int

func (*State) GetLockMinMultiplier

func (s *State) GetLockMinMultiplier() *big.Int

func (*State) GetMainPRepCount

func (s *State) GetMainPRepCount() int64

GetMainPRepCount returns the number of main preps including extra main preps This value is the number of main preps as configuration If you want to get the number of main preps in this term, use termData.MainPRepCount()

func (*State) GetNetworkInfoInJSON added in v1.0.0

func (s *State) GetNetworkInfoInJSON() (map[string]interface{}, error)

func (*State) GetNetworkScoreTimerSnapshot added in v1.1.0

func (s *State) GetNetworkScoreTimerSnapshot(height int64) *TimerSnapshot

func (*State) GetNetworkScoreTimerState added in v1.1.0

func (s *State) GetNetworkScoreTimerState(height int64) *TimerState

func (*State) GetNetworkScores added in v1.1.0

func (s *State) GetNetworkScores(cc icmodule.CallContext) map[string]module.Address

func (*State) GetNodeByOwner added in v0.9.7

func (s *State) GetNodeByOwner(owner module.Address) module.Address

func (*State) GetNonVotePenaltySlashRatio added in v1.2.0

func (s *State) GetNonVotePenaltySlashRatio() int

func (*State) GetOwnerByNode

func (s *State) GetOwnerByNode(node module.Address) module.Address

func (*State) GetPRepBaseByOwner added in v0.9.7

func (s *State) GetPRepBaseByOwner(owner module.Address, createIfNotExist bool) *PRepBaseState

func (*State) GetPRepByOwner added in v0.9.7

func (s *State) GetPRepByOwner(owner module.Address) *PRep

func (*State) GetPRepIllegalDelegated added in v0.9.10

func (s *State) GetPRepIllegalDelegated(address module.Address) *big.Int

func (*State) GetPRepSet added in v1.3.0

func (s *State) GetPRepSet(bc state.BTPContext, revision int) PRepSet

func (*State) GetPRepStatsInJSON added in v0.9.7

func (s *State) GetPRepStatsInJSON(rev int, blockHeight int64) (map[string]interface{}, error)

func (*State) GetPRepStatsList added in v1.3.7

func (s *State) GetPRepStatsList() ([]*PRepStats, error)

GetPRepStatsList returns PRepStatus list ordered by bonded delegation

func (*State) GetPRepStatsOfInJSON added in v1.3.7

func (s *State) GetPRepStatsOfInJSON(
	rev int, blockHeight int64, address module.Address) (map[string]interface{}, error)

func (*State) GetPRepStatusByOwner added in v0.9.7

func (s *State) GetPRepStatusByOwner(owner module.Address, createIfNotExist bool) *PRepStatusState

func (*State) GetPReps added in v1.3.0

func (s *State) GetPReps(activeOnly bool) []*PRep

func (*State) GetPRepsInJSON added in v0.9.7

func (s *State) GetPRepsInJSON(bc state.BTPContext, blockHeight int64, start, end int, revision int) (map[string]interface{}, error)

func (*State) GetRRep

func (s *State) GetRRep() *big.Int

func (*State) GetRewardCalcInfo

func (s *State) GetRewardCalcInfo() (*RewardCalcInfo, error)

func (*State) GetRewardFund

func (s *State) GetRewardFund() *RewardFund

func (*State) GetSnapshot

func (s *State) GetSnapshot() *Snapshot

func (*State) GetSubPRepCount

func (s *State) GetSubPRepCount() int64

GetSubPRepCount returns the number of sub preps excluding extra main preps

func (*State) GetTermPeriod

func (s *State) GetTermPeriod() int64

func (*State) GetTermSnapshot added in v0.9.8

func (s *State) GetTermSnapshot() *TermSnapshot

func (*State) GetTotalBond added in v0.9.7

func (s *State) GetTotalBond() *big.Int

func (*State) GetTotalDelegation added in v0.9.7

func (s *State) GetTotalDelegation() *big.Int

func (*State) GetTotalStake

func (s *State) GetTotalStake() *big.Int

func (*State) GetUnbondingMax

func (s *State) GetUnbondingMax() int64

func (*State) GetUnbondingPeriodMultiplier

func (s *State) GetUnbondingPeriodMultiplier() int64

func (*State) GetUnbondingTimerSnapshot added in v0.9.7

func (s *State) GetUnbondingTimerSnapshot(height int64) *TimerSnapshot

func (*State) GetUnbondingTimerState added in v0.9.7

func (s *State) GetUnbondingTimerState(height int64) *TimerState

func (*State) GetUnstakeLockPeriod added in v0.9.10

func (s *State) GetUnstakeLockPeriod(revision int, totalSupply *big.Int) int64

func (*State) GetUnstakeSlotMax

func (s *State) GetUnstakeSlotMax() int64

func (*State) GetUnstakingTimerSnapshot added in v0.9.7

func (s *State) GetUnstakingTimerSnapshot(height int64) *TimerSnapshot

func (*State) GetUnstakingTimerState added in v0.9.7

func (s *State) GetUnstakingTimerState(height int64) *TimerState

func (*State) GetValidationPenaltyCondition

func (s *State) GetValidationPenaltyCondition() int64

func (*State) GetValidatorsSnapshot added in v0.9.7

func (s *State) GetValidatorsSnapshot() *ValidatorsSnapshot

func (*State) ImposePenalty added in v0.9.7

func (s *State) ImposePenalty(owner module.Address, ps *PRepStatusState, blockHeight int64) error

ImposePenalty changes grade and set LastState to icstate.None

func (*State) IsDecentralizationConditionMet added in v0.9.7

func (s *State) IsDecentralizationConditionMet(revision int, totalSupply *big.Int, preps PRepSet) bool

func (*State) OnBlockVote added in v0.9.8

func (s *State) OnBlockVote(owner module.Address, voted bool, blockHeight int64) error

func (*State) OnMainPRepReplaced added in v0.9.8

func (s *State) OnMainPRepReplaced(blockHeight int64, oldOwner, newOwner module.Address) error

func (*State) OnValidatorOut added in v0.9.8

func (s *State) OnValidatorOut(blockHeight int64, owner module.Address) error

func (*State) ReducePRepBonded added in v1.2.9

func (s *State) ReducePRepBonded(owner module.Address, amount *big.Int) error

ReducePRepBonded handles to reduce PRepStatus.bonded Do not change PRep grade here Caution: amount should not include the amount from unbonded

func (*State) RegisterPRep added in v0.9.7

func (s *State) RegisterPRep(owner module.Address, ri *PRepInfo, irep *big.Int, irepHeight int64) error

func (*State) Reset

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

func (*State) SetBondRequirement

func (s *State) SetBondRequirement(value int64) error

func (*State) SetConsistentValidationPenaltyCondition

func (s *State) SetConsistentValidationPenaltyCondition(value int64) error

func (*State) SetConsistentValidationPenaltyMask

func (s *State) SetConsistentValidationPenaltyMask(value int64) error

func (*State) SetConsistentValidationPenaltySlashRatio

func (s *State) SetConsistentValidationPenaltySlashRatio(value int) error

func (*State) SetDelegationSlotMax added in v0.9.7

func (s *State) SetDelegationSlotMax(value int64) error

func (*State) SetExtraMainPRepCount added in v0.9.8

func (s *State) SetExtraMainPRepCount(value int64) error

func (*State) SetIISSVersion

func (s *State) SetIISSVersion(value int) error

func (*State) SetIRep

func (s *State) SetIRep(value *big.Int) error

func (*State) SetIllegalDelegation added in v0.9.10

func (s *State) SetIllegalDelegation(id *IllegalDelegation) error

func (*State) SetIssue

func (s *State) SetIssue(issue *Issue) error

func (*State) SetLastBlockVotersSnapshot added in v0.9.8

func (s *State) SetLastBlockVotersSnapshot(value *BlockVotersSnapshot) error

func (*State) SetLockVariables

func (s *State) SetLockVariables(lockMin *big.Int, lockMax *big.Int) error

func (*State) SetMainPRepCount

func (s *State) SetMainPRepCount(value int64) error

func (*State) SetNetworkScore added in v1.1.0

func (s *State) SetNetworkScore(role string, address module.Address) error

func (*State) SetNonVotePenaltySlashRatio added in v1.2.0

func (s *State) SetNonVotePenaltySlashRatio(value int) error

func (*State) SetPRep added in v0.9.7

func (s *State) SetPRep(blockHeight int64, owner module.Address, info *PRepInfo) (bool, error)

func (*State) SetPRepIllegalDelegated added in v0.9.10

func (s *State) SetPRepIllegalDelegated(address module.Address, value *big.Int) error

func (*State) SetRRep

func (s *State) SetRRep(value *big.Int) error

func (*State) SetRewardCalcInfo

func (s *State) SetRewardCalcInfo(rc *RewardCalcInfo) error

func (*State) SetRewardFund

func (s *State) SetRewardFund(rc *RewardFund) error

func (*State) SetSubPRepCount

func (s *State) SetSubPRepCount(value int64) error

func (*State) SetTermPeriod

func (s *State) SetTermPeriod(value int64) error

func (*State) SetTermSnapshot added in v0.9.8

func (s *State) SetTermSnapshot(term *TermSnapshot) error

func (*State) SetTotalBond added in v0.9.7

func (s *State) SetTotalBond(value *big.Int) error

func (*State) SetTotalDelegation added in v0.9.7

func (s *State) SetTotalDelegation(value *big.Int) error

func (*State) SetTotalStake

func (s *State) SetTotalStake(value *big.Int) error

func (*State) SetUnbondingMax

func (s *State) SetUnbondingMax(value int64) error

func (*State) SetUnbondingPeriodMultiplier

func (s *State) SetUnbondingPeriodMultiplier(value int64) error

func (*State) SetUnstakeSlotMax

func (s *State) SetUnstakeSlotMax(v int64) error

func (*State) SetValidationPenaltyCondition

func (s *State) SetValidationPenaltyCondition(value int) error

func (*State) SetValidatorsSnapshot added in v0.9.7

func (s *State) SetValidatorsSnapshot(vss *ValidatorsSnapshot) error

type Status

type Status int
const (
	Active Status = iota
	Unregistered
	Disqualified
	NotReady
)

func (Status) String

func (s Status) String() string

type TermSnapshot added in v0.9.8

type TermSnapshot struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewTermWithTag added in v0.9.7

func NewTermWithTag(_ icobject.Tag) *TermSnapshot

func ToTerm

func ToTerm(object trie.Object) *TermSnapshot

func (*TermSnapshot) BondRequirement added in v0.9.8

func (term *TermSnapshot) BondRequirement() int

func (*TermSnapshot) Equal added in v0.9.8

func (term *TermSnapshot) Equal(o icobject.Impl) bool

func (*TermSnapshot) Format added in v0.9.8

func (term *TermSnapshot) Format(f fmt.State, c rune)

func (*TermSnapshot) GetElectedPRepCount added in v0.9.8

func (term *TermSnapshot) GetElectedPRepCount() int

func (*TermSnapshot) GetEndHeight added in v0.9.8

func (term *TermSnapshot) GetEndHeight() int64

func (*TermSnapshot) GetIISSVersion added in v0.9.8

func (term *TermSnapshot) GetIISSVersion() int

func (*TermSnapshot) GetPRepSnapshotByIndex added in v0.9.8

func (term *TermSnapshot) GetPRepSnapshotByIndex(index int) *PRepSnapshot

func (*TermSnapshot) GetPRepSnapshotCount added in v0.9.8

func (term *TermSnapshot) GetPRepSnapshotCount() int

func (*TermSnapshot) GetVoteStartHeight added in v0.9.8

func (term *TermSnapshot) GetVoteStartHeight() int64

func (*TermSnapshot) Icps added in v0.9.8

func (term *TermSnapshot) Icps() *big.Int

func (*TermSnapshot) Iglobal added in v0.9.8

func (term *TermSnapshot) Iglobal() *big.Int

func (*TermSnapshot) Iprep added in v0.9.8

func (term *TermSnapshot) Iprep() *big.Int

func (*TermSnapshot) Irelay added in v0.9.8

func (term *TermSnapshot) Irelay() *big.Int

func (*TermSnapshot) Irep added in v0.9.8

func (term *TermSnapshot) Irep() *big.Int

func (*TermSnapshot) IsDecentralized added in v0.9.8

func (term *TermSnapshot) IsDecentralized() bool

func (*TermSnapshot) IsFirstBlockOnDecentralized added in v0.9.8

func (term *TermSnapshot) IsFirstBlockOnDecentralized(blockHeight int64) bool

func (*TermSnapshot) Ivoter added in v0.9.8

func (term *TermSnapshot) Ivoter() *big.Int

func (*TermSnapshot) MainPRepCount added in v0.9.8

func (term *TermSnapshot) MainPRepCount() int

func (*TermSnapshot) Period added in v0.9.8

func (term *TermSnapshot) Period() int64

func (*TermSnapshot) RLPDecodeFields added in v0.9.8

func (term *TermSnapshot) RLPDecodeFields(decoder codec.Decoder) error

func (*TermSnapshot) RLPEncodeFields added in v0.9.8

func (term *TermSnapshot) RLPEncodeFields(encoder codec.Encoder) error

func (*TermSnapshot) Revision added in v0.9.8

func (term *TermSnapshot) Revision() int

func (*TermSnapshot) RewardFund added in v0.9.8

func (term *TermSnapshot) RewardFund() *RewardFund

func (*TermSnapshot) Rrep added in v0.9.8

func (term *TermSnapshot) Rrep() *big.Int

func (*TermSnapshot) Sequence added in v0.9.8

func (term *TermSnapshot) Sequence() int

func (*TermSnapshot) StartHeight added in v0.9.8

func (term *TermSnapshot) StartHeight() int64

func (*TermSnapshot) String added in v0.9.8

func (term *TermSnapshot) String() string

func (*TermSnapshot) ToJSON added in v0.9.8

func (term *TermSnapshot) ToJSON(blockHeight int64, state *State) map[string]interface{}

func (*TermSnapshot) TotalSupply added in v0.9.8

func (term *TermSnapshot) TotalSupply() *big.Int

func (*TermSnapshot) Version added in v0.9.8

func (term *TermSnapshot) Version() int

type TermState added in v0.9.8

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

func GenesisTerm

func GenesisTerm(state *State, startHeight int64, revision int) *TermState

func NewNextTerm

func NewNextTerm(state *State, totalSupply *big.Int, revision int) *TermState

func (*TermState) BondRequirement added in v0.9.8

func (term *TermState) BondRequirement() int

func (*TermState) Format added in v0.9.8

func (term *TermState) Format(f fmt.State, c rune)

func (*TermState) GetElectedPRepCount added in v0.9.8

func (term *TermState) GetElectedPRepCount() int

func (*TermState) GetEndHeight added in v0.9.8

func (term *TermState) GetEndHeight() int64

func (*TermState) GetIISSVersion added in v0.9.8

func (term *TermState) GetIISSVersion() int

func (*TermState) GetPRepSnapshotByIndex added in v0.9.8

func (term *TermState) GetPRepSnapshotByIndex(index int) *PRepSnapshot

func (*TermState) GetPRepSnapshotCount added in v0.9.8

func (term *TermState) GetPRepSnapshotCount() int

func (*TermState) GetSnapshot added in v0.9.8

func (term *TermState) GetSnapshot() *TermSnapshot

func (*TermState) GetVoteStartHeight added in v0.9.8

func (term *TermState) GetVoteStartHeight() int64

func (*TermState) Icps added in v0.9.8

func (term *TermState) Icps() *big.Int

func (*TermState) Iglobal added in v0.9.8

func (term *TermState) Iglobal() *big.Int

func (*TermState) Iprep added in v0.9.8

func (term *TermState) Iprep() *big.Int

func (*TermState) Irelay added in v0.9.8

func (term *TermState) Irelay() *big.Int

func (*TermState) Irep added in v0.9.8

func (term *TermState) Irep() *big.Int

func (*TermState) IsDecentralized added in v0.9.8

func (term *TermState) IsDecentralized() bool

func (*TermState) IsFirstBlockOnDecentralized added in v0.9.8

func (term *TermState) IsFirstBlockOnDecentralized(blockHeight int64) bool

func (*TermState) Ivoter added in v0.9.8

func (term *TermState) Ivoter() *big.Int

func (*TermState) MainPRepCount added in v0.9.8

func (term *TermState) MainPRepCount() int

func (*TermState) Period added in v0.9.8

func (term *TermState) Period() int64

func (*TermState) ResetSequence added in v0.9.8

func (term *TermState) ResetSequence()

func (*TermState) Revision added in v0.9.8

func (term *TermState) Revision() int

func (*TermState) RewardFund added in v0.9.8

func (term *TermState) RewardFund() *RewardFund

func (*TermState) Rrep added in v0.9.8

func (term *TermState) Rrep() *big.Int

func (*TermState) Sequence added in v0.9.8

func (term *TermState) Sequence() int

func (*TermState) SetIrep added in v0.9.8

func (term *TermState) SetIrep(irep *big.Int)

func (*TermState) SetIsDecentralized added in v0.9.8

func (term *TermState) SetIsDecentralized(value bool)

func (*TermState) SetMainPRepCount added in v0.9.8

func (term *TermState) SetMainPRepCount(mainPRepCount int)

func (*TermState) SetPRepSnapshots added in v0.9.8

func (term *TermState) SetPRepSnapshots(prepSnapshots PRepSnapshots)

func (*TermState) SetRrep added in v0.9.8

func (term *TermState) SetRrep(rrep *big.Int)

func (*TermState) StartHeight added in v0.9.8

func (term *TermState) StartHeight() int64

func (*TermState) String added in v0.9.8

func (term *TermState) String() string

func (*TermState) ToJSON added in v0.9.8

func (term *TermState) ToJSON(blockHeight int64, state *State) map[string]interface{}

func (*TermState) TotalSupply added in v0.9.8

func (term *TermState) TotalSupply() *big.Int

type TimerCache

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

func (*TimerCache) Clear

func (c *TimerCache) Clear()

func (*TimerCache) Flush

func (c *TimerCache) Flush()

func (*TimerCache) Get

func (c *TimerCache) Get(height int64) *TimerState

func (*TimerCache) GetSnapshot added in v0.9.7

func (c *TimerCache) GetSnapshot(height int64) *TimerSnapshot

func (*TimerCache) Reset

func (c *TimerCache) Reset()

type TimerIterator added in v0.9.7

type TimerIterator interface {
	Get() (module.Address, bool)
	Next()
	Has() bool
}

type TimerJobInfo

type TimerJobInfo struct {
	Type   JobType
	Height int64
}

type TimerSnapshot added in v0.9.7

type TimerSnapshot struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func ToTimer

func ToTimer(object trie.Object) *TimerSnapshot

func (TimerSnapshot) Contains added in v0.9.7

func (t TimerSnapshot) Contains(addr module.Address) bool

func (*TimerSnapshot) Equal added in v0.9.7

func (t *TimerSnapshot) Equal(object icobject.Impl) bool

func (*TimerSnapshot) Format added in v0.9.10

func (t *TimerSnapshot) Format(f fmt.State, c rune)

func (TimerSnapshot) IndexOf added in v0.9.7

func (t TimerSnapshot) IndexOf(addr module.Address) int

func (TimerSnapshot) IsEmpty added in v0.9.7

func (t TimerSnapshot) IsEmpty() bool

func (TimerSnapshot) Iterator added in v0.9.7

func (t TimerSnapshot) Iterator() TimerIterator

func (*TimerSnapshot) RLPDecodeFields added in v0.9.7

func (t *TimerSnapshot) RLPDecodeFields(decoder codec.Decoder) error

func (*TimerSnapshot) RLPEncodeFields added in v0.9.7

func (t *TimerSnapshot) RLPEncodeFields(encoder codec.Encoder) error

func (*TimerSnapshot) Version added in v0.9.7

func (t *TimerSnapshot) Version() int

type TimerState added in v0.9.7

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

func NewTimerWithSnapshot added in v0.9.7

func NewTimerWithSnapshot(tss *TimerSnapshot) *TimerState

func (*TimerState) Add added in v0.9.7

func (t *TimerState) Add(address module.Address)

func (TimerState) Contains added in v0.9.7

func (t TimerState) Contains(addr module.Address) bool

func (*TimerState) Delete added in v0.9.7

func (t *TimerState) Delete(address module.Address)

func (*TimerState) Format added in v0.9.10

func (t *TimerState) Format(f fmt.State, c rune)

func (*TimerState) GetSnapshot added in v0.9.7

func (t *TimerState) GetSnapshot() *TimerSnapshot

func (TimerState) IndexOf added in v0.9.7

func (t TimerState) IndexOf(addr module.Address) int

func (TimerState) IsEmpty added in v0.9.7

func (t TimerState) IsEmpty() bool

func (TimerState) Iterator added in v0.9.7

func (t TimerState) Iterator() TimerIterator

func (*TimerState) Reset added in v0.9.7

func (t *TimerState) Reset(ts *TimerSnapshot) *TimerState

type Unbond

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

func NewUnbond added in v0.9.7

func NewUnbond(a *common.Address, v *big.Int, e int64) *Unbond

func (*Unbond) Address

func (u *Unbond) Address() *common.Address

func (*Unbond) Clone

func (u *Unbond) Clone() *Unbond

func (*Unbond) Equal

func (u *Unbond) Equal(o *Unbond) bool

func (*Unbond) Expire

func (u *Unbond) Expire() int64

func (*Unbond) Format added in v0.9.7

func (u *Unbond) Format(f fmt.State, c rune)

func (*Unbond) RLPDecodeSelf added in v0.9.7

func (u *Unbond) RLPDecodeSelf(decoder codec.Decoder) error

func (*Unbond) RLPEncodeSelf added in v0.9.7

func (u *Unbond) RLPEncodeSelf(encoder codec.Encoder) error

func (*Unbond) SetExpire added in v0.9.7

func (u *Unbond) SetExpire(e int64)

func (*Unbond) SetValue added in v0.9.7

func (u *Unbond) SetValue(v *big.Int)

func (*Unbond) Slash

func (u *Unbond) Slash(ratio int) *big.Int

func (*Unbond) ToJSON

func (u *Unbond) ToJSON() map[string]interface{}

func (*Unbond) Value

func (u *Unbond) Value() *big.Int

type Unbonds

type Unbonds []*Unbond

func (*Unbonds) Add

func (ul *Unbonds) Add(address module.Address, value *big.Int, expireHeight int64)

func (Unbonds) Clone

func (ul Unbonds) Clone() Unbonds

func (Unbonds) Contains added in v1.0.0

func (ul Unbonds) Contains(addr module.Address) bool

func (*Unbonds) Delete

func (ul *Unbonds) Delete(i int) error

func (*Unbonds) DeleteByAddress

func (ul *Unbonds) DeleteByAddress(address module.Address) error

func (Unbonds) Equal

func (ul Unbonds) Equal(ul2 Unbonds) bool

func (Unbonds) ExpireRefCount

func (ul Unbonds) ExpireRefCount() map[int64]int

func (Unbonds) GetUnbondAmount

func (ul Unbonds) GetUnbondAmount() *big.Int

func (Unbonds) GetUnbondByAddress

func (ul Unbonds) GetUnbondByAddress(address module.Address) (*Unbond, int)

func (Unbonds) IsEmpty added in v0.9.7

func (ul Unbonds) IsEmpty() bool

func (Unbonds) MapByAddr

func (ul Unbonds) MapByAddr() map[string]*Unbond

func (*Unbonds) Slash

func (ul *Unbonds) Slash(address module.Address, ratio int) (Unbonds, *big.Int, int64)

func (Unbonds) ToJSON

func (ul Unbonds) ToJSON(_ module.JSONVersion) []interface{}

type Unstake

type Unstake struct {
	Value  *big.Int `json:"unstake"`
	Expire int64    `json:"unstakeBlockHeight"`
}

Unstake is done on OnExecutionEnd of ExpireHeight

func NewUnstake added in v0.9.7

func NewUnstake(v *big.Int, e int64) *Unstake

func (*Unstake) Clone

func (u *Unstake) Clone() *Unstake

func (*Unstake) Equal

func (u *Unstake) Equal(u2 *Unstake) bool

func (Unstake) Format

func (u Unstake) Format(f fmt.State, c rune)

func (*Unstake) GetExpire added in v0.9.8

func (u *Unstake) GetExpire() int64

func (*Unstake) GetValue added in v0.9.8

func (u *Unstake) GetValue() *big.Int

func (*Unstake) RLPDecodeSelf added in v0.9.7

func (u *Unstake) RLPDecodeSelf(decoder codec.Decoder) error

func (*Unstake) RLPEncodeSelf added in v0.9.7

func (u *Unstake) RLPEncodeSelf(encoder codec.Encoder) error

func (Unstake) String

func (u Unstake) String() string

func (Unstake) ToJSON

func (u Unstake) ToJSON(_ module.JSONVersion, blockHeight int64) interface{}

type Unstakes

type Unstakes []*Unstake

func (Unstakes) Clone

func (us Unstakes) Clone() Unstakes

func (Unstakes) Equal

func (us Unstakes) Equal(us2 Unstakes) bool

func (Unstakes) GetUnstakeAmount

func (us Unstakes) GetUnstakeAmount() *big.Int

GetUnstakeAmount return unstake Value

func (Unstakes) IsEmpty added in v0.9.7

func (us Unstakes) IsEmpty() bool

func (Unstakes) ToJSON

func (us Unstakes) ToJSON(v module.JSONVersion, blockHeight int64) []interface{}

type ValidatorsSnapshot added in v0.9.7

type ValidatorsSnapshot struct {
	icobject.NoDatabase
	// contains filtered or unexported fields
}

func NewValidatorsSnapshotWithPRepSnapshot added in v0.9.7

func NewValidatorsSnapshotWithPRepSnapshot(
	prepSnapshots PRepSnapshots, ownerToNodeMapper OwnerToNodeMappable, size int) *ValidatorsSnapshot

func ToValidators added in v0.9.7

func ToValidators(object trie.Object) *ValidatorsSnapshot

func (*ValidatorsSnapshot) Equal added in v0.9.7

func (vss *ValidatorsSnapshot) Equal(object icobject.Impl) bool

func (*ValidatorsSnapshot) Format added in v0.9.7

func (vd *ValidatorsSnapshot) Format(f fmt.State, verb rune)

func (*ValidatorsSnapshot) Get added in v0.9.7

func (vd *ValidatorsSnapshot) Get(i int) module.Address

func (*ValidatorsSnapshot) IndexOf added in v0.9.7

func (vd *ValidatorsSnapshot) IndexOf(node module.Address) int

func (*ValidatorsSnapshot) IsUpdated added in v0.9.7

func (vss *ValidatorsSnapshot) IsUpdated(blockHeight int64) bool

IsUpdated returns true if validatorList is updated at this block

func (*ValidatorsSnapshot) Len added in v0.9.7

func (vd *ValidatorsSnapshot) Len() int

func (*ValidatorsSnapshot) NewValidatorSet added in v0.9.7

func (vd *ValidatorsSnapshot) NewValidatorSet() []module.Validator

func (*ValidatorsSnapshot) NextPRepSnapshotIndex added in v0.9.7

func (vd *ValidatorsSnapshot) NextPRepSnapshotIndex() int

func (*ValidatorsSnapshot) RLPDecodeFields added in v0.9.7

func (vss *ValidatorsSnapshot) RLPDecodeFields(decoder codec.Decoder) error

func (*ValidatorsSnapshot) RLPEncodeFields added in v0.9.7

func (vss *ValidatorsSnapshot) RLPEncodeFields(encoder codec.Encoder) error

func (*ValidatorsSnapshot) String added in v0.9.7

func (vd *ValidatorsSnapshot) String() string

func (*ValidatorsSnapshot) Version added in v0.9.7

func (vss *ValidatorsSnapshot) Version() int

type ValidatorsState added in v0.9.7

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

func NewValidatorsStateWithSnapshot added in v0.9.7

func NewValidatorsStateWithSnapshot(vss *ValidatorsSnapshot) *ValidatorsState

func (*ValidatorsState) Format added in v0.9.7

func (vd *ValidatorsState) Format(f fmt.State, verb rune)

func (*ValidatorsState) Get added in v0.9.7

func (vd *ValidatorsState) Get(i int) module.Address

func (*ValidatorsState) GetSnapshot added in v0.9.7

func (vs *ValidatorsState) GetSnapshot() *ValidatorsSnapshot

func (*ValidatorsState) IndexOf added in v0.9.7

func (vd *ValidatorsState) IndexOf(node module.Address) int

func (*ValidatorsState) IsDirty added in v0.9.7

func (vs *ValidatorsState) IsDirty() bool

func (*ValidatorsState) Len added in v0.9.7

func (vd *ValidatorsState) Len() int

func (*ValidatorsState) NewValidatorSet added in v0.9.7

func (vd *ValidatorsState) NewValidatorSet() []module.Validator

func (*ValidatorsState) NextPRepSnapshotIndex added in v0.9.7

func (vd *ValidatorsState) NextPRepSnapshotIndex() int

func (*ValidatorsState) Reset added in v0.9.7

func (vs *ValidatorsState) Reset(vss *ValidatorsSnapshot)

func (*ValidatorsState) Set added in v0.9.7

func (vs *ValidatorsState) Set(blockHeight int64, i, nextPssIdx int, node module.Address)

func (*ValidatorsState) String added in v0.9.7

func (vd *ValidatorsState) String() string

type VoteState added in v0.9.8

type VoteState int
const (
	None VoteState = iota
	Ready
	Success
	Failure
)

func (VoteState) String added in v0.9.8

func (vs VoteState) String() string

type Voting

type Voting interface {
	To() module.Address
	Amount() *big.Int
}

type VotingIterator

type VotingIterator interface {
	Has() bool
	Next() error
	Get() (Voting, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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