icstate

package
v0.9.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	IISSVersion1 int = iota // IISS 2.0
	IISSVersion2            // IISS 3.1
)
View Source
const (
	TypeAccount int = iota
	TypePRepBase
	TypePRepStatus
	TypeTimer
	TypeIssue
	TypeTerm
	TypeRewardCalcInfo
)

Variables

View Source
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",
	)
)
View Source
var AccountDictPrefix = containerdb.ToKey(
	containerdb.HashBuilder,
	scoredb.DictDBPrefix,
	"account_db",
)
View Source
var UnbondingPeriod = int64(10)

Functions

func NetworkValueToJSON

func NetworkValueToJSON(s *State) map[string]interface{}

func NewObjectImpl

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

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 ToAccount

func ToAccount(object trie.Object, address module.Address) *Account

func (*Account) Address

func (a *Account) Address() module.Address

func (*Account) Bond

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

func (*Account) Bonds

func (a *Account) Bonds() Bonds

func (*Account) Clear

func (a *Account) Clear()

func (*Account) Clone

func (a *Account) Clone() *Account

func (*Account) DecreaseUnstake

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

func (*Account) Delegating

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

func (*Account) Delegations

func (a *Account) Delegations() Delegations

func (*Account) Equal

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

func (*Account) Format

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

func (*Account) GetBondsInJSON

func (a *Account) GetBondsInJSON() []interface{}

func (Account) GetDelegationInJSON

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

func (*Account) GetSnapshot

func (a *Account) GetSnapshot() *Account

func (Account) GetStakeInJSON

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

GetStakeInJSON returns stake and unstake information in json format

func (Account) GetTotalStake

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

GetTotalStake return stake + unstake Value

func (*Account) GetUnbondsInJSON

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

func (Account) GetUnstakeAmount

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

GetUnstakeAmount return unstake Value

func (*Account) GetVoting

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

func (*Account) GetVotingPower

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

func (*Account) IncreaseUnstake

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

func (*Account) IsEmpty

func (a *Account) IsEmpty() bool

func (*Account) RLPDecodeFields

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

func (*Account) RLPEncodeFields

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

func (*Account) RemoveUnbonding

func (a *Account) RemoveUnbonding(height int64) error

func (*Account) RemoveUnstaking

func (a *Account) RemoveUnstaking(height int64) (ra *big.Int, err error)

func (*Account) Set

func (a *Account) Set(other *Account)

func (*Account) SetAddress

func (a *Account) SetAddress(address module.Address)

func (*Account) SetBonds

func (a *Account) SetBonds(bonds Bonds)

func (*Account) SetDelegation

func (a *Account) SetDelegation(ds Delegations)

func (*Account) SetStake

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

SetStake set stake Value

func (*Account) SlashBond

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

func (*Account) SlashStake

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

func (*Account) SlashUnbond

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

func (Account) Stake

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

Stake return stake Value

func (*Account) String

func (a *Account) String() string

func (*Account) Unbond

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

func (*Account) Unbonds

func (a *Account) Unbonds() Unbonds

func (*Account) UpdateUnbonds

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

func (*Account) UsingStake

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

func (*Account) Version

func (a *Account) Version() int

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) Get

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

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 Bond

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

func NewBond

func NewBond() *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) 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) ToJSON

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

type Bonds

type Bonds []*Bond

func NewBonds

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

func (Bonds) Clone

func (bl Bonds) Clone() Bonds

func (*Bonds) Delete

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

func (Bonds) Equal

func (bl Bonds) Equal(bl2 Bonds) bool

func (Bonds) GetBondAmount

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

func (Bonds) Has

func (bl Bonds) Has() bool

func (*Bonds) Iterator

func (bl *Bonds) Iterator() VotingIterator

func (*Bonds) Slash

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

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 Grade

type Grade int
const (
	Main Grade = iota
	Sub
	Candidate
)

func (Grade) String

func (g Grade) String() string

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 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) RLPDecodeFields

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

func (*Issue) RLPEncodeFields

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

func (*Issue) ResetTotalIssued

func (i *Issue) ResetTotalIssued()

func (*Issue) Version

func (i *Issue) Version() int

type JobType

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

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

func (*NodeOwnerCache) Clear

func (c *NodeOwnerCache) Clear()

func (*NodeOwnerCache) Flush

func (c *NodeOwnerCache) Flush()

func (*NodeOwnerCache) Get

func (*NodeOwnerCache) Reset

func (c *NodeOwnerCache) Reset()

type PRepBase

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

func NewPRepBase

func NewPRepBase(owner module.Address) *PRepBase

func ToPRepBase

func ToPRepBase(object trie.Object, owner module.Address) *PRepBase

func (*PRepBase) BonderList

func (p *PRepBase) BonderList() BonderList

func (*PRepBase) City

func (p *PRepBase) City() string

func (*PRepBase) Clear

func (p *PRepBase) Clear()

func (*PRepBase) Clone

func (p *PRepBase) Clone() *PRepBase

func (*PRepBase) Country

func (p *PRepBase) Country() string

func (*PRepBase) Details

func (p *PRepBase) Details() string

func (*PRepBase) Email

func (p *PRepBase) Email() string

func (*PRepBase) Equal

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

func (*PRepBase) GetBonderListInJSON

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

func (*PRepBase) GetNode

func (p *PRepBase) GetNode() module.Address

func (*PRepBase) GetSnapshot

func (p *PRepBase) GetSnapshot() *PRepBase

func (*PRepBase) IRep

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

func (*PRepBase) IRepHeight

func (p *PRepBase) IRepHeight() int64

func (*PRepBase) IsEmpty

func (p *PRepBase) IsEmpty() bool

func (*PRepBase) Name

func (p *PRepBase) Name() string

func (*PRepBase) Node

func (p *PRepBase) Node() module.Address

func (*PRepBase) Owner

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

func (*PRepBase) P2pEndpoint

func (p *PRepBase) P2pEndpoint() string

func (*PRepBase) RLPDecodeFields

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

func (*PRepBase) RLPEncodeFields

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

func (*PRepBase) Set

func (p *PRepBase) Set(other *PRepBase)

func (*PRepBase) SetBonderList

func (p *PRepBase) SetBonderList(bonderList BonderList)

func (*PRepBase) SetIrep

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

func (*PRepBase) SetOwner

func (p *PRepBase) SetOwner(owner module.Address)

func (*PRepBase) SetPRep

func (p *PRepBase) SetPRep(name, email, website, country, city, details, endpoint string, node module.Address) error

func (*PRepBase) ToJSON

func (p *PRepBase) ToJSON() map[string]interface{}

func (*PRepBase) Version

func (p *PRepBase) Version() int

func (*PRepBase) Website

func (p *PRepBase) Website() string

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) Equal

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

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) Equal

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

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) Start

func (rc *RewardCalcInfo) Start(
	blockHeight int64, period int64, isDecentralized bool, calcReward *big.Int, additionalReward *big.Int,
)

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 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) GetRewardCalcInfo

func (ss *Snapshot) GetRewardCalcInfo() (*RewardCalcInfo, error)

func (*Snapshot) GetValue

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

func (*Snapshot) NewState

func (ss *Snapshot) NewState(readonly bool) *State

type State

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

func NewStateFromSnapshot

func NewStateFromSnapshot(ss *Snapshot, readonly bool) *State

func NewStateFromTrie

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

func (*State) AddActivePRep

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

func (*State) AddNodeToOwner

func (s *State) AddNodeToOwner(node, owner module.Address) error

func (*State) Flush

func (s *State) Flush() error

func (*State) GetAccount

func (s *State) GetAccount(addr module.Address) *Account

func (*State) GetActivePRep

func (s *State) GetActivePRep(i int) module.Address

func (*State) GetActivePRepSize

func (s *State) GetActivePRepSize() int

func (*State) GetBondRequirement

func (s *State) GetBondRequirement() int64

func (*State) GetConsistentValidationPenaltyCondition

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

func (*State) GetConsistentValidationPenaltyMask

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

func (*State) GetConsistentValidationPenaltySlashRatio

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

func (*State) GetIISSVersion

func (s *State) GetIISSVersion() int

func (*State) GetIRep

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

func (*State) GetIssue

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

func (*State) GetLastValidators

func (s *State) GetLastValidators() []module.Address

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

MainPrepCount

func (*State) GetOwnerByNode

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

func (*State) GetPRepBase

func (s *State) GetPRepBase(owner module.Address, createIfNotExist bool) *PRepBase

func (*State) GetPRepCount

func (s *State) GetPRepCount() int64

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) 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

SubPrepCount

func (*State) GetTerm

func (s *State) GetTerm() *Term

func (*State) GetTermPeriod

func (s *State) GetTermPeriod() int64

func (*State) GetTotalStake

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

func (*State) GetUnbondingMax

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

func (*State) GetUnbondingPeriodMultiplier

func (s *State) GetUnbondingPeriodMultiplier() int64

func (*State) GetUnbondingTimer

func (s *State) GetUnbondingTimer(height int64, createIfNotExist bool) *Timer

func (*State) GetUnstakeSlotMax

func (s *State) GetUnstakeSlotMax() int64

func (*State) GetUnstakingTimer

func (s *State) GetUnstakingTimer(height int64, createIfNotExist bool) *Timer

func (*State) GetValidationPenaltyCondition

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

func (*State) RemoveActivePRep

func (s *State) RemoveActivePRep(owner module.Address) 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 *big.Int) error

func (*State) SetConsistentValidationPenaltyMask

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

func (*State) SetConsistentValidationPenaltySlashRatio

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

func (*State) SetIISSVersion

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

func (*State) SetIRep

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

func (*State) SetIssue

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

func (*State) SetLastValidators

func (s *State) SetLastValidators(al []module.Address) 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) 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) SetTerm

func (s *State) SetTerm(term *Term) error

func (*State) SetTermPeriod

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

func (*State) SetTotalStake

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

func (*State) SetUnbondingMax

func (s *State) SetUnbondingMax(value *big.Int) 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 *big.Int) error

type StateAndSnapshot

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

func (*StateAndSnapshot) IsReadonly

func (s *StateAndSnapshot) IsReadonly() bool

type Status

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

func (Status) String

func (s Status) String() string

type Term

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

func GenesisTerm

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

func NewNextTerm

func NewNextTerm(
	term *Term,
	period int64,
	irep *big.Int,
	rrep *big.Int,
	totalSupply *big.Int,
	totalDelegated *big.Int,
	rewardFund *RewardFund,
	bondRequirement int,
	revision int,
) *Term

func ToTerm

func ToTerm(object trie.Object) *Term

func (*Term) BondRequirement

func (term *Term) BondRequirement() int

func (*Term) Clone

func (term *Term) Clone() *Term

func (*Term) Equal

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

func (*Term) GetElectedPRepCount

func (term *Term) GetElectedPRepCount() int

func (*Term) GetEndBlockHeight

func (term *Term) GetEndBlockHeight() int64

func (*Term) GetFlag

func (term *Term) GetFlag() TermFlag

func (*Term) GetIISSVersion

func (term *Term) GetIISSVersion() int

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 *Term) GetPRepSnapshotCount() int

func (*Term) GetSnapshot

func (term *Term) GetSnapshot(store *icobject.ObjectStoreState) error

func (*Term) GetTotalBondedDelegation

func (term *Term) GetTotalBondedDelegation() *big.Int

func (*Term) Icps

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

func (*Term) Iglobal

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

func (*Term) Iprep

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

func (*Term) Irelay

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

func (*Term) Irep

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

func (*Term) IsAnyFlagOn

func (term *Term) IsAnyFlagOn(flags TermFlag) bool

func (*Term) IsDecentralized

func (term *Term) IsDecentralized() bool

func (*Term) IsUpdated

func (term *Term) IsUpdated() bool

func (*Term) Ivoter

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

func (*Term) MainPRepCount

func (term *Term) MainPRepCount() int

func (*Term) Period

func (term *Term) Period() int64

func (*Term) RLPDecodeFields

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

func (*Term) RLPEncodeFields

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

func (*Term) RemovePRepSnapshot

func (term *Term) RemovePRepSnapshot(owner module.Address) error

func (*Term) ResetFlag

func (term *Term) ResetFlag()

func (*Term) ResetSequence

func (term *Term) ResetSequence()

func (*Term) Revision

func (term *Term) Revision() int

func (*Term) RewardFund

func (term *Term) RewardFund() *RewardFund

func (*Term) Rrep

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

func (*Term) Sequence

func (term *Term) Sequence() int

func (*Term) Set

func (term *Term) Set(other *Term)

func (*Term) SetFlag

func (term *Term) SetFlag(flags TermFlag, on bool)

func (*Term) SetIrep

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

func (*Term) SetMainPRepCount

func (term *Term) SetMainPRepCount(mainPRepCount int)

func (*Term) SetPRepSnapshots

func (term *Term) SetPRepSnapshots(prepSnapshots []*PRepSnapshot)

func (*Term) SetRrep

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

func (*Term) StartHeight

func (term *Term) StartHeight() int64

func (*Term) String

func (term *Term) String() string

func (*Term) ToJSON

func (term *Term) ToJSON() map[string]interface{}

func (*Term) TotalDelegated

func (term *Term) TotalDelegated() *big.Int

func (*Term) TotalSupply

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

func (*Term) Version

func (term *Term) Version() int

type TermFlag

type TermFlag int
const (
	FlagNextTerm TermFlag = 1 << iota
	FlagValidator

	FlagNone TermFlag = 0
	FlagAll  TermFlag = 0xFFFFFFFF
)

type Timer

type Timer struct {
	icobject.NoDatabase
	StateAndSnapshot

	Addresses addresses
}

func ToTimer

func ToTimer(object trie.Object) *Timer

func (*Timer) Add

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

func (*Timer) Clear

func (t *Timer) Clear()

func (*Timer) Clone

func (t *Timer) Clone() *Timer

func (*Timer) Delete

func (t *Timer) Delete(address module.Address) error

func (*Timer) Equal

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

func (Timer) IsEmpty

func (t Timer) IsEmpty() bool

func (*Timer) RLPDecodeFields

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

func (*Timer) RLPEncodeFields

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

func (*Timer) Set

func (t *Timer) Set(other *Timer)

func (*Timer) Version

func (t *Timer) Version() 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, createIfNotExist bool) *Timer

func (*TimerCache) Reset

func (c *TimerCache) Reset()

type TimerJobInfo

type TimerJobInfo struct {
	Type   JobType
	Height int64
}

type Unbond

type Unbond struct {
	Address *common.Address
	Value   *big.Int
	Expire  int64
}

func (*Unbond) Clone

func (u *Unbond) Clone() *Unbond

func (*Unbond) Equal

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

func (*Unbond) Slash

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

func (*Unbond) ToJSON

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

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) 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) Has

func (ul Unbonds) Has() bool

func (Unbonds) MapByAddr

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

func (*Unbonds) Slash

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

func (Unbonds) ToJSON

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

type Unstake

type Unstake struct {
	Amount *big.Int
	// Unstake is done on OnExecutionEnd of ExpireHeight
	ExpireHeight int64
}

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) 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) Has

func (us Unstakes) Has() bool

func (Unstakes) ToJSON

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

type ValidationState

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

func (ValidationState) String

func (vs ValidationState) 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)
}

Jump to

Keyboard shortcuts

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