staking

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: LGPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

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

View Source
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
)
View Source
const (
	TOKEN_METER     = byte(0)
	TOKEN_METER_GOV = byte(1)

	STAKING_TIMESPAN = uint64(720)
)
View Source
const (
	MIN_CANDIDATE_UPDATE_INTV = uint64(3600 * 24) // 1 day
)
View Source
const (
	STAKING_MAX_VALIDATOR_REWARDS = 1200
)

Variables

View Source
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

View Source
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

View Source
var (
	// bound minimium requirement 10 mtrgov
	MIN_BOUND_BALANCE *big.Int = new(big.Int).Mul(big.NewInt(10), big.NewInt(1e18)) // 10 mtrGov minimum
)

Functions

func GetBoundLockOption

func GetBoundLockOption(chose uint32) (opt uint32, rate uint8, locktime uint64)

func GetBoundLocktime

func GetBoundLocktime(opt uint32) (lock uint64)

func GetCommissionRate

func GetCommissionRate(opt uint32) uint64

func GetInternalDelegateList

func GetInternalDelegateList() ([]*types.DelegateIntern, error)

consensus routine interface

func GetOpName

func GetOpName(op uint32) string

func InTimeSpan

func InTimeSpan(ts, now, span uint64) bool

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 NewBucket

func NewBucket(owner meter.Address, cand meter.Address, value *big.Int, token uint8, opt uint32, rate uint8, create uint64, nonce uint64) *Bucket

func (*Bucket) ID

func (b *Bucket) ID() (hash meter.Bytes32)

bucketID Candidate .. are excluded

func (*Bucket) IsForeverLock

func (b *Bucket) IsForeverLock() bool

func (*Bucket) ToString

func (b *Bucket) ToString() string

func (*Bucket) UpdateLockOption

func (b *Bucket) UpdateLockOption(opt uint32, rate uint8)

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

func (l *BucketList) Exist(id meter.Bytes32) bool

func (*BucketList) Get

func (l *BucketList) Get(id meter.Bytes32) *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 NewCandidate(addr meter.Address, name []byte, pubKey []byte, ip []byte, port uint16, commission uint64,
	timeStamp uint64) *Candidate

func (*Candidate) AddBucket

func (c *Candidate) AddBucket(bucket *Bucket)

func (*Candidate) RemoveBucket

func (c *Candidate) RemoveBucket(bucket *Bucket)

func (*Candidate) ToString

func (c *Candidate) ToString() string

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

func (cl *CandidateList) Exist(addr meter.Address) bool

func (*CandidateList) Get

func (cl *CandidateList) Get(addr meter.Address) *Candidate

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

func (d *Delegate) MinimumRequirements(state *state.State) bool

match minimum requirements? 1. not on injail list 2. > 300 MTRG

func (*Delegate) ToString

func (d *Delegate) ToString() string

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

func (dl *DelegateInJailList) Exist(addr meter.Address) bool

func (*DelegateInJailList) Get

func (*DelegateInJailList) Remove

func (dl *DelegateInJailList) Remove(addr meter.Address) error

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

type Distributor struct {
	Address meter.Address
	Shares  uint64 // unit shannon, aka, 1e09
}

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 DoubleSignerInfo

type DoubleSignerInfo struct {
	Epoch  uint32
	Height uint32
}

DoubleSigner

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 MissingLeaderInfo

type MissingLeaderInfo struct {
	Epoch uint32
	Round uint32
}

MissingLeader

type MissingProposer

type MissingProposer struct {
	Counter uint32
	Info    []*MissingProposerInfo
}

type MissingProposerInfo

type MissingProposerInfo struct {
	Epoch  uint32
	Height uint32
}

MissingProposer

type MissingVoter

type MissingVoter struct {
	Counter uint32
	Info    []*MissingVoterInfo
}

type MissingVoterInfo

type MissingVoterInfo struct {
	Epoch  uint32
	Height uint32
}

MissingVoter

type RewardInfo

type RewardInfo struct {
	Address meter.Address
	Amount  *big.Int
}

type RewardInfoMap

type RewardInfoMap map[meter.Address]*RewardInfo

// RewardInfoMap

func (RewardInfoMap) Add

func (rmap RewardInfoMap) Add(amount *big.Int, addr meter.Address) error

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

func (l *StakeholderList) Exist(addr meter.Address) bool

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 NewStaking

func NewStaking(ch *chain.Chain, sc *state.Creator) *Staking

func (*Staking) BoundAccountMeter

func (s *Staking) BoundAccountMeter(addr meter.Address, amount *big.Int, state *state.State) error

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

func (s *Staking) GetStatisticsEpoch(state *state.State) (result uint32)

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 (s *Staking) PrepareStakingHandler() (StakingHandler func(data []byte, to *meter.Address, txCtx *xenv.TransactionContext, gas uint64, state *state.State) (ret []byte, leftOverGas uint64, err error))

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 (s *Staking) SetStatisticsEpoch(phaseOutEpoch uint32, state *state.State)

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

func (s *Staking) Start() error

func (*Staking) TransferValidatorReward

func (s *Staking) TransferValidatorReward(amount *big.Int, addr meter.Address, state *state.State) error

from meter.ValidatorBenefitAddr ==> addr

func (*Staking) UnboundAccountMeter

func (s *Staking) UnboundAccountMeter(addr meter.Address, amount *big.Int, state *state.State) error

func (*Staking) UnboundAccountMeterGov

func (s *Staking) UnboundAccountMeterGov(addr meter.Address, amount *big.Int, state *state.State) error

unbound a meter gov in an account -- move amount from bounded balance to balance

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

func (sl *StatisticsList) Exist(addr meter.Address) bool

func (*StatisticsList) Get

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 (*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

Jump to

Keyboard shortcuts

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