Documentation
¶
Index ¶
- Constants
- Variables
- func GetBoundLockOption(chose uint32) (opt uint32, rate uint8, locktime uint64)
- func GetBoundLocktime(opt uint32) (lock uint64)
- func GetCommissionRate(opt uint32) uint64
- func GetInternalDelegateList() ([]*types.DelegateIntern, error)
- func GetOpName(op uint32) string
- func InTimeSpan(ts, now, span uint64) bool
- func PackInfractionToBytes(v *Infraction) ([]byte, error)
- func SetStakingGlobInst(inst *Staking)
- func StakingEncodeBytes(sb *StakingBody) []byte
- type Bucket
- type BucketList
- type Candidate
- type CandidateList
- func (cl *CandidateList) Add(c *Candidate)
- func (cl *CandidateList) Count() int
- func (cl *CandidateList) Exist(addr meter.Address) bool
- func (cl *CandidateList) Get(addr meter.Address) *Candidate
- func (cl *CandidateList) Remove(addr meter.Address)
- func (l *CandidateList) ToList() []Candidate
- func (cl *CandidateList) ToString() string
- type Delegate
- type DelegateInJailList
- func (dl *DelegateInJailList) Add(c *DelegateJailed)
- func (dl *DelegateInJailList) Count() int
- func (dl *DelegateInJailList) Exist(addr meter.Address) bool
- func (dl *DelegateInJailList) Get(addr meter.Address) *DelegateJailed
- func (dl *DelegateInJailList) Remove(addr meter.Address) error
- func (dl *DelegateInJailList) ToList() []DelegateJailed
- func (dl *DelegateInJailList) ToString() string
- type DelegateJailed
- type DelegateList
- type DelegateStatistics
- type Distributor
- type DoubleSigner
- type DoubleSignerInfo
- type Infraction
- type MissingLeader
- type MissingLeaderInfo
- type MissingProposer
- type MissingProposerInfo
- type MissingVoter
- type MissingVoterInfo
- type RewardInfo
- type RewardInfoMap
- type Stakeholder
- type StakeholderList
- func (l *StakeholderList) Add(s *Stakeholder)
- func (l *StakeholderList) Exist(addr meter.Address) bool
- func (l *StakeholderList) Get(addr meter.Address) *Stakeholder
- func (l *StakeholderList) Remove(addr meter.Address)
- func (l *StakeholderList) ToList() []Stakeholder
- func (l *StakeholderList) ToString() string
- type Staking
- func (s *Staking) BoundAccountMeter(addr meter.Address, amount *big.Int, state *state.State) error
- func (s *Staking) BoundAccountMeterGov(addr meter.Address, amount *big.Int, state *state.State) error
- func (s *Staking) CollectBailMeterGov(addr meter.Address, amount *big.Int, state *state.State) error
- func (s *Staking) DistValidatorRewards(amount *big.Int, validators []*meter.Address, list *DelegateList, ...) (*big.Int, []*RewardInfo, error)
- func (s *Staking) GetBucketList(state *state.State) (result *BucketList)
- func (s *Staking) GetCandidateList(state *state.State) (result *CandidateList)
- func (s *Staking) GetDelegateList(state *state.State) (result *DelegateList)
- func (s *Staking) GetInJailList(state *state.State) (result *DelegateInJailList)
- func (s *Staking) GetStakeHolderList(state *state.State) (result *StakeholderList)
- func (s *Staking) GetStatisticsEpoch(state *state.State) (result uint32)
- func (s *Staking) GetStatisticsList(state *state.State) (result *StatisticsList)
- func (s *Staking) GetValidatorRewardList(state *state.State) (result *ValidatorRewardList)
- func (s *Staking) PrepareStakingHandler() (...)
- func (s *Staking) SetBucketList(bucketList *BucketList, state *state.State)
- func (s *Staking) SetCandidateList(candList *CandidateList, state *state.State)
- func (s *Staking) SetDelegateList(delegateList *DelegateList, state *state.State)
- func (s *Staking) SetInJailList(list *DelegateInJailList, state *state.State)
- func (s *Staking) SetStakeHolderList(holderList *StakeholderList, state *state.State)
- func (s *Staking) SetStatisticsEpoch(phaseOutEpoch uint32, state *state.State)
- func (s *Staking) SetStatisticsList(list *StatisticsList, state *state.State)
- func (s *Staking) SetValidatorRewardList(list *ValidatorRewardList, state *state.State)
- func (s *Staking) Start() error
- func (s *Staking) TransferValidatorReward(amount *big.Int, addr meter.Address, state *state.State) error
- func (s *Staking) UnboundAccountMeter(addr meter.Address, amount *big.Int, state *state.State) error
- func (s *Staking) UnboundAccountMeterGov(addr meter.Address, amount *big.Int, state *state.State) error
- type StakingBody
- func (sb *StakingBody) BoundHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) CandidateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) CandidateUpdateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) DelegateExitJailHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) DelegateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) DelegateStatisticsFlushHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) DelegateStatisticsHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) GoverningHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) ToString() string
- func (sb *StakingBody) UnBoundHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) UnCandidateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- func (sb *StakingBody) UnDelegateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
- type StakingEnviroment
- type StatisticsList
- func (sl *StatisticsList) Add(c *DelegateStatistics)
- func (sl *StatisticsList) Count() int
- func (sl *StatisticsList) Exist(addr meter.Address) bool
- func (sl *StatisticsList) Get(addr meter.Address) *DelegateStatistics
- func (sl *StatisticsList) Remove(addr meter.Address)
- func (sl *StatisticsList) ToList() []DelegateStatistics
- func (sl *StatisticsList) ToString() string
- type ValidatorReward
- type ValidatorRewardList
- func (v *ValidatorRewardList) Count() int
- func (v *ValidatorRewardList) Get(epoch uint32) *ValidatorReward
- func (v *ValidatorRewardList) GetList() []*ValidatorReward
- func (v *ValidatorRewardList) String() string
- func (v *ValidatorRewardList) ToList() []*ValidatorReward
- func (v *ValidatorRewardList) ToString() string
Constants ¶
const ( OP_BOUND = uint32(1) OP_UNBOUND = uint32(2) OP_CANDIDATE = uint32(3) OP_UNCANDIDATE = uint32(4) OP_DELEGATE = uint32(5) OP_UNDELEGATE = uint32(6) OP_CANDIDATE_UPDT = uint32(7) OP_DELEGATE_STATISTICS = uint32(101) OP_DELEGATE_EXITJAIL = uint32(102) OP_FLUSH_ALL_STATISTICS = uint32(103) OP_GOVERNING = uint32(10001) )
const ( ONE_DAY_LOCK = uint32(0) ONE_DAY_LOCK_RATE = uint8(0) ONE_DAY_LOCK_TIME = uint64(60 * 60 * 24) ONE_WEEK_LOCK = uint32(1) ONE_WEEK_LOCK_RATE = uint8(5) // 5 percent ONE_WEEK_LOCK_TIME = uint64(60 * 60 * 24 * 7) TWO_WEEK_LOCK = uint32(2) TWO_WEEK_LOCK_RATE = uint8(6) // %6 TWO_WEEK_LOCK_TIME = uint64(60 * 60 * 24 * 14) THREE_WEEK_LOCK = uint32(3) THREE_WEEK_LOCK_RATE = uint8(7) THREE_WEEK_LOCK_TIME = uint64(60 * 60 * 24 * 21) FOUR_WEEK_LOCK = uint32(4) FOUR_WEEK_LOCK_RATE = uint8(8) FOUR_WEEK_LOCK_TIME = uint64(60 * 60 * 24 * 28) // for candidate bucket ONLY FOREVER_LOCK = uint32(1000) FOREVER_LOCK_RATE = FOUR_WEEK_LOCK_RATE FOREVER_LOCK_TIME = uint64(0) )
staking options
const ( JailCriteria = 1200 //2000 //100 times of missing proposer WipeOutEpochCount = 4400 // 360 // does not count if longer than 15 days (360 epoch) DoubleSignPts = 60 MissingLeaderPts = 40 MissingProposerPts = 20 MissingVoterPts = 2 PhaseOutEpochCount = 2200 // 180 // half points after 6 days (180 epoch) PhaseOutDoubleSignPts = 30 PhaseOutLeaderPts = 20 PhaseOutProposerPts = 10 PhaseOutVoterPts = 1 )
const ( TOKEN_METER = byte(0) TOKEN_METER_GOV = byte(1) STAKING_TIMESPAN = uint64(720) )
const (
MIN_CANDIDATE_UPDATE_INTV = uint64(3600 * 24) // 1 day
)
const (
STAKING_MAX_VALIDATOR_REWARDS = 1200
)
Variables ¶
var ( // delegate minimum requirement 300 MTRG MIN_REQUIRED_BY_DELEGATE *big.Int = new(big.Int).Mul(big.NewInt(int64(300)), big.NewInt(int64(1e18))) // amount to exit from jail 200 MTRGov BAIL_FOR_EXIT_JAIL *big.Int = new(big.Int).Mul(big.NewInt(int64(200)), big.NewInt(int64(1e18))) )
not const, open for future save into state by system contract
var ( StakingModuleAddr = meter.BytesToAddress([]byte("staking-module-address")) // 0x616B696e672D6D6F64756c652d61646472657373 DelegateListKey = meter.Blake2b([]byte("delegate-list-key")) CandidateListKey = meter.Blake2b([]byte("candidate-list-key")) StakeHolderListKey = meter.Blake2b([]byte("stake-holder-list-key")) BucketListKey = meter.Blake2b([]byte("global-bucket-list-key")) StatisticsListKey = meter.Blake2b([]byte("delegate-statistics-list-key")) StatisticsEpochKey = meter.Blake2b([]byte("delegate-statistics-epoch-key")) InJailListKey = meter.Blake2b([]byte("delegate-injail-list-key")) ValidatorRewardListKey = meter.Blake2b([]byte("validator-reward-list-key")) )
the global variables in staking
Functions ¶
func GetBoundLockOption ¶
func GetBoundLocktime ¶
func GetCommissionRate ¶
func GetInternalDelegateList ¶
func GetInternalDelegateList() ([]*types.DelegateIntern, error)
consensus routine interface
func InTimeSpan ¶
func PackInfractionToBytes ¶
func PackInfractionToBytes(v *Infraction) ([]byte, error)
func SetStakingGlobInst ¶
func SetStakingGlobInst(inst *Staking)
func StakingEncodeBytes ¶
func StakingEncodeBytes(sb *StakingBody) []byte
Types ¶
type Bucket ¶
type Bucket struct {
BucketID meter.Bytes32
Owner meter.Address // stake holder
Value *big.Int // staking unit Wei
Token uint8 // token type MTR / MTRG
Nonce uint64 // nonce
CreateTime uint64 // bucket create time
//non-key fields
Unbounded bool // this bucket is unbounded, get rid of it after mature
Candidate meter.Address // candidate
Rate uint8 // bounus rate
Option uint32 // option, link with rate
BonusVotes uint64 // extra votes from staking
TotalVotes *big.Int // Value votes + extra votes
MatureTime uint64 // time durations, seconds
CalcLastTime uint64 // last calculate bounus votes timestamp
}
Candidate indicates the structure of a candidate
func (*Bucket) IsForeverLock ¶
func (*Bucket) UpdateLockOption ¶
type BucketList ¶
type BucketList struct {
// contains filtered or unexported fields
}
func GetLatestBucketList ¶
func GetLatestBucketList() (*BucketList, error)
func (*BucketList) Add ¶
func (l *BucketList) Add(b *Bucket)
func (*BucketList) Remove ¶
func (l *BucketList) Remove(id meter.Bytes32)
func (*BucketList) ToList ¶
func (l *BucketList) ToList() []Bucket
func (*BucketList) ToString ¶
func (l *BucketList) ToString() string
type Candidate ¶
type Candidate struct {
Addr meter.Address // the address for staking / reward
Name []byte
PubKey []byte // node public key
IPAddr []byte // network addr
Port uint16
Commission uint64 // unit shannon, aka 1e09
Timestamp uint64 // last update time
TotalVotes *big.Int // total voting from all buckets
Buckets []meter.Bytes32 // all buckets voted for this candidate
}
Candidate indicates the structure of a candidate
func NewCandidate ¶
func (*Candidate) RemoveBucket ¶
type CandidateList ¶
type CandidateList struct {
// contains filtered or unexported fields
}
func GetLatestCandidateList ¶
func GetLatestCandidateList() (*CandidateList, error)
api routine interface
func NewCandidateList ¶
func NewCandidateList(candidates []*Candidate) *CandidateList
func (*CandidateList) Add ¶
func (cl *CandidateList) Add(c *Candidate)
func (*CandidateList) Count ¶
func (cl *CandidateList) Count() int
func (*CandidateList) Remove ¶
func (cl *CandidateList) Remove(addr meter.Address)
func (*CandidateList) ToList ¶
func (l *CandidateList) ToList() []Candidate
func (*CandidateList) ToString ¶
func (cl *CandidateList) ToString() string
type Delegate ¶
type Delegate struct {
Address meter.Address
PubKey []byte //ecdsa.PublicKey
Name []byte
VotingPower *big.Int
IPAddr []byte
Port uint16
Commission uint64 // commission rate. unit shannon, aka, 1e09
DistList []*Distributor
}
====
func (*Delegate) MinimumRequirements ¶
match minimum requirements? 1. not on injail list 2. > 300 MTRG
type DelegateInJailList ¶
type DelegateInJailList struct {
// contains filtered or unexported fields
}
func GetLatestInJailList ¶
func GetLatestInJailList() (*DelegateInJailList, error)
api routine interface
func NewDelegateInJailList ¶
func NewDelegateInJailList(in []*DelegateJailed) *DelegateInJailList
func (*DelegateInJailList) Add ¶
func (dl *DelegateInJailList) Add(c *DelegateJailed)
func (*DelegateInJailList) Count ¶
func (dl *DelegateInJailList) Count() int
func (*DelegateInJailList) Get ¶
func (dl *DelegateInJailList) Get(addr meter.Address) *DelegateJailed
func (*DelegateInJailList) ToList ¶
func (dl *DelegateInJailList) ToList() []DelegateJailed
func (*DelegateInJailList) ToString ¶
func (dl *DelegateInJailList) ToString() string
type DelegateJailed ¶
type DelegateJailed struct {
Addr meter.Address // the address for staking / reward
Name []byte
PubKey []byte // node public key
TotalPts uint64 // total points of infraction
Infractions Infraction
BailAmount *big.Int //fine
JailedTime uint64
}
Candidate indicates the structure of a candidate
func NewDelegateJailed ¶
func NewDelegateJailed(addr meter.Address, name []byte, pubKey []byte, pts uint64, inf *Infraction, bail *big.Int, timeStamp uint64) *DelegateJailed
func (*DelegateJailed) ToString ¶
func (d *DelegateJailed) ToString() string
type DelegateList ¶
type DelegateList struct {
// contains filtered or unexported fields
}
func GetLatestDelegateList ¶
func GetLatestDelegateList() (*DelegateList, error)
api routine interface
func (*DelegateList) Add ¶
func (l *DelegateList) Add(c *Delegate) error
func (*DelegateList) CleanAll ¶
func (l *DelegateList) CleanAll() error
func (*DelegateList) GetDelegates ¶
func (l *DelegateList) GetDelegates() []*Delegate
func (*DelegateList) Members ¶
func (l *DelegateList) Members() string
func (*DelegateList) SetDelegates ¶
func (l *DelegateList) SetDelegates(delegates []*Delegate)
func (*DelegateList) ToString ¶
func (l *DelegateList) ToString() string
type DelegateStatistics ¶
type DelegateStatistics struct {
Addr meter.Address // the address for staking / reward
Name []byte
PubKey []byte // node public key
TotalPts uint64 // total points of infraction
Infractions Infraction
}
Candidate indicates the structure of a candidate
func NewDelegateStatistics ¶
func NewDelegateStatistics(addr meter.Address, name []byte, pubKey []byte) *DelegateStatistics
func (*DelegateStatistics) PhaseOut ¶
func (ds *DelegateStatistics) PhaseOut(curEpoch uint32)
func (*DelegateStatistics) ToString ¶
func (ds *DelegateStatistics) ToString() string
func (*DelegateStatistics) Update ¶
func (ds *DelegateStatistics) Update(incr *Infraction) bool
type Distributor ¶
func NewDistributor ¶
func NewDistributor(addr meter.Address, shares uint64) *Distributor
func (*Distributor) ToString ¶
func (d *Distributor) ToString() string
type DoubleSigner ¶
type DoubleSigner struct {
Counter uint32
Info []*DoubleSignerInfo
}
type Infraction ¶
type Infraction struct {
MissingLeaders MissingLeader
MissingProposers MissingProposer
MissingVoters MissingVoter
DoubleSigners DoubleSigner
}
func UnpackBytesToInfraction ¶
func UnpackBytesToInfraction(b []byte) (*Infraction, error)
func (*Infraction) String ¶
func (inf *Infraction) String() string
type MissingLeader ¶
type MissingLeader struct {
Counter uint32
Info []*MissingLeaderInfo
}
type MissingProposer ¶
type MissingProposer struct {
Counter uint32
Info []*MissingProposerInfo
}
type MissingProposerInfo ¶
MissingProposer
type MissingVoter ¶
type MissingVoter struct {
Counter uint32
Info []*MissingVoterInfo
}
type RewardInfoMap ¶
type RewardInfoMap map[meter.Address]*RewardInfo
// RewardInfoMap
func (RewardInfoMap) ToList ¶
func (rmap RewardInfoMap) ToList() (*big.Int, []*RewardInfo)
type Stakeholder ¶
type Stakeholder struct {
Holder meter.Address // the address for staking / reward
TotalStake *big.Int // total voting from all buckets
Buckets []meter.Bytes32 // all buckets voted for this Stakeholder
}
Stakeholder indicates the structure of a Stakeholder
func NewStakeholder ¶
func NewStakeholder(holder meter.Address) *Stakeholder
func (*Stakeholder) AddBucket ¶
func (s *Stakeholder) AddBucket(bucket *Bucket)
func (*Stakeholder) RemoveBucket ¶
func (s *Stakeholder) RemoveBucket(bucket *Bucket)
func (*Stakeholder) ToString ¶
func (s *Stakeholder) ToString() string
type StakeholderList ¶
type StakeholderList struct {
// contains filtered or unexported fields
}
func GetLatestStakeholderList ¶
func GetLatestStakeholderList() (*StakeholderList, error)
func (*StakeholderList) Add ¶
func (l *StakeholderList) Add(s *Stakeholder)
func (*StakeholderList) Get ¶
func (l *StakeholderList) Get(addr meter.Address) *Stakeholder
func (*StakeholderList) Remove ¶
func (l *StakeholderList) Remove(addr meter.Address)
func (*StakeholderList) ToList ¶
func (l *StakeholderList) ToList() []Stakeholder
func (*StakeholderList) ToString ¶
func (l *StakeholderList) ToString() string
type Staking ¶
type Staking struct {
// contains filtered or unexported fields
}
Candidate indicates the structure of a candidate
var (
StakingGlobInst *Staking
)
func GetStakingGlobInst ¶
func GetStakingGlobInst() *Staking
func (*Staking) BoundAccountMeter ¶
==================== bound/unbound account ===========================
func (*Staking) BoundAccountMeterGov ¶
func (s *Staking) BoundAccountMeterGov(addr meter.Address, amount *big.Int, state *state.State) error
bound a meter gov in an account -- move amount from balance to bounded balance
func (*Staking) CollectBailMeterGov ¶
func (s *Staking) CollectBailMeterGov(addr meter.Address, amount *big.Int, state *state.State) error
collect bail to StakingModuleAddr. addr ==> StakingModuleAddr
func (*Staking) DistValidatorRewards ¶
func (s *Staking) DistValidatorRewards(amount *big.Int, validators []*meter.Address, list *DelegateList, state *state.State) (*big.Int, []*RewardInfo, error)
1. distributes the base reward (meter.ValidatorBaseReward) for each validator. If there is remainning 2. get the propotion reward for each validator based on the votingpower 3. each validator takes commission first 4. finally, distributor takes their propotions of rest
func (*Staking) GetBucketList ¶
func (s *Staking) GetBucketList(state *state.State) (result *BucketList)
Bucket List
func (*Staking) GetCandidateList ¶
func (s *Staking) GetCandidateList(state *state.State) (result *CandidateList)
Candidate List
func (*Staking) GetDelegateList ¶
func (s *Staking) GetDelegateList(state *state.State) (result *DelegateList)
Delegates List
func (*Staking) GetInJailList ¶
func (s *Staking) GetInJailList(state *state.State) (result *DelegateInJailList)
inJail List
func (*Staking) GetStakeHolderList ¶
func (s *Staking) GetStakeHolderList(state *state.State) (result *StakeholderList)
StakeHolder List
func (*Staking) GetStatisticsEpoch ¶
Statistics List, unlike others, save/get list
func (*Staking) GetStatisticsList ¶
func (s *Staking) GetStatisticsList(state *state.State) (result *StatisticsList)
==== Statistics List, unlike others, save/get list
func (*Staking) GetValidatorRewardList ¶
func (s *Staking) GetValidatorRewardList(state *state.State) (result *ValidatorRewardList)
validator reward list
func (*Staking) PrepareStakingHandler ¶
func (*Staking) SetBucketList ¶
func (s *Staking) SetBucketList(bucketList *BucketList, state *state.State)
func (*Staking) SetCandidateList ¶
func (s *Staking) SetCandidateList(candList *CandidateList, state *state.State)
func (*Staking) SetDelegateList ¶
func (s *Staking) SetDelegateList(delegateList *DelegateList, state *state.State)
func (*Staking) SetInJailList ¶
func (s *Staking) SetInJailList(list *DelegateInJailList, state *state.State)
func (*Staking) SetStakeHolderList ¶
func (s *Staking) SetStakeHolderList(holderList *StakeholderList, state *state.State)
func (*Staking) SetStatisticsEpoch ¶
func (*Staking) SetStatisticsList ¶
func (s *Staking) SetStatisticsList(list *StatisticsList, state *state.State)
func (*Staking) SetValidatorRewardList ¶
func (s *Staking) SetValidatorRewardList(list *ValidatorRewardList, state *state.State)
func (*Staking) TransferValidatorReward ¶
func (s *Staking) TransferValidatorReward(amount *big.Int, addr meter.Address, state *state.State) error
from meter.ValidatorBenefitAddr ==> addr
func (*Staking) UnboundAccountMeter ¶
type StakingBody ¶
type StakingBody struct {
Opcode uint32
Version uint32
Option uint32
HolderAddr meter.Address
CandAddr meter.Address
CandName []byte
CandPubKey []byte //ecdsa.PublicKey
CandIP []byte
CandPort uint16
StakingID meter.Bytes32 // only for unbond
Amount *big.Int
Token byte // meter or meter gov
Timestamp uint64 // staking timestamp
Nonce uint64 //staking nonce
ExtraData []byte
}
Candidate indicates the structure of a candidate
func StakingDecodeFromBytes ¶
func StakingDecodeFromBytes(bytes []byte) (*StakingBody, error)
func (*StakingBody) BoundHandler ¶
func (sb *StakingBody) BoundHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) CandidateHandler ¶
func (sb *StakingBody) CandidateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) CandidateUpdateHandler ¶
func (sb *StakingBody) CandidateUpdateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
This method only update the attached infomation of candidate. Stricted to: name, public key, IP/port, commission
func (*StakingBody) DelegateExitJailHandler ¶
func (sb *StakingBody) DelegateExitJailHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) DelegateHandler ¶
func (sb *StakingBody) DelegateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) DelegateStatisticsFlushHandler ¶
func (sb *StakingBody) DelegateStatisticsFlushHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
this is debug API, only executor has the right to call
func (*StakingBody) DelegateStatisticsHandler ¶
func (sb *StakingBody) DelegateStatisticsHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) GoverningHandler ¶
func (sb *StakingBody) GoverningHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) ToString ¶
func (sb *StakingBody) ToString() string
func (*StakingBody) UnBoundHandler ¶
func (sb *StakingBody) UnBoundHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) UnCandidateHandler ¶
func (sb *StakingBody) UnCandidateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
func (*StakingBody) UnDelegateHandler ¶
func (sb *StakingBody) UnDelegateHandler(senv *StakingEnviroment, gas uint64) (ret []byte, leftOverGas uint64, err error)
type StakingEnviroment ¶
type StakingEnviroment struct {
// contains filtered or unexported fields
}
func NewStakingEnviroment ¶
func NewStakingEnviroment(staking *Staking, state *state.State, txCtx *xenv.TransactionContext, to *meter.Address) *StakingEnviroment
func (*StakingEnviroment) GetStaking ¶
func (senv *StakingEnviroment) GetStaking() *Staking
func (*StakingEnviroment) GetState ¶
func (senv *StakingEnviroment) GetState() *state.State
func (*StakingEnviroment) GetToAddr ¶
func (senv *StakingEnviroment) GetToAddr() *meter.Address
func (*StakingEnviroment) GetTxCtx ¶
func (senv *StakingEnviroment) GetTxCtx() *xenv.TransactionContext
type StatisticsList ¶
type StatisticsList struct {
// contains filtered or unexported fields
}
func GetLatestStatisticsList ¶
func GetLatestStatisticsList() (*StatisticsList, error)
func NewStatisticsList ¶
func NewStatisticsList(delegates []*DelegateStatistics) *StatisticsList
func (*StatisticsList) Add ¶
func (sl *StatisticsList) Add(c *DelegateStatistics)
func (*StatisticsList) Count ¶
func (sl *StatisticsList) Count() int
func (*StatisticsList) Get ¶
func (sl *StatisticsList) Get(addr meter.Address) *DelegateStatistics
func (*StatisticsList) Remove ¶
func (sl *StatisticsList) Remove(addr meter.Address)
func (*StatisticsList) ToList ¶
func (sl *StatisticsList) ToList() []DelegateStatistics
func (*StatisticsList) ToString ¶
func (sl *StatisticsList) ToString() string
type ValidatorReward ¶
type ValidatorReward struct {
Epoch uint32
BaseReward *big.Int
ExpectDistribute *big.Int
ActualDistribute *big.Int
}
func (*ValidatorReward) ToString ¶
func (v *ValidatorReward) ToString() string
type ValidatorRewardList ¶
type ValidatorRewardList struct {
// contains filtered or unexported fields
}
func GetLatestValidatorRewardList ¶
func GetLatestValidatorRewardList() (*ValidatorRewardList, error)
api routine interface
func NewValidatorRewardList ¶
func NewValidatorRewardList(rewards []*ValidatorReward) *ValidatorRewardList
func (*ValidatorRewardList) Count ¶
func (v *ValidatorRewardList) Count() int
func (*ValidatorRewardList) Get ¶
func (v *ValidatorRewardList) Get(epoch uint32) *ValidatorReward
func (*ValidatorRewardList) GetList ¶
func (v *ValidatorRewardList) GetList() []*ValidatorReward
func (*ValidatorRewardList) String ¶
func (v *ValidatorRewardList) String() string
func (*ValidatorRewardList) ToList ¶
func (v *ValidatorRewardList) ToList() []*ValidatorReward
func (*ValidatorRewardList) ToString ¶
func (v *ValidatorRewardList) ToString() string