Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyValidatorSet returns when valset from smart-contract is empty ErrEmptyValidatorSet = errors.New("empty validator set") // ErrLengthOfCandidatesAndStakesMisMatch returns when lengths stakes and candidates are not match ErrLengthOfCandidatesAndStakesMisMatch = errors.New("length of stakes is not equal to length of candidates") // ErrLengthOfVotesAndStakesMisMatch returns when lengths voters and stakes are not match ErrLengthOfVotesAndStakesMisMatch = errors.New("length of voters is not equal to length of stakes") )
View Source
var DefaultConfig = &IndexConfigs{ WithdrawsStateLayout: NewLayOut(1, 0), CandidateVotersLayout: NewLayOut(2, 0), CandidateDataLayout: NewLayOut(3, 0), CandidatesLayout: NewLayOut(4, 0), StartBlockLayout: NewLayOut(5, 0), EpochPeriodLayout: NewLayOut(6, 0), MaxValidatorSizeLayout: NewLayOut(7, 0), MinValidatorStakeLayout: NewLayOut(8, 0), MinVoterCapLayout: NewLayOut(9, 0), AdminLayout: NewLayOut(10, 0), CandidateDataStruct: CandidateDataStructIndex{ TotalStake: NewLayOut(1, 0), Owner: NewLayOut(2, 0), VotersStakes: NewLayOut(3, 0), }, }
DefaultConfig represents he default configuration.
Functions ¶
Types ¶
type CandidateData ¶
type CandidateDataStructIndex ¶
layout inside candidateData struct
type IndexConfigs ¶
type IndexConfigs struct {
WithdrawsStateLayout LayOut //1
CandidateVotersLayout LayOut //2
CandidateDataLayout LayOut //3
CandidatesLayout LayOut //4
StartBlockLayout LayOut //5
EpochPeriodLayout LayOut //6
MaxValidatorSizeLayout LayOut //7
MinValidatorStakeLayout LayOut //8
MinVoterCapLayout LayOut //9
AdminLayout LayOut //10
CandidateDataStruct CandidateDataStructIndex
}
IndexConfigs represents the configuration index of state variables.
type StakingCaller ¶
type StakingCaller interface {
// GetValidators returns list of validators, calculate from current stateDB
GetValidators(common.Address) ([]common.Address, error)
// GetValidatorsData return information of validators including owner, totalStake and voterStakes
GetValidatorsData(common.Address, []common.Address) (map[common.Address]CandidateData, error)
}
func NewEVMStakingCaller
deprecated
func NewEVMStakingCaller(stateDB *state.StateDB, chainContext core.ChainContext, header *types.Header, chainConfig *params.ChainConfig, vmConfig vm.Config) StakingCaller
Deprecated: Using NewStateDbStakingCaller instead of NewBECaller returns staking caller which reads data from staking smart-contract by execute a call from evm
func NewStateDbStakingCaller ¶
func NewStateDbStakingCaller(state *state.StateDB, cfg *IndexConfigs) StakingCaller
NewStateDbStakingCaller return instance of StakingCaller which reads data directly from state DB
Click to show internal directories.
Click to hide internal directories.