Documentation ¶
Index ¶
- Constants
- Variables
- func NetworkValueToJSON(s *State) map[string]interface{}
- func NewObjectImpl(tag icobject.Tag) (icobject.Impl, error)
- func NewVotingIterator(votings []Voting) *votingIterator
- func ScheduleTimerJob(t *Timer, info TimerJobInfo, address module.Address) error
- type Account
- func (a *Account) Address() module.Address
- func (a *Account) Bond() *big.Int
- func (a *Account) Bonds() Bonds
- func (a *Account) Clear()
- func (a *Account) Clone() *Account
- func (a *Account) DecreaseUnstake(stakeInc *big.Int, expireHeight int64, revision int) ([]TimerJobInfo, error)
- func (a *Account) Delegating() *big.Int
- func (a *Account) Delegations() Delegations
- func (a *Account) Equal(object icobject.Impl) bool
- func (a *Account) Format(f fmt.State, c rune)
- func (a *Account) GetBondsInJSON() []interface{}
- func (a Account) GetDelegationInJSON() map[string]interface{}
- func (a *Account) GetSnapshot() *Account
- func (a Account) GetStakeInJSON(blockHeight int64) map[string]interface{}
- func (a Account) GetTotalStake() *big.Int
- func (a *Account) GetUnbondsInJSON() []interface{}
- func (a Account) GetUnstakeAmount() *big.Int
- func (a *Account) GetVoting() *big.Int
- func (a *Account) GetVotingPower() *big.Int
- func (a *Account) IncreaseUnstake(stakeInc *big.Int, expireHeight int64, slotMax, revision int) ([]TimerJobInfo, error)
- func (a *Account) IsEmpty() bool
- func (a *Account) RLPDecodeFields(decoder codec.Decoder) error
- func (a *Account) RLPEncodeFields(encoder codec.Encoder) error
- func (a *Account) RemoveUnbonding(height int64) error
- func (a *Account) RemoveUnstaking(height int64) (ra *big.Int, err error)
- func (a *Account) Set(other *Account)
- func (a *Account) SetAddress(address module.Address)
- func (a *Account) SetBonds(bonds Bonds)
- func (a *Account) SetDelegation(ds Delegations)
- func (a *Account) SetStake(v *big.Int) error
- func (a *Account) SlashBond(address module.Address, ratio int) *big.Int
- func (a *Account) SlashStake(amount *big.Int) error
- func (a *Account) SlashUnbond(address module.Address, ratio int) (*big.Int, int64)
- func (a Account) Stake() *big.Int
- func (a *Account) String() string
- func (a *Account) Unbond() *big.Int
- func (a *Account) Unbonds() Unbonds
- func (a *Account) UpdateUnbonds(bondDelta map[string]*big.Int, expireHeight int64) ([]TimerJobInfo, error)
- func (a *Account) UsingStake() *big.Int
- func (a *Account) Version() int
- type AccountCache
- type ActivePRepCache
- func (c *ActivePRepCache) Add(owner module.Address)
- func (c *ActivePRepCache) Clear()
- func (c *ActivePRepCache) Flush()
- func (c *ActivePRepCache) Get(i int) module.Address
- func (c *ActivePRepCache) Remove(owner module.Address) error
- func (c *ActivePRepCache) Reset()
- func (c *ActivePRepCache) Size() int
- type Bond
- type BonderList
- type Bonds
- func (bl Bonds) Clone() Bonds
- func (bl *Bonds) Delete(i int) error
- func (bl Bonds) Equal(bl2 Bonds) bool
- func (bl Bonds) GetBondAmount() *big.Int
- func (bl Bonds) Has() bool
- func (bl *Bonds) Iterator() VotingIterator
- func (bl *Bonds) Slash(address module.Address, ratio int) *big.Int
- func (bl Bonds) ToJSON(v module.JSONVersion) []interface{}
- type Delegation
- type Delegations
- func (ds Delegations) Clone() Delegations
- func (ds *Delegations) Delete(i int) error
- func (ds Delegations) Equal(ds2 Delegations) bool
- func (ds Delegations) GetDelegationAmount() *big.Int
- func (ds Delegations) Has() bool
- func (ds *Delegations) Iterator() VotingIterator
- func (ds Delegations) ToJSON(_ module.JSONVersion) []interface{}
- type Grade
- type Issue
- type JobType
- type NodeOwnerCache
- type PRepBase
- func (p *PRepBase) BonderList() BonderList
- func (p *PRepBase) City() string
- func (p *PRepBase) Clear()
- func (p *PRepBase) Clone() *PRepBase
- func (p *PRepBase) Country() string
- func (p *PRepBase) Details() string
- func (p *PRepBase) Email() string
- func (p *PRepBase) Equal(object icobject.Impl) bool
- func (p *PRepBase) GetBonderListInJSON() []interface{}
- func (p *PRepBase) GetNode() module.Address
- func (p *PRepBase) GetSnapshot() *PRepBase
- func (p *PRepBase) IRep() *big.Int
- func (p *PRepBase) IRepHeight() int64
- func (p *PRepBase) IsEmpty() bool
- func (p *PRepBase) Name() string
- func (p *PRepBase) Node() module.Address
- func (p *PRepBase) Owner() module.Address
- func (p *PRepBase) P2pEndpoint() string
- func (p *PRepBase) RLPDecodeFields(d codec.Decoder) error
- func (p *PRepBase) RLPEncodeFields(e codec.Encoder) error
- func (p *PRepBase) Set(other *PRepBase)
- func (p *PRepBase) SetBonderList(bonderList BonderList)
- func (p *PRepBase) SetIrep(irep *big.Int, irepHeight int64)
- func (p *PRepBase) SetOwner(owner module.Address)
- func (p *PRepBase) SetPRep(name, email, website, country, city, details, endpoint string, ...) error
- func (p *PRepBase) ToJSON() map[string]interface{}
- func (p *PRepBase) Version() int
- func (p *PRepBase) Website() string
- type PRepBaseCache
- type PRepSnapshot
- func (pss *PRepSnapshot) BondedDelegation() *big.Int
- func (pss *PRepSnapshot) Clone() *PRepSnapshot
- func (pss *PRepSnapshot) Equal(other *PRepSnapshot) bool
- func (pss *PRepSnapshot) Owner() module.Address
- func (pss *PRepSnapshot) RLPDecodeSelf(d codec.Decoder) error
- func (pss *PRepSnapshot) RLPEncodeSelf(e codec.Encoder) error
- func (pss *PRepSnapshot) ToJSON() map[string]interface{}
- type PRepSnapshots
- type PRepStatus
- func (ps *PRepStatus) Bonded() *big.Int
- func (ps *PRepStatus) Clear()
- func (ps *PRepStatus) Clone() *PRepStatus
- func (ps *PRepStatus) Delegated() *big.Int
- func (ps *PRepStatus) Equal(o icobject.Impl) bool
- func (ps *PRepStatus) GetBondedDelegation(bondRequirement int64) *big.Int
- func (ps *PRepStatus) GetSnapshot() *PRepStatus
- func (ps *PRepStatus) GetStatsInJSON(blockHeight int64) map[string]interface{}
- func (ps *PRepStatus) GetVFail(blockHeight int64) int64
- func (ps *PRepStatus) GetVFailCont(blockHeight int64) int64
- func (ps *PRepStatus) GetVPenaltyCount() int
- func (ps *PRepStatus) GetVTotal(blockHeight int64) int64
- func (ps *PRepStatus) GetVoted() *big.Int
- func (ps *PRepStatus) Grade() Grade
- func (ps *PRepStatus) IncrementVPenalty()
- func (ps *PRepStatus) IsActive() bool
- func (ps *PRepStatus) IsEmpty() bool
- func (ps *PRepStatus) LastHeight() int64
- func (ps *PRepStatus) LastState() ValidationState
- func (ps *PRepStatus) OnPenaltyImposed(blockHeight int64) error
- func (ps *PRepStatus) Owner() module.Address
- func (ps *PRepStatus) RLPDecodeFields(decoder codec.Decoder) error
- func (ps *PRepStatus) RLPEncodeFields(encoder codec.Encoder) error
- func (ps *PRepStatus) ResetVFailContOffset()
- func (ps *PRepStatus) Set(other *PRepStatus)
- func (ps *PRepStatus) SetBonded(v *big.Int)
- func (ps *PRepStatus) SetDelegated(delegated *big.Int)
- func (ps *PRepStatus) SetGrade(g Grade)
- func (ps *PRepStatus) SetLastHeight(h int64)
- func (ps *PRepStatus) SetLastState(l ValidationState)
- func (ps *PRepStatus) SetOwner(owner module.Address)
- func (ps *PRepStatus) SetStatus(s Status)
- func (ps *PRepStatus) SetVFail(f int64)
- func (ps *PRepStatus) SetVPenaltyMask(p uint32)
- func (ps *PRepStatus) SetVTotal(t int64)
- func (ps *PRepStatus) ShiftVPenaltyMask(mask uint32)
- func (ps *PRepStatus) Status() Status
- func (ps *PRepStatus) String() string
- func (ps *PRepStatus) SyncBlockVoteStats(blockHeight int64) error
- func (ps *PRepStatus) ToJSON(blockHeight int64, bondRequirement int64) map[string]interface{}
- func (ps *PRepStatus) UpdateBlockVoteStats(blockHeight int64, voted bool) error
- func (ps *PRepStatus) VFail() int64
- func (ps *PRepStatus) VPenaltyMask() uint32
- func (ps *PRepStatus) VTotal() int64
- func (ps *PRepStatus) Version() int
- type PRepStatusCache
- type RewardCalcInfo
- func (rc *RewardCalcInfo) AdditionalReward() *big.Int
- func (rc *RewardCalcInfo) Clone() *RewardCalcInfo
- func (rc *RewardCalcInfo) Equal(o icobject.Impl) bool
- func (rc *RewardCalcInfo) GetEndHeight() int64
- func (rc *RewardCalcInfo) IsDecentralized() bool
- func (rc *RewardCalcInfo) Period() int64
- func (rc *RewardCalcInfo) PrevCalcReward() *big.Int
- func (rc *RewardCalcInfo) PrevHeight() int64
- func (rc *RewardCalcInfo) RLPDecodeFields(decoder codec.Decoder) error
- func (rc *RewardCalcInfo) RLPEncodeFields(encoder codec.Encoder) error
- func (rc *RewardCalcInfo) Start(blockHeight int64, period int64, isDecentralized bool, calcReward *big.Int, ...)
- func (rc *RewardCalcInfo) StartHeight() int64
- func (rc *RewardCalcInfo) Version() int
- type RewardFund
- func (rf *RewardFund) Bytes() []byte
- func (rf *RewardFund) Clone() *RewardFund
- func (rf *RewardFund) Equal(rc2 *RewardFund) bool
- func (rf *RewardFund) GetPRepFund() *big.Int
- func (rf *RewardFund) GetVoterFund() *big.Int
- func (rf *RewardFund) IsEmpty() bool
- func (rf *RewardFund) RLPDecodeSelf(d codec.Decoder) error
- func (rf *RewardFund) RLPEncodeSelf(e codec.Encoder) error
- func (rf *RewardFund) ToJSON() map[string]interface{}
- type Snapshot
- type State
- func (s *State) AddActivePRep(owner module.Address)
- func (s *State) AddNodeToOwner(node, owner module.Address) error
- func (s *State) Flush() error
- func (s *State) GetAccount(addr module.Address) *Account
- func (s *State) GetActivePRep(i int) module.Address
- func (s *State) GetActivePRepSize() int
- func (s *State) GetBondRequirement() int64
- func (s *State) GetConsistentValidationPenaltyCondition() *big.Int
- func (s *State) GetConsistentValidationPenaltyMask() *big.Int
- func (s *State) GetConsistentValidationPenaltySlashRatio() *big.Int
- func (s *State) GetIISSVersion() int
- func (s *State) GetIRep() *big.Int
- func (s *State) GetIssue() (*Issue, error)
- func (s *State) GetLastValidators() []module.Address
- func (s *State) GetLockMaxMultiplier() *big.Int
- func (s *State) GetLockMinMultiplier() *big.Int
- func (s *State) GetMainPRepCount() int64
- func (s *State) GetOwnerByNode(node module.Address) module.Address
- func (s *State) GetPRepBase(owner module.Address, createIfNotExist bool) *PRepBase
- func (s *State) GetPRepCount() int64
- func (s *State) GetPRepStatus(owner module.Address, createIfNotExist bool) *PRepStatus
- func (s *State) GetRRep() *big.Int
- func (s *State) GetRewardCalcInfo() (*RewardCalcInfo, error)
- func (s *State) GetRewardFund() *RewardFund
- func (s *State) GetSnapshot() *Snapshot
- func (s *State) GetSubPRepCount() int64
- func (s *State) GetTerm() *Term
- func (s *State) GetTermPeriod() int64
- func (s *State) GetTotalStake() *big.Int
- func (s *State) GetUnbondingMax() *big.Int
- func (s *State) GetUnbondingPeriodMultiplier() int64
- func (s *State) GetUnbondingTimer(height int64, createIfNotExist bool) *Timer
- func (s *State) GetUnstakeSlotMax() int64
- func (s *State) GetUnstakingTimer(height int64, createIfNotExist bool) *Timer
- func (s *State) GetValidationPenaltyCondition() *big.Int
- func (s *State) RemoveActivePRep(owner module.Address) error
- func (s *State) Reset(ss *Snapshot) error
- func (s *State) SetBondRequirement(value int64) error
- func (s *State) SetConsistentValidationPenaltyCondition(value *big.Int) error
- func (s *State) SetConsistentValidationPenaltyMask(value *big.Int) error
- func (s *State) SetConsistentValidationPenaltySlashRatio(value *big.Int) error
- func (s *State) SetIISSVersion(value int) error
- func (s *State) SetIRep(value *big.Int) error
- func (s *State) SetIssue(issue *Issue) error
- func (s *State) SetLastValidators(al []module.Address) error
- func (s *State) SetLockVariables(lockMin *big.Int, lockMax *big.Int) error
- func (s *State) SetMainPRepCount(value int64) error
- func (s *State) SetRRep(value *big.Int) error
- func (s *State) SetRewardCalcInfo(rc *RewardCalcInfo) error
- func (s *State) SetRewardFund(rc *RewardFund) error
- func (s *State) SetSubPRepCount(value int64) error
- func (s *State) SetTerm(term *Term) error
- func (s *State) SetTermPeriod(value int64) error
- func (s *State) SetTotalStake(value *big.Int) error
- func (s *State) SetUnbondingMax(value *big.Int) error
- func (s *State) SetUnbondingPeriodMultiplier(value int64) error
- func (s *State) SetUnstakeSlotMax(v int64) error
- func (s *State) SetValidationPenaltyCondition(value *big.Int) error
- type StateAndSnapshot
- type Status
- type Term
- func (term *Term) BondRequirement() int
- func (term *Term) Clone() *Term
- func (term *Term) Equal(o icobject.Impl) bool
- func (term *Term) GetElectedPRepCount() int
- func (term *Term) GetEndBlockHeight() int64
- func (term *Term) GetFlag() TermFlag
- func (term *Term) GetIISSVersion() int
- func (term *Term) GetPRepSnapshotByIndex(index int) *PRepSnapshot
- func (term *Term) GetPRepSnapshotByOwner(owner module.Address) *PRepSnapshot
- func (term *Term) GetPRepSnapshotCount() int
- func (term *Term) GetSnapshot(store *icobject.ObjectStoreState) error
- func (term *Term) GetTotalBondedDelegation() *big.Int
- func (term *Term) Icps() *big.Int
- func (term *Term) Iglobal() *big.Int
- func (term *Term) Iprep() *big.Int
- func (term *Term) Irelay() *big.Int
- func (term *Term) Irep() *big.Int
- func (term *Term) IsAnyFlagOn(flags TermFlag) bool
- func (term *Term) IsDecentralized() bool
- func (term *Term) IsUpdated() bool
- func (term *Term) Ivoter() *big.Int
- func (term *Term) MainPRepCount() int
- func (term *Term) Period() int64
- func (term *Term) RLPDecodeFields(decoder codec.Decoder) error
- func (term *Term) RLPEncodeFields(encoder codec.Encoder) error
- func (term *Term) RemovePRepSnapshot(owner module.Address) error
- func (term *Term) ResetFlag()
- func (term *Term) ResetSequence()
- func (term *Term) Revision() int
- func (term *Term) RewardFund() *RewardFund
- func (term *Term) Rrep() *big.Int
- func (term *Term) Sequence() int
- func (term *Term) Set(other *Term)
- func (term *Term) SetFlag(flags TermFlag, on bool)
- func (term *Term) SetIrep(irep *big.Int)
- func (term *Term) SetMainPRepCount(mainPRepCount int)
- func (term *Term) SetPRepSnapshots(prepSnapshots []*PRepSnapshot)
- func (term *Term) SetRrep(rrep *big.Int)
- func (term *Term) StartHeight() int64
- func (term *Term) String() string
- func (term *Term) ToJSON() map[string]interface{}
- func (term *Term) TotalDelegated() *big.Int
- func (term *Term) TotalSupply() *big.Int
- func (term *Term) Version() int
- type TermFlag
- type Timer
- func (t *Timer) Add(address module.Address)
- func (t *Timer) Clear()
- func (t *Timer) Clone() *Timer
- func (t *Timer) Delete(address module.Address) error
- func (t *Timer) Equal(object icobject.Impl) bool
- func (t Timer) IsEmpty() bool
- func (t *Timer) RLPDecodeFields(decoder codec.Decoder) error
- func (t *Timer) RLPEncodeFields(encoder codec.Encoder) error
- func (t *Timer) Set(other *Timer)
- func (t *Timer) Version() int
- type TimerCache
- type TimerJobInfo
- type Unbond
- type Unbonds
- func (ul *Unbonds) Add(address module.Address, value *big.Int, expireHeight int64)
- func (ul Unbonds) Clone() Unbonds
- func (ul *Unbonds) Delete(i int) error
- func (ul *Unbonds) DeleteByAddress(address module.Address) error
- func (ul Unbonds) Equal(ul2 Unbonds) bool
- func (ul Unbonds) ExpireRefCount() map[int64]int
- func (ul Unbonds) GetUnbondAmount() *big.Int
- func (ul Unbonds) GetUnbondByAddress(address module.Address) (*Unbond, int)
- func (ul Unbonds) Has() bool
- func (ul Unbonds) MapByAddr() map[string]*Unbond
- func (ul *Unbonds) Slash(address module.Address, ratio int) (*big.Int, int64)
- func (ul Unbonds) ToJSON(_ module.JSONVersion) []interface{}
- type Unstake
- type Unstakes
- type ValidationState
- type Voting
- type VotingIterator
Constants ¶
const ( VarIRep = "irep" VarRRep = "rrep" VarMainPRepCount = "main_prep_count" VarSubPRepCount = "sub_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" )
const ( IISSVersion1 int = iota // IISS 2.0 IISSVersion2 // IISS 3.1 )
const ( TypeAccount int = iota TypePRepBase TypePRepStatus TypeTimer TypeIssue TypeTerm TypeRewardCalcInfo )
Variables ¶
var ( IssueKey = containerdb.ToKey(containerdb.HashBuilder, "issue_icx").Build() RewardCalcInfoKey = containerdb.ToKey(containerdb.HashBuilder, "reward_calc_info").Build() LastValidatorsKey = containerdb.ToKey( containerdb.HashBuilder, scoredb.ArrayDBPrefix, "last_validators", ) UnstakeSlotMaxKey = containerdb.ToKey( containerdb.HashBuilder, scoredb.VarDBPrefix, "unstake_slot_max", ) )
var AccountDictPrefix = containerdb.ToKey( containerdb.HashBuilder, scoredb.DictDBPrefix, "account_db", )
var UnbondingPeriod = int64(10)
Functions ¶
func NetworkValueToJSON ¶
func NewVotingIterator ¶
func NewVotingIterator(votings []Voting) *votingIterator
func ScheduleTimerJob ¶
func ScheduleTimerJob(t *Timer, info TimerJobInfo, address module.Address) error
Types ¶
type Account ¶
type Account struct { icobject.NoDatabase StateAndSnapshot // contains filtered or unexported fields }
Account containing IISS information
func (*Account) DecreaseUnstake ¶
func (*Account) Delegating ¶
func (*Account) Delegations ¶
func (a *Account) Delegations() Delegations
func (*Account) GetBondsInJSON ¶
func (a *Account) GetBondsInJSON() []interface{}
func (Account) GetDelegationInJSON ¶
func (*Account) GetSnapshot ¶
func (Account) GetStakeInJSON ¶
GetStakeInJSON returns stake and unstake information in json format
func (Account) GetTotalStake ¶
GetTotalStake return stake + unstake Value
func (*Account) GetUnbondsInJSON ¶
func (a *Account) GetUnbondsInJSON() []interface{}
func (Account) GetUnstakeAmount ¶
GetUnstakeAmount return unstake Value
func (*Account) GetVotingPower ¶
func (*Account) IncreaseUnstake ¶
func (*Account) RemoveUnbonding ¶
func (*Account) RemoveUnstaking ¶
func (*Account) SetAddress ¶
func (*Account) SetDelegation ¶
func (a *Account) SetDelegation(ds Delegations)
func (*Account) SlashUnbond ¶
func (*Account) UpdateUnbonds ¶
func (*Account) UsingStake ¶
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) *Account
func (*AccountCache) Reset ¶
func (c *AccountCache) Reset()
type ActivePRepCache ¶
type ActivePRepCache struct {
// contains filtered or unexported fields
}
func (*ActivePRepCache) Add ¶
func (c *ActivePRepCache) Add(owner module.Address)
A new PRep is registered
func (*ActivePRepCache) Clear ¶
func (c *ActivePRepCache) Clear()
func (*ActivePRepCache) Flush ¶
func (c *ActivePRepCache) Flush()
func (*ActivePRepCache) Remove ¶
func (c *ActivePRepCache) Remove(owner module.Address) error
An active PRep is removed
func (*ActivePRepCache) Reset ¶
func (c *ActivePRepCache) Reset()
Reset recovers data which is in the list of Map as of now
func (*ActivePRepCache) Size ¶
func (c *ActivePRepCache) Size() int
type BonderList ¶
func NewBonderList ¶
func NewBonderList(param []interface{}) (BonderList, error)
func (BonderList) Clone ¶
func (bl BonderList) Clone() BonderList
func (BonderList) Equal ¶
func (bl BonderList) Equal(bl2 BonderList) bool
func (BonderList) ToJSON ¶
func (bl BonderList) ToJSON() []interface{}
type Bonds ¶
type Bonds []*Bond
func (Bonds) GetBondAmount ¶
func (*Bonds) Iterator ¶
func (bl *Bonds) Iterator() VotingIterator
func (Bonds) ToJSON ¶
func (bl Bonds) ToJSON(v module.JSONVersion) []interface{}
type Delegation ¶
type Delegation struct { Address *common.Address `json:"address"` Value *common.HexInt `json:"value"` }
func NewDelegation ¶
func NewDelegation() *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) 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{}) (Delegations, error)
func (Delegations) Clone ¶
func (ds Delegations) Clone() Delegations
func (*Delegations) Delete ¶
func (ds *Delegations) Delete(i int) error
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{}
type Issue ¶
type Issue struct { icobject.NoDatabase TotalIssued *big.Int // amount of issued ICX while current calculation period PrevTotalIssued *big.Int // amount of issued ICX while previous calculation period OverIssued *big.Int // PrevTotalIssued - reward calculated by calculator IScoreRemains *big.Int // not issued ICX PrevBlockFee *big.Int }
func (*Issue) ResetTotalIssued ¶
func (i *Issue) ResetTotalIssued()
type NodeOwnerCache ¶
type NodeOwnerCache struct {
// contains filtered or unexported fields
}
TODO: Remove old nodes which is not used anymore
func (*NodeOwnerCache) Clear ¶
func (c *NodeOwnerCache) Clear()
func (*NodeOwnerCache) Flush ¶
func (c *NodeOwnerCache) Flush()
func (*NodeOwnerCache) Reset ¶
func (c *NodeOwnerCache) Reset()
type PRepBase ¶
type PRepBase struct { icobject.NoDatabase StateAndSnapshot // contains filtered or unexported fields }
func NewPRepBase ¶
func (*PRepBase) BonderList ¶
func (p *PRepBase) BonderList() BonderList
func (*PRepBase) GetBonderListInJSON ¶
func (p *PRepBase) GetBonderListInJSON() []interface{}
func (*PRepBase) GetSnapshot ¶
func (*PRepBase) IRepHeight ¶
func (*PRepBase) P2pEndpoint ¶
func (*PRepBase) SetBonderList ¶
func (p *PRepBase) SetBonderList(bonderList BonderList)
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) *PRepBase
func (*PRepBaseCache) Reset ¶
func (c *PRepBaseCache) Reset()
type PRepSnapshot ¶
type PRepSnapshot struct {
// contains filtered or unexported fields
}
func NewPRepSnapshotFromPRepStatus ¶
func NewPRepSnapshotFromPRepStatus(ps *PRepStatus, bondRequirement int64) *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) RLPDecodeSelf ¶
func (pss *PRepSnapshot) RLPDecodeSelf(d codec.Decoder) error
func (*PRepSnapshot) RLPEncodeSelf ¶
func (pss *PRepSnapshot) RLPEncodeSelf(e codec.Encoder) error
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
type PRepStatus ¶
type PRepStatus struct { icobject.NoDatabase StateAndSnapshot // contains filtered or unexported fields }
func NewPRepStatus ¶
func NewPRepStatus(owner module.Address) *PRepStatus
func ToPRepStatus ¶
func ToPRepStatus(object trie.Object, owner module.Address) *PRepStatus
func (*PRepStatus) Bonded ¶
func (ps *PRepStatus) Bonded() *big.Int
func (*PRepStatus) Clear ¶
func (ps *PRepStatus) Clear()
func (*PRepStatus) Clone ¶
func (ps *PRepStatus) Clone() *PRepStatus
func (*PRepStatus) Delegated ¶
func (ps *PRepStatus) Delegated() *big.Int
func (*PRepStatus) GetBondedDelegation ¶
func (ps *PRepStatus) GetBondedDelegation(bondRequirement int64) *big.Int
Bond Delegation formula totalVoted = bond + delegation bondRatio = bond / totalVoted * 100 bondedDelegation = totalVoted * (bondRatio / bondRequirement)
= bond * 100 / bondRequirement
if bondedDelegation > totalVoted
bondedDelegation = totalVoted
func (*PRepStatus) GetSnapshot ¶
func (ps *PRepStatus) GetSnapshot() *PRepStatus
func (*PRepStatus) GetStatsInJSON ¶
func (ps *PRepStatus) GetStatsInJSON(blockHeight int64) map[string]interface{}
func (*PRepStatus) GetVFail ¶
func (ps *PRepStatus) GetVFail(blockHeight int64) int64
GetVFail returns the calculated number of validation failures
func (*PRepStatus) GetVFailCont ¶
func (ps *PRepStatus) GetVFailCont(blockHeight int64) int64
GetVFailCont returns the number of consecutive validation failures
func (*PRepStatus) GetVPenaltyCount ¶
func (ps *PRepStatus) GetVPenaltyCount() int
func (*PRepStatus) GetVTotal ¶
func (ps *PRepStatus) GetVTotal(blockHeight int64) int64
GetVTotal returns the calculated number of validation
func (*PRepStatus) GetVoted ¶
func (ps *PRepStatus) GetVoted() *big.Int
func (*PRepStatus) Grade ¶
func (ps *PRepStatus) Grade() Grade
func (*PRepStatus) IncrementVPenalty ¶
func (ps *PRepStatus) IncrementVPenalty()
func (*PRepStatus) IsActive ¶
func (ps *PRepStatus) IsActive() bool
func (*PRepStatus) IsEmpty ¶
func (ps *PRepStatus) IsEmpty() bool
func (*PRepStatus) LastHeight ¶
func (ps *PRepStatus) LastHeight() int64
func (*PRepStatus) LastState ¶
func (ps *PRepStatus) LastState() ValidationState
func (*PRepStatus) OnPenaltyImposed ¶
func (ps *PRepStatus) OnPenaltyImposed(blockHeight int64) error
func (*PRepStatus) Owner ¶
func (ps *PRepStatus) Owner() module.Address
func (*PRepStatus) RLPDecodeFields ¶
func (ps *PRepStatus) RLPDecodeFields(decoder codec.Decoder) error
func (*PRepStatus) RLPEncodeFields ¶
func (ps *PRepStatus) RLPEncodeFields(encoder codec.Encoder) error
func (*PRepStatus) ResetVFailContOffset ¶
func (ps *PRepStatus) ResetVFailContOffset()
func (*PRepStatus) Set ¶
func (ps *PRepStatus) Set(other *PRepStatus)
func (*PRepStatus) SetBonded ¶
func (ps *PRepStatus) SetBonded(v *big.Int)
func (*PRepStatus) SetDelegated ¶
func (ps *PRepStatus) SetDelegated(delegated *big.Int)
func (*PRepStatus) SetGrade ¶
func (ps *PRepStatus) SetGrade(g Grade)
func (*PRepStatus) SetLastHeight ¶
func (ps *PRepStatus) SetLastHeight(h int64)
func (*PRepStatus) SetLastState ¶
func (ps *PRepStatus) SetLastState(l ValidationState)
func (*PRepStatus) SetOwner ¶
func (ps *PRepStatus) SetOwner(owner module.Address)
func (*PRepStatus) SetStatus ¶
func (ps *PRepStatus) SetStatus(s Status)
func (*PRepStatus) SetVFail ¶
func (ps *PRepStatus) SetVFail(f int64)
func (*PRepStatus) SetVPenaltyMask ¶
func (ps *PRepStatus) SetVPenaltyMask(p uint32)
func (*PRepStatus) SetVTotal ¶
func (ps *PRepStatus) SetVTotal(t int64)
func (*PRepStatus) ShiftVPenaltyMask ¶
func (ps *PRepStatus) ShiftVPenaltyMask(mask uint32)
func (*PRepStatus) Status ¶
func (ps *PRepStatus) Status() Status
func (*PRepStatus) String ¶
func (ps *PRepStatus) String() string
func (*PRepStatus) SyncBlockVoteStats ¶
func (ps *PRepStatus) SyncBlockVoteStats(blockHeight int64) error
func (*PRepStatus) ToJSON ¶
func (ps *PRepStatus) ToJSON(blockHeight int64, bondRequirement int64) map[string]interface{}
func (*PRepStatus) UpdateBlockVoteStats ¶
func (ps *PRepStatus) UpdateBlockVoteStats(blockHeight int64, voted bool) error
UpdateBlockVoteStats updates Penalty-related info based on ConsensusInfo
func (*PRepStatus) VFail ¶
func (ps *PRepStatus) VFail() int64
func (*PRepStatus) VPenaltyMask ¶
func (ps *PRepStatus) VPenaltyMask() uint32
func (*PRepStatus) VTotal ¶
func (ps *PRepStatus) VTotal() int64
func (*PRepStatus) Version ¶
func (ps *PRepStatus) Version() int
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) *PRepStatus
func (*PRepStatusCache) Reset ¶
func (c *PRepStatusCache) Reset()
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) AdditionalReward ¶
func (rc *RewardCalcInfo) AdditionalReward() *big.Int
func (*RewardCalcInfo) Clone ¶
func (rc *RewardCalcInfo) Clone() *RewardCalcInfo
func (*RewardCalcInfo) GetEndHeight ¶
func (rc *RewardCalcInfo) GetEndHeight() int64
func (*RewardCalcInfo) IsDecentralized ¶
func (rc *RewardCalcInfo) IsDecentralized() bool
func (*RewardCalcInfo) Period ¶
func (rc *RewardCalcInfo) Period() int64
func (*RewardCalcInfo) PrevCalcReward ¶
func (rc *RewardCalcInfo) PrevCalcReward() *big.Int
func (*RewardCalcInfo) PrevHeight ¶
func (rc *RewardCalcInfo) PrevHeight() 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) StartHeight ¶
func (rc *RewardCalcInfo) StartHeight() int64
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) 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 NewSnapshotWithBuilder ¶
func (*Snapshot) GetRewardCalcInfo ¶
func (ss *Snapshot) GetRewardCalcInfo() (*RewardCalcInfo, error)
type State ¶
type State struct {
// contains filtered or unexported fields
}
func NewStateFromSnapshot ¶
func NewStateFromTrie ¶
func NewStateFromTrie(t trie.MutableForObject, readonly bool) *State
func (*State) AddActivePRep ¶
func (*State) GetActivePRepSize ¶
func (*State) GetBondRequirement ¶
func (*State) GetConsistentValidationPenaltyCondition ¶
func (*State) GetConsistentValidationPenaltyMask ¶
func (*State) GetConsistentValidationPenaltySlashRatio ¶
func (*State) GetIISSVersion ¶
func (*State) GetLastValidators ¶
func (*State) GetLockMaxMultiplier ¶
func (*State) GetLockMinMultiplier ¶
func (*State) GetPRepBase ¶
func (*State) GetPRepCount ¶
GetPRepCount returns the number of mainPReps and subPReps based on ICON Network Value
func (*State) GetPRepStatus ¶
func (s *State) GetPRepStatus(owner module.Address, createIfNotExist bool) *PRepStatus
func (*State) GetRewardCalcInfo ¶
func (s *State) GetRewardCalcInfo() (*RewardCalcInfo, error)
func (*State) GetRewardFund ¶
func (s *State) GetRewardFund() *RewardFund
func (*State) GetSnapshot ¶
func (*State) GetTermPeriod ¶
func (*State) GetTotalStake ¶
func (*State) GetUnbondingMax ¶
func (*State) GetUnbondingPeriodMultiplier ¶
func (*State) GetUnbondingTimer ¶
func (*State) GetUnstakeSlotMax ¶
func (*State) GetUnstakingTimer ¶
func (*State) GetValidationPenaltyCondition ¶
func (*State) SetBondRequirement ¶
func (*State) SetConsistentValidationPenaltyCondition ¶
func (*State) SetConsistentValidationPenaltyMask ¶
func (*State) SetConsistentValidationPenaltySlashRatio ¶
func (*State) SetIISSVersion ¶
func (*State) SetLockVariables ¶
func (*State) SetMainPRepCount ¶
func (*State) SetRewardCalcInfo ¶
func (s *State) SetRewardCalcInfo(rc *RewardCalcInfo) error
func (*State) SetRewardFund ¶
func (s *State) SetRewardFund(rc *RewardFund) error
func (*State) SetSubPRepCount ¶
func (*State) SetTermPeriod ¶
func (*State) SetUnbondingPeriodMultiplier ¶
func (*State) SetUnstakeSlotMax ¶
type StateAndSnapshot ¶
type StateAndSnapshot struct {
// contains filtered or unexported fields
}
func (*StateAndSnapshot) IsReadonly ¶
func (s *StateAndSnapshot) IsReadonly() bool
type Term ¶
type Term struct { icobject.NoDatabase StateAndSnapshot // contains filtered or unexported fields }
func NewNextTerm ¶
func (*Term) BondRequirement ¶
func (*Term) GetElectedPRepCount ¶
func (*Term) GetEndBlockHeight ¶
func (*Term) GetIISSVersion ¶
func (*Term) GetPRepSnapshotByIndex ¶
func (term *Term) GetPRepSnapshotByIndex(index int) *PRepSnapshot
func (*Term) GetPRepSnapshotByOwner ¶
func (term *Term) GetPRepSnapshotByOwner(owner module.Address) *PRepSnapshot
func (*Term) GetPRepSnapshotCount ¶
func (*Term) GetSnapshot ¶
func (term *Term) GetSnapshot(store *icobject.ObjectStoreState) error
func (*Term) GetTotalBondedDelegation ¶
func (*Term) IsAnyFlagOn ¶
func (*Term) IsDecentralized ¶
func (*Term) MainPRepCount ¶
func (*Term) ResetSequence ¶
func (term *Term) ResetSequence()
func (*Term) RewardFund ¶
func (term *Term) RewardFund() *RewardFund
func (*Term) SetMainPRepCount ¶
func (*Term) SetPRepSnapshots ¶
func (term *Term) SetPRepSnapshots(prepSnapshots []*PRepSnapshot)
func (*Term) StartHeight ¶
func (*Term) TotalDelegated ¶
func (*Term) TotalSupply ¶
type Timer ¶
type Timer struct { icobject.NoDatabase StateAndSnapshot Addresses addresses }
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) Reset ¶
func (c *TimerCache) Reset()
type TimerJobInfo ¶
type Unbonds ¶
type Unbonds []*Unbond
func (Unbonds) ExpireRefCount ¶
func (Unbonds) GetUnbondAmount ¶
func (Unbonds) GetUnbondByAddress ¶
func (Unbonds) ToJSON ¶
func (ul Unbonds) ToJSON(_ module.JSONVersion) []interface{}
type Unstake ¶
type Unstakes ¶
type Unstakes []*Unstake
func (Unstakes) GetUnstakeAmount ¶
GetUnstakeAmount return unstake Value
type ValidationState ¶
type ValidationState int
const ( None ValidationState = iota Ready Success Failure )
func (ValidationState) String ¶
func (vs ValidationState) String() string