Documentation
¶
Overview ¶
* Copyright 2020 ICON Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- Variables
- func GetIssueData(es *ExtensionStateImpl) (*IssuePRepJSON, *IssueResultJSON)
- func NewExtensionSnapshot(database db.Database, hash []byte) state.ExtensionSnapshot
- func NewExtensionSnapshotWithBuilder(builder merkle.Builder, raw []byte) state.ExtensionSnapshot
- func RegisterBaseTx()
- func RegulateIssueInfo(issue *icstate.Issue, iScore *big.Int, additionalReward *big.Int)
- type Calculator
- func (c *Calculator) Back() *icstage.Snapshot
- func (c *Calculator) Base() *icreward.Snapshot
- func (c *Calculator) CheckToRun(ess state.ExtensionSnapshot) bool
- func (c *Calculator) IsCalcDone(blockHeight int64) bool
- func (c *Calculator) Result() *icreward.Snapshot
- func (c *Calculator) Run(ess state.ExtensionSnapshot, logger log.Logger) (err error)
- func (c *Calculator) StartHeight() int64
- func (c *Calculator) Temp() *icreward.State
- func (c *Calculator) TotalReward() *big.Int
- type ExtensionSnapshotImpl
- func (s *ExtensionSnapshotImpl) Bytes() []byte
- func (s *ExtensionSnapshotImpl) Flush() error
- func (s *ExtensionSnapshotImpl) NewState(readonly bool) state.ExtensionState
- func (s *ExtensionSnapshotImpl) RLPDecodeSelf(d codec.Decoder) error
- func (s *ExtensionSnapshotImpl) RLPEncodeSelf(e codec.Encoder) error
- type ExtensionStateImpl
- func (s *ExtensionStateImpl) AddEventBond(blockHeight int64, from module.Address, delta map[string]*big.Int) (err error)
- func (s *ExtensionStateImpl) CalculationBlockHeight() int64
- func (s *ExtensionStateImpl) ClearCache()
- func (s *ExtensionStateImpl) DisqualifyPRep(owner module.Address) error
- func (s *ExtensionStateImpl) GenesisTerm(blockHeight int64, revision int) error
- func (s *ExtensionStateImpl) GetAccount(address module.Address) *icstate.Account
- func (s *ExtensionStateImpl) GetBondRequirement() int64
- func (s *ExtensionStateImpl) GetBonderList(address module.Address) (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetMainPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetNetworkValueInJSON() (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetPRepInJSON(address module.Address, blockHeight int64) (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetPRepManagerInJSON() map[string]interface{}
- func (s *ExtensionStateImpl) GetPRepStatsInJSON(blockHeight int64) (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetPRepTermInJSON() (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetPRepsInJSON(blockHeight int64, start, end int) (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetSnapshot() state.ExtensionSnapshot
- func (s *ExtensionStateImpl) GetSubPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
- func (s *ExtensionStateImpl) GetTotalDelegated() *big.Int
- func (s *ExtensionStateImpl) GetUnbondingTimerState(height int64, createIfNotExist bool) *icstate.Timer
- func (s *ExtensionStateImpl) GetUnstakingTimerState(height int64, createIfNotExist bool) *icstate.Timer
- func (s *ExtensionStateImpl) HandleTimerJob(wc state.WorldContext) (err error)
- func (s *ExtensionStateImpl) IsDecentralized() bool
- func (s *ExtensionStateImpl) Logger() log.Logger
- func (s *ExtensionStateImpl) NewCalculation(term *icstate.Term, calculator *Calculator) error
- func (s *ExtensionStateImpl) OnExecutionEnd(wc state.WorldContext, calculator *Calculator) error
- func (s *ExtensionStateImpl) PrevCalculationBlockHeight() int64
- func (s *ExtensionStateImpl) RegisterPRep(regInfo *RegInfo, irep *big.Int) error
- func (s *ExtensionStateImpl) Reset(isnapshot state.ExtensionSnapshot)
- func (s *ExtensionStateImpl) SetBond(cc contract.CallContext, from module.Address, bonds icstate.Bonds) error
- func (s *ExtensionStateImpl) SetBonderList(from module.Address, bl icstate.BonderList) error
- func (s *ExtensionStateImpl) SetDelegation(cc contract.CallContext, from module.Address, ds icstate.Delegations) error
- func (s *ExtensionStateImpl) SetGovernanceVariables(from module.Address, irep *big.Int, blockHeight int64) error
- func (s *ExtensionStateImpl) SetLogger(logger log.Logger)
- func (s *ExtensionStateImpl) SetPRep(regInfo *RegInfo) error
- func (s *ExtensionStateImpl) UnregisterPRep(cc contract.CallContext, owner module.Address) error
- func (s *ExtensionStateImpl) UpdateBlockVoteStats(cc contract.CallContext, owner module.Address, voted bool) error
- func (s *ExtensionStateImpl) UpdateIssueInfo(reward *big.Int, isDecentralized bool, additionalReward *big.Int) error
- func (s *ExtensionStateImpl) UpdateIssueInfoFee(fee *big.Int) error
- func (s *ExtensionStateImpl) ValidateIRep(oldIRep, newIRep *big.Int, prevSetIRepHeight int64) error
- type IssuePRepJSON
- type IssueResultJSON
- type PRep
- type PRepManager
- func (pm *PRepManager) CalculateIRep(revision int) *big.Int
- func (pm *PRepManager) CalculateRRep(totalSupply *big.Int, revision int) *big.Int
- func (pm *PRepManager) ChangeBond(oBonds, nBonds icstate.Bonds) (map[string]*big.Int, error)
- func (pm *PRepManager) ChangeDelegation(od, nd icstate.Delegations) (map[string]*big.Int, error)
- func (pm *PRepManager) ChangeGrade(owner module.Address, grade icstate.Grade) error
- func (pm *PRepManager) DisqualifyPRep(owner module.Address) error
- func (pm *PRepManager) GetNodeByOwner(owner module.Address) module.Address
- func (pm *PRepManager) GetOwnerByNode(node module.Address) module.Address
- func (pm *PRepManager) GetPRepByIndex(i int) *PRep
- func (pm *PRepManager) GetPRepByNode(node module.Address) *PRep
- func (pm *PRepManager) GetPRepByOwner(owner module.Address) *PRep
- func (pm *PRepManager) GetPRepSize(grade icstate.Grade) int
- func (pm *PRepManager) GetPRepStatsInJSON(blockHeight int64) (map[string]interface{}, error)
- func (pm *PRepManager) GetPRepsInJSON(blockHeight int64, start, end int) (map[string]interface{}, error)
- func (pm *PRepManager) GetTotalBondedDelegation(br int64) *big.Int
- func (pm *PRepManager) GetValidators(term *icstate.Term) ([]module.Validator, error)
- func (pm *PRepManager) ImposePenalty(owner module.Address, blockHeight int64) error
- func (pm *PRepManager) OnTermEnd(mainPRepCount, subPRepCount int, blockHeight int64) error
- func (pm *PRepManager) RegisterPRep(regInfo *RegInfo, irep *big.Int) error
- func (pm *PRepManager) SetPRep(regInfo *RegInfo) error
- func (pm *PRepManager) ShiftVPenaltyMaskByNode(node module.Address) error
- func (pm *PRepManager) Size() int
- func (pm *PRepManager) Slash(owner module.Address, amount *big.Int) error
- func (pm *PRepManager) Sort()
- func (pm *PRepManager) ToJSON(totalStake *big.Int) map[string]interface{}
- func (pm *PRepManager) TotalBonded() *big.Int
- func (pm *PRepManager) TotalDelegated() *big.Int
- func (pm *PRepManager) UnregisterPRep(owner module.Address) error
- func (pm *PRepManager) UpdateBlockVoteStats(owner module.Address, voted bool, blockHeight int64) error
- type RegInfo
- type RewardType
- type ValidatorItem
- type ValidatorItemIterator
- type ValidatorManager
- func (vm *ValidatorManager) Add(node module.Address) error
- func (vm *ValidatorManager) Bytes() []byte
- func (vm *ValidatorManager) Clear() error
- func (vm *ValidatorManager) Flush() error
- func (vm *ValidatorManager) Get(idx int) (*ValidatorItem, bool)
- func (vm *ValidatorManager) GetValidators() ([]module.Validator, error)
- func (vm *ValidatorManager) Hash() []byte
- func (vm *ValidatorManager) IndexOf(address module.Address) int
- func (vm *ValidatorManager) Init(pm *PRepManager, term *icstate.Term) error
- func (vm *ValidatorManager) IsUpdated() bool
- func (vm *ValidatorManager) Iterator() *viIterator
- func (vm *ValidatorManager) Len() int
- func (vm *ValidatorManager) Load(pm *PRepManager, term *icstate.Term) error
- func (vm *ValidatorManager) PRepSnapshotIndex() int
- func (vm *ValidatorManager) Remove(node module.Address) error
- func (vm *ValidatorManager) Replace(oldNode, newNode module.Address) error
- func (vm *ValidatorManager) ResetUpdated()
- func (vm *ValidatorManager) SetPRepSnapshotIndex(idx int)
- func (vm *ValidatorManager) SetUpdated(on bool)
- func (vm *ValidatorManager) String() string
Constants ¶
const ( DayBlock = 24 * 60 * 60 / 2 DayPerMonth = 30 MonthBlock = DayBlock * DayPerMonth MonthPerYear = 12 YearBlock = MonthBlock * MonthPerYear IScoreICXRatio = 1_000 VotedRewardMultiplier = 100 RrepMultiplier = 3 // rrep = rrep + eep + dbp = 3 * rrep RrepDivider = 10_000 // rrep(10_000) = 100.00%, rrep(200) = 2.00% )
const ( InitialIRep = 50_000 // in icx, not loop MinIRep = 10_000 )
const CodeOffsetForICON = 100
const (
CriticalCalculatorError = errors.CodeCritical + CodeOffsetForICON + iota
)
const InitBlockHeight = -1
const IrepInflationLimit = 14 // 14%
Variables ¶
var (
BigIntIScoreICXRatio = big.NewInt(int64(IScoreICXRatio))
)
var BigIntInitialIRep = new(big.Int).Mul(new(big.Int).SetInt64(InitialIRep), icutils.BigIntICX)
Functions ¶
func GetIssueData ¶ added in v0.9.6
func GetIssueData(es *ExtensionStateImpl) (*IssuePRepJSON, *IssueResultJSON)
GetIssueData return issue information for base TX
func NewExtensionSnapshot ¶ added in v0.9.6
func NewExtensionSnapshot(database db.Database, hash []byte) state.ExtensionSnapshot
func NewExtensionSnapshotWithBuilder ¶ added in v0.9.6
func NewExtensionSnapshotWithBuilder(builder merkle.Builder, raw []byte) state.ExtensionSnapshot
func RegisterBaseTx ¶
func RegisterBaseTx()
Types ¶
type Calculator ¶ added in v0.9.6
type Calculator struct {
// contains filtered or unexported fields
}
func NewCalculator ¶ added in v0.9.6
func NewCalculator() *Calculator
func (*Calculator) Back ¶ added in v0.9.6
func (c *Calculator) Back() *icstage.Snapshot
func (*Calculator) Base ¶ added in v0.9.6
func (c *Calculator) Base() *icreward.Snapshot
func (*Calculator) CheckToRun ¶ added in v0.9.6
func (c *Calculator) CheckToRun(ess state.ExtensionSnapshot) bool
func (*Calculator) IsCalcDone ¶ added in v0.9.6
func (c *Calculator) IsCalcDone(blockHeight int64) bool
func (*Calculator) Result ¶ added in v0.9.6
func (c *Calculator) Result() *icreward.Snapshot
func (*Calculator) Run ¶ added in v0.9.6
func (c *Calculator) Run(ess state.ExtensionSnapshot, logger log.Logger) (err error)
func (*Calculator) StartHeight ¶ added in v0.9.6
func (c *Calculator) StartHeight() int64
func (*Calculator) Temp ¶ added in v0.9.6
func (c *Calculator) Temp() *icreward.State
func (*Calculator) TotalReward ¶ added in v0.9.6
func (c *Calculator) TotalReward() *big.Int
type ExtensionSnapshotImpl ¶ added in v0.9.6
type ExtensionSnapshotImpl struct {
// contains filtered or unexported fields
}
func (*ExtensionSnapshotImpl) Bytes ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) Bytes() []byte
func (*ExtensionSnapshotImpl) Flush ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) Flush() error
func (*ExtensionSnapshotImpl) NewState ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) NewState(readonly bool) state.ExtensionState
func (*ExtensionSnapshotImpl) RLPDecodeSelf ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) RLPDecodeSelf(d codec.Decoder) error
func (*ExtensionSnapshotImpl) RLPEncodeSelf ¶ added in v0.9.6
func (s *ExtensionSnapshotImpl) RLPEncodeSelf(e codec.Encoder) error
type ExtensionStateImpl ¶ added in v0.9.6
type ExtensionStateImpl struct { State *icstate.State Front *icstage.State Back *icstage.State Reward *icreward.State // contains filtered or unexported fields }
func (*ExtensionStateImpl) AddEventBond ¶ added in v0.9.6
func (*ExtensionStateImpl) CalculationBlockHeight ¶ added in v0.9.6
func (s *ExtensionStateImpl) CalculationBlockHeight() int64
func (*ExtensionStateImpl) ClearCache ¶ added in v0.9.6
func (s *ExtensionStateImpl) ClearCache()
func (*ExtensionStateImpl) DisqualifyPRep ¶ added in v0.9.6
func (s *ExtensionStateImpl) DisqualifyPRep(owner module.Address) error
func (*ExtensionStateImpl) GenesisTerm ¶ added in v0.9.6
func (s *ExtensionStateImpl) GenesisTerm(blockHeight int64, revision int) error
func (*ExtensionStateImpl) GetAccount ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetAccount(address module.Address) *icstate.Account
func (*ExtensionStateImpl) GetBondRequirement ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetBondRequirement() int64
func (*ExtensionStateImpl) GetBonderList ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetBonderList(address module.Address) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetMainPRepsInJSON ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetMainPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetNetworkValueInJSON ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetNetworkValueInJSON() (map[string]interface{}, error)
func (*ExtensionStateImpl) GetPRepInJSON ¶ added in v0.9.6
func (*ExtensionStateImpl) GetPRepManagerInJSON ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetPRepManagerInJSON() map[string]interface{}
func (*ExtensionStateImpl) GetPRepStatsInJSON ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetPRepStatsInJSON(blockHeight int64) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetPRepTermInJSON ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetPRepTermInJSON() (map[string]interface{}, error)
func (*ExtensionStateImpl) GetPRepsInJSON ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetPRepsInJSON(blockHeight int64, start, end int) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetSnapshot ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetSnapshot() state.ExtensionSnapshot
func (*ExtensionStateImpl) GetSubPRepsInJSON ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetSubPRepsInJSON(blockHeight int64) (map[string]interface{}, error)
func (*ExtensionStateImpl) GetTotalDelegated ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetTotalDelegated() *big.Int
func (*ExtensionStateImpl) GetUnbondingTimerState ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetUnbondingTimerState(height int64, createIfNotExist bool) *icstate.Timer
func (*ExtensionStateImpl) GetUnstakingTimerState ¶ added in v0.9.6
func (s *ExtensionStateImpl) GetUnstakingTimerState(height int64, createIfNotExist bool) *icstate.Timer
func (*ExtensionStateImpl) HandleTimerJob ¶ added in v0.9.6
func (s *ExtensionStateImpl) HandleTimerJob(wc state.WorldContext) (err error)
func (*ExtensionStateImpl) IsDecentralized ¶ added in v0.9.6
func (s *ExtensionStateImpl) IsDecentralized() bool
func (*ExtensionStateImpl) Logger ¶ added in v0.9.6
func (s *ExtensionStateImpl) Logger() log.Logger
func (*ExtensionStateImpl) NewCalculation ¶ added in v0.9.6
func (s *ExtensionStateImpl) NewCalculation(term *icstate.Term, calculator *Calculator) error
func (*ExtensionStateImpl) OnExecutionEnd ¶ added in v0.9.6
func (s *ExtensionStateImpl) OnExecutionEnd(wc state.WorldContext, calculator *Calculator) error
func (*ExtensionStateImpl) PrevCalculationBlockHeight ¶ added in v0.9.6
func (s *ExtensionStateImpl) PrevCalculationBlockHeight() int64
func (*ExtensionStateImpl) RegisterPRep ¶ added in v0.9.6
func (s *ExtensionStateImpl) RegisterPRep(regInfo *RegInfo, irep *big.Int) error
func (*ExtensionStateImpl) Reset ¶ added in v0.9.6
func (s *ExtensionStateImpl) Reset(isnapshot state.ExtensionSnapshot)
func (*ExtensionStateImpl) SetBond ¶ added in v0.9.6
func (s *ExtensionStateImpl) SetBond(cc contract.CallContext, from module.Address, bonds icstate.Bonds) error
func (*ExtensionStateImpl) SetBonderList ¶ added in v0.9.6
func (s *ExtensionStateImpl) SetBonderList(from module.Address, bl icstate.BonderList) error
func (*ExtensionStateImpl) SetDelegation ¶ added in v0.9.6
func (s *ExtensionStateImpl) SetDelegation(cc contract.CallContext, from module.Address, ds icstate.Delegations) error
func (*ExtensionStateImpl) SetGovernanceVariables ¶ added in v0.9.6
func (*ExtensionStateImpl) SetLogger ¶ added in v0.9.6
func (s *ExtensionStateImpl) SetLogger(logger log.Logger)
func (*ExtensionStateImpl) SetPRep ¶ added in v0.9.6
func (s *ExtensionStateImpl) SetPRep(regInfo *RegInfo) error
func (*ExtensionStateImpl) UnregisterPRep ¶ added in v0.9.6
func (s *ExtensionStateImpl) UnregisterPRep(cc contract.CallContext, owner module.Address) error
func (*ExtensionStateImpl) UpdateBlockVoteStats ¶ added in v0.9.6
func (s *ExtensionStateImpl) UpdateBlockVoteStats( cc contract.CallContext, owner module.Address, voted bool) error
func (*ExtensionStateImpl) UpdateIssueInfo ¶ added in v0.9.6
func (*ExtensionStateImpl) UpdateIssueInfoFee ¶ added in v0.9.6
func (s *ExtensionStateImpl) UpdateIssueInfoFee(fee *big.Int) error
func (*ExtensionStateImpl) ValidateIRep ¶ added in v0.9.6
func (s *ExtensionStateImpl) ValidateIRep(oldIRep, newIRep *big.Int, prevSetIRepHeight int64) error
type IssuePRepJSON ¶ added in v0.9.6
type IssueResultJSON ¶ added in v0.9.6
type IssueResultJSON struct { ByFee *common.HexInt `json:"coveredByFee"` ByOverIssuedICX *common.HexInt `json:"coveredByOverIssuedICX"` Issue *common.HexInt `json:"issue"` }
func (*IssueResultJSON) GetTotalReward ¶ added in v0.9.6
func (i *IssueResultJSON) GetTotalReward() *big.Int
type PRepManager ¶ added in v0.9.6
type PRepManager struct {
// contains filtered or unexported fields
}
Manage PRepBase, PRepStatus and ActivePRep
func (*PRepManager) CalculateIRep ¶ added in v0.9.6
func (pm *PRepManager) CalculateIRep(revision int) *big.Int
func (*PRepManager) CalculateRRep ¶ added in v0.9.6
func (*PRepManager) ChangeBond ¶ added in v0.9.6
func (*PRepManager) ChangeDelegation ¶ added in v0.9.6
func (pm *PRepManager) ChangeDelegation(od, nd icstate.Delegations) (map[string]*big.Int, error)
func (*PRepManager) ChangeGrade ¶ added in v0.9.6
func (*PRepManager) DisqualifyPRep ¶ added in v0.9.6
func (pm *PRepManager) DisqualifyPRep(owner module.Address) error
func (*PRepManager) GetNodeByOwner ¶ added in v0.9.6
func (pm *PRepManager) GetNodeByOwner(owner module.Address) module.Address
func (*PRepManager) GetOwnerByNode ¶ added in v0.9.6
func (pm *PRepManager) GetOwnerByNode(node module.Address) module.Address
func (*PRepManager) GetPRepByIndex ¶ added in v0.9.6
func (pm *PRepManager) GetPRepByIndex(i int) *PRep
func (*PRepManager) GetPRepByNode ¶ added in v0.9.6
func (pm *PRepManager) GetPRepByNode(node module.Address) *PRep
func (*PRepManager) GetPRepByOwner ¶ added in v0.9.6
func (pm *PRepManager) GetPRepByOwner(owner module.Address) *PRep
func (*PRepManager) GetPRepSize ¶ added in v0.9.6
func (pm *PRepManager) GetPRepSize(grade icstate.Grade) int
func (*PRepManager) GetPRepStatsInJSON ¶ added in v0.9.6
func (pm *PRepManager) GetPRepStatsInJSON(blockHeight int64) (map[string]interface{}, error)
func (*PRepManager) GetPRepsInJSON ¶ added in v0.9.6
func (pm *PRepManager) GetPRepsInJSON(blockHeight int64, start, end int) (map[string]interface{}, error)
func (*PRepManager) GetTotalBondedDelegation ¶ added in v0.9.6
func (pm *PRepManager) GetTotalBondedDelegation(br int64) *big.Int
func (*PRepManager) GetValidators ¶ added in v0.9.6
func (*PRepManager) ImposePenalty ¶ added in v0.9.6
func (pm *PRepManager) ImposePenalty(owner module.Address, blockHeight int64) error
Grade change, LastState to icstate.None
func (*PRepManager) OnTermEnd ¶ added in v0.9.6
func (pm *PRepManager) OnTermEnd(mainPRepCount, subPRepCount int, blockHeight int64) error
func (*PRepManager) RegisterPRep ¶ added in v0.9.6
func (pm *PRepManager) RegisterPRep(regInfo *RegInfo, irep *big.Int) error
func (*PRepManager) SetPRep ¶ added in v0.9.6
func (pm *PRepManager) SetPRep(regInfo *RegInfo) error
func (*PRepManager) ShiftVPenaltyMaskByNode ¶ added in v0.9.6
func (pm *PRepManager) ShiftVPenaltyMaskByNode(node module.Address) error
func (*PRepManager) Size ¶ added in v0.9.6
func (pm *PRepManager) Size() int
func (*PRepManager) Slash ¶ added in v0.9.6
Slash handles to reduce PRepStatus.bonded and PRepManager.totalBonded Do not change PRep grade here Caution: amount should not include the amount from unbonded
func (*PRepManager) Sort ¶ added in v0.9.6
func (pm *PRepManager) Sort()
Sort preps in descending order by bonded delegation
func (*PRepManager) ToJSON ¶ added in v0.9.6
func (pm *PRepManager) ToJSON(totalStake *big.Int) map[string]interface{}
func (*PRepManager) TotalBonded ¶ added in v0.9.6
func (pm *PRepManager) TotalBonded() *big.Int
TotalBonded returns the sum of PRep.Bonded()
func (*PRepManager) TotalDelegated ¶ added in v0.9.6
func (pm *PRepManager) TotalDelegated() *big.Int
TotalDelegated returns the sum of PRep.Delegated()
func (*PRepManager) UnregisterPRep ¶ added in v0.9.6
func (pm *PRepManager) UnregisterPRep(owner module.Address) error
func (*PRepManager) UpdateBlockVoteStats ¶ added in v0.9.6
func (pm *PRepManager) UpdateBlockVoteStats(owner module.Address, voted bool, blockHeight int64) error
UpdateBlockVoteStats updates PRepLastState based on ConsensusInfo
type RegInfo ¶ added in v0.9.6
type RegInfo struct {
// contains filtered or unexported fields
}
func NewRegInfo ¶ added in v0.9.6
func (*RegInfo) UpdateRegInfo ¶ added in v0.9.6
type RewardType ¶ added in v0.9.6
type RewardType int
const ( TypeBlockProduce RewardType = iota TypeVoted TypeVoting )
type ValidatorItem ¶ added in v0.9.6
type ValidatorItem struct {
// contains filtered or unexported fields
}
func (*ValidatorItem) Address ¶ added in v0.9.6
func (vi *ValidatorItem) Address() module.Address
func (*ValidatorItem) IsAdded ¶ added in v0.9.6
func (vi *ValidatorItem) IsAdded() bool
func (*ValidatorItem) ResetFlags ¶ added in v0.9.6
func (vi *ValidatorItem) ResetFlags()
type ValidatorItemIterator ¶ added in v0.9.6
type ValidatorItemIterator interface { Has() bool Next() error Get() (*ValidatorItem, error) }
type ValidatorManager ¶ added in v0.9.6
func NewValidatorManager ¶ added in v0.9.6
func NewValidatorManager() *ValidatorManager
func (*ValidatorManager) Add ¶ added in v0.9.6
func (vm *ValidatorManager) Add(node module.Address) error
func (*ValidatorManager) Bytes ¶ added in v0.9.6
func (vm *ValidatorManager) Bytes() []byte
func (*ValidatorManager) Clear ¶ added in v0.9.6
func (vm *ValidatorManager) Clear() error
func (*ValidatorManager) Flush ¶ added in v0.9.6
func (vm *ValidatorManager) Flush() error
func (*ValidatorManager) Get ¶ added in v0.9.6
func (vm *ValidatorManager) Get(idx int) (*ValidatorItem, bool)
func (*ValidatorManager) GetValidators ¶ added in v0.9.6
func (vm *ValidatorManager) GetValidators() ([]module.Validator, error)
func (*ValidatorManager) Hash ¶ added in v0.9.6
func (vm *ValidatorManager) Hash() []byte
func (*ValidatorManager) IndexOf ¶ added in v0.9.6
func (vm *ValidatorManager) IndexOf(address module.Address) int
func (*ValidatorManager) Init ¶ added in v0.9.6
func (vm *ValidatorManager) Init(pm *PRepManager, term *icstate.Term) error
func (*ValidatorManager) IsUpdated ¶ added in v0.9.6
func (vm *ValidatorManager) IsUpdated() bool
func (*ValidatorManager) Iterator ¶ added in v0.9.6
func (vm *ValidatorManager) Iterator() *viIterator
func (*ValidatorManager) Len ¶ added in v0.9.6
func (vm *ValidatorManager) Len() int
func (*ValidatorManager) Load ¶ added in v0.9.6
func (vm *ValidatorManager) Load(pm *PRepManager, term *icstate.Term) error
func (*ValidatorManager) PRepSnapshotIndex ¶ added in v0.9.6
func (vm *ValidatorManager) PRepSnapshotIndex() int
func (*ValidatorManager) Remove ¶ added in v0.9.6
func (vm *ValidatorManager) Remove(node module.Address) error
func (*ValidatorManager) Replace ¶ added in v0.9.6
func (vm *ValidatorManager) Replace(oldNode, newNode module.Address) error
Replace is used for node address change
func (*ValidatorManager) ResetUpdated ¶ added in v0.9.6
func (vm *ValidatorManager) ResetUpdated()
func (*ValidatorManager) SetPRepSnapshotIndex ¶ added in v0.9.6
func (vm *ValidatorManager) SetPRepSnapshotIndex(idx int)
func (*ValidatorManager) SetUpdated ¶ added in v0.9.6
func (vm *ValidatorManager) SetUpdated(on bool)
func (*ValidatorManager) String ¶ added in v0.9.6
func (vm *ValidatorManager) String() string