Documentation ¶
Index ¶
- Constants
- Variables
- func Decimal(value float64) int
- func GetBlockNumberByEpoch(epoch uint64) uint64
- func GetHistoryCumulativeIssue(state xcom.StateDB, year uint32) *big.Int
- func GetLatestEpoch(stateDb xcom.StateDB) uint64
- func GetYearEndBalance(state xcom.StateDB, year uint32) *big.Int
- func RewardMgrInstance() *rewardMgrPlugin
- func SetLatestEpoch(stateDb xcom.StateDB, epoch uint64)
- func SetYearEndBalance(state xcom.StateDB, year uint32, balance *big.Int)
- func SetYearEndCumulativeIssue(state xcom.StateDB, year uint32, total *big.Int)
- func Verify_tx_data(input []byte, command map[uint16]interface{}) (cnCode uint16, fn interface{}, FnParams []reflect.Value, err error)
- type BasePlugin
- type GovPlugin
- type RestrictingPlugin
- func (rp *RestrictingPlugin) AddRestrictingRecord(from, account common.Address, plans []restricting.RestrictingPlan, ...) error
- func (rp *RestrictingPlugin) BeginBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
- func (rp *RestrictingPlugin) Confirmed(block *types.Block) error
- func (rp *RestrictingPlugin) EndBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
- func (rp *RestrictingPlugin) GetRestrictingInfo(account common.Address, state xcom.StateDB) ([]byte, error)
- func (rp *RestrictingPlugin) PledgeLockFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
- func (rp *RestrictingPlugin) ReturnLockFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
- func (rp *RestrictingPlugin) SlashingNotify(account common.Address, amount *big.Int, state xcom.StateDB) error
- type SlashingPlugin
- func (sp *SlashingPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sp *SlashingPlugin) CheckDuplicateSign(addr common.Address, blockNumber uint64, dupType consensus.EvidenceType, ...) ([]byte, error)
- func (sp *SlashingPlugin) Confirmed(block *types.Block) error
- func (sp *SlashingPlugin) DecodeEvidence(dupType consensus.EvidenceType, data string) (consensus.Evidence, error)
- func (sp *SlashingPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sp *SlashingPlugin) GetPreNodeAmount(parentHash common.Hash) (map[discover.NodeID]uint32, error)
- func (sp *SlashingPlugin) SetDecodeEvidenceFun(...)
- func (sp *SlashingPlugin) SetPrivateKey(privateKey *ecdsa.PrivateKey)
- func (sp *SlashingPlugin) Slash(evidence consensus.Evidence, blockHash common.Hash, blockNumber uint64, ...) error
- type StakingPlugin
- func (sk *StakingPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sk *StakingPlugin) Confirmed(block *types.Block) error
- func (sk *StakingPlugin) CreateCandidate(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int, ...) error
- func (sk *StakingPlugin) DeclarePromoteNotify(blockHash common.Hash, blockNumber uint64, nodeId discover.NodeID, ...) error
- func (sk *StakingPlugin) Delegate(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, ...) error
- func (sk *StakingPlugin) EditCandidate(blockHash common.Hash, blockNumber *big.Int, can *staking.Candidate) error
- func (sk *StakingPlugin) ElectNextVerifierList(blockHash common.Hash, blockNumber uint64, state xcom.StateDB) error
- func (sk *StakingPlugin) Election(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sk *StakingPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sk *StakingPlugin) GetCandidateCompactInfo(blockHash common.Hash, blockNumber uint64, addr common.Address) (*staking.CandidateHex, error)
- func (sk *StakingPlugin) GetCandidateInfo(blockHash common.Hash, addr common.Address) (*staking.Candidate, error)
- func (sk *StakingPlugin) GetCandidateInfoByIrr(addr common.Address) (*staking.Candidate, error)
- func (sk *StakingPlugin) GetCandidateList(blockHash common.Hash, blockNumber uint64) (staking.CandidateHexQueue, error)
- func (sk *StakingPlugin) GetCandidateONEpoch(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.CandidateQueue, error)
- func (sk *StakingPlugin) GetCandidateONRound(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) (staking.CandidateQueue, error)
- func (sk *StakingPlugin) GetDelegateExCompactInfo(blockHash common.Hash, blockNumber uint64, delAddr common.Address, ...) (*staking.DelegationEx, error)
- func (sk *StakingPlugin) GetDelegateExInfo(blockHash common.Hash, delAddr common.Address, nodeId discover.NodeID, ...) (*staking.DelegationEx, error)
- func (sk *StakingPlugin) GetDelegateExInfoByIrr(delAddr common.Address, nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.DelegationEx, error)
- func (sk *StakingPlugin) GetDelegateInfo(blockHash common.Hash, delAddr common.Address, nodeId discover.NodeID, ...) (*staking.Delegation, error)
- func (sk *StakingPlugin) GetDelegateInfoByIrr(delAddr common.Address, nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.Delegation, error)
- func (sk *StakingPlugin) GetLastNumber(blockNumber uint64) uint64
- func (sk *StakingPlugin) GetRelatedListByDelAddr(blockHash common.Hash, addr common.Address) (staking.DelRelatedQueue, error)
- func (sk *StakingPlugin) GetValidator(blockNumber uint64) (*cbfttypes.Validators, error)
- func (sk *StakingPlugin) GetValidatorList(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) (staking.ValidatorExQueue, error)
- func (sk *StakingPlugin) GetVerifierList(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.ValidatorExQueue, error)
- func (sk *StakingPlugin) HandleUnCandidateItem(state xcom.StateDB, blockNumber uint64, blockHash common.Hash, epoch uint64) error
- func (sk *StakingPlugin) HandleUnDelegateItem(state xcom.StateDB, blockNumber uint64, blockHash common.Hash, epoch uint64) error
- func (sk *StakingPlugin) HasStake(blockHash common.Hash, addr common.Address) (bool, error)
- func (sk *StakingPlugin) IncreaseStaking(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int, ...) error
- func (sk *StakingPlugin) IsCandidate(blockHash common.Hash, nodeId discover.NodeID, isCommit bool) (bool, error)
- func (sk *StakingPlugin) IsCandidateNode(nodeID discover.NodeID) bool
- func (sk *StakingPlugin) IsCurrValidator(blockHash common.Hash, blockNumber uint64, nodeId discover.NodeID, ...) (bool, error)
- func (sk *StakingPlugin) IsCurrVerifier(blockHash common.Hash, blockNumber uint64, nodeId discover.NodeID, ...) (bool, error)
- func (sk *StakingPlugin) ListCurrentValidatorID(blockHash common.Hash, blockNumber uint64) ([]discover.NodeID, error)
- func (sk *StakingPlugin) ListVerifierNodeID(blockHash common.Hash, blockNumber uint64) ([]discover.NodeID, error)
- func (sk *StakingPlugin) ProposalPassedNotify(blockHash common.Hash, blockNumber uint64, nodeIds []discover.NodeID, ...) error
- func (sk *StakingPlugin) RollBackStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, ...) error
- func (sk *StakingPlugin) SetEventMux(eventMux *event.TypeMux)
- func (sk *StakingPlugin) SlashCandidates(state xcom.StateDB, blockHash common.Hash, blockNumber uint64, ...) error
- func (sk *StakingPlugin) WithdrewDelegate(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int, ...) error
- func (sk *StakingPlugin) WithdrewStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, ...) error
Constants ¶
const ( LessThanFoundationYearDeveloperRate = 100 AfterFoundationYearDeveloperRewardRate = 50 AfterFoundationYearFoundRewardRate = 50 IncreaseIssue = 40 RewardPoolIncreaseRate = 80 // 80% of fixed-issued tokens are allocated to reward pool each year )
Variables ¶
var ( DecodeTxDataErr = errors.New("decode tx data is err") FuncNotExistErr = errors.New("the func is not exist") FnParamsLenErr = errors.New("the params len and func params len is not equal") )
var ( AccountVonNotEnough = common.NewBizError("The von of account is not enough") BalanceOperationTypeErr = common.NewBizError("Balance OperationType is wrong") DelegateVonNotEnough = common.NewBizError("The von of delegate is not enough") WithdrewDelegateVonCalcErr = common.NewBizError("Withdrew delegate von calculate err") ParamsErr = common.NewBizError("The fn params err") BlockNumberDisordered = common.NewBizError("The blockNumber is disordered") VonAmountNotRight = common.NewBizError("The amount of von is not right") CandidateNotExist = common.NewBizError("The candidate is not exist") ValidatorNotExist = common.NewBizError("The validator is not exist") )
Functions ¶
func GetBlockNumberByEpoch ¶
func GetHistoryCumulativeIssue ¶
GetHistoryCumulativeIssue used for get the cumulative issuance of a certain year in history
func GetLatestEpoch ¶
func RewardMgrInstance ¶
func RewardMgrInstance() *rewardMgrPlugin
func SetYearEndCumulativeIssue ¶
SetYearEndCumulativeIssue used for set historical cumulative increase at the end of the year
Types ¶
type BasePlugin ¶
type GovPlugin ¶
type GovPlugin struct { }
func GovPluginInstance ¶
func GovPluginInstance() *GovPlugin
type RestrictingPlugin ¶
type RestrictingPlugin struct {
// contains filtered or unexported fields
}
func RestrictingInstance ¶
func RestrictingInstance() *RestrictingPlugin
func (*RestrictingPlugin) AddRestrictingRecord ¶
func (rp *RestrictingPlugin) AddRestrictingRecord(from, account common.Address, plans []restricting.RestrictingPlan, state xcom.StateDB) error
AddRestrictingRecord stores four K-V record in StateDB: RestrictingInfo: the account info to be released ReleaseEpoch: the number of accounts to be released on the epoch corresponding to the target block height ReleaseAccount: the account on the index on the target epoch ReleaseAmount: the amount of the account to be released on the target epoch
func (*RestrictingPlugin) BeginBlock ¶
func (rp *RestrictingPlugin) BeginBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
BeginBlock does something like check input params before execute transactions, in RestrictingPlugin it does nothing.
func (*RestrictingPlugin) Confirmed ¶
func (rp *RestrictingPlugin) Confirmed(block *types.Block) error
Confirmed is empty function
func (*RestrictingPlugin) EndBlock ¶
func (rp *RestrictingPlugin) EndBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
EndBlock invoke releaseRestricting
func (*RestrictingPlugin) GetRestrictingInfo ¶
func (*RestrictingPlugin) PledgeLockFunds ¶
func (rp *RestrictingPlugin) PledgeLockFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
PledgeLockFunds transfer the money from the restricting contract account to the staking contract account
func (*RestrictingPlugin) ReturnLockFunds ¶
func (rp *RestrictingPlugin) ReturnLockFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
ReturnLockFunds transfer the money from the staking contract account to the restricting contract account
func (*RestrictingPlugin) SlashingNotify ¶
func (rp *RestrictingPlugin) SlashingNotify(account common.Address, amount *big.Int, state xcom.StateDB) error
SlashingNotify modify Debt of restricting account
type SlashingPlugin ¶
type SlashingPlugin struct {
// contains filtered or unexported fields
}
func SlashInstance ¶
func SlashInstance() *SlashingPlugin
func (*SlashingPlugin) BeginBlock ¶
func (*SlashingPlugin) CheckDuplicateSign ¶
func (sp *SlashingPlugin) CheckDuplicateSign(addr common.Address, blockNumber uint64, dupType consensus.EvidenceType, stateDB xcom.StateDB) ([]byte, error)
func (*SlashingPlugin) DecodeEvidence ¶
func (sp *SlashingPlugin) DecodeEvidence(dupType consensus.EvidenceType, data string) (consensus.Evidence, error)
func (*SlashingPlugin) GetPreNodeAmount ¶
func (sp *SlashingPlugin) GetPreNodeAmount(parentHash common.Hash) (map[discover.NodeID]uint32, error)
Get the consensus rate of all nodes in the previous round
func (*SlashingPlugin) SetDecodeEvidenceFun ¶
func (sp *SlashingPlugin) SetDecodeEvidenceFun(f func(dupType consensus.EvidenceType, data string) (consensus.Evidence, error))
func (*SlashingPlugin) SetPrivateKey ¶
func (sp *SlashingPlugin) SetPrivateKey(privateKey *ecdsa.PrivateKey)
type StakingPlugin ¶
type StakingPlugin struct {
// contains filtered or unexported fields
}
func (*StakingPlugin) BeginBlock ¶
func (*StakingPlugin) CreateCandidate ¶
func (*StakingPlugin) DeclarePromoteNotify ¶
func (*StakingPlugin) EditCandidate ¶
func (*StakingPlugin) ElectNextVerifierList ¶
func (*StakingPlugin) GetCandidateCompactInfo ¶
func (sk *StakingPlugin) GetCandidateCompactInfo(blockHash common.Hash, blockNumber uint64, addr common.Address) (*staking.CandidateHex, error)
func (*StakingPlugin) GetCandidateInfo ¶
func (*StakingPlugin) GetCandidateInfoByIrr ¶
func (*StakingPlugin) GetCandidateList ¶
func (sk *StakingPlugin) GetCandidateList(blockHash common.Hash, blockNumber uint64) (staking.CandidateHexQueue, error)
func (*StakingPlugin) GetCandidateONEpoch ¶
func (sk *StakingPlugin) GetCandidateONEpoch(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.CandidateQueue, error)
func (*StakingPlugin) GetCandidateONRound ¶
func (sk *StakingPlugin) GetCandidateONRound(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) (staking.CandidateQueue, error)
func (*StakingPlugin) GetDelegateExCompactInfo ¶
func (*StakingPlugin) GetDelegateExInfo ¶
func (*StakingPlugin) GetDelegateExInfoByIrr ¶
func (sk *StakingPlugin) GetDelegateExInfoByIrr(delAddr common.Address, nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.DelegationEx, error)
func (*StakingPlugin) GetDelegateInfo ¶
func (*StakingPlugin) GetDelegateInfoByIrr ¶
func (sk *StakingPlugin) GetDelegateInfoByIrr(delAddr common.Address, nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.Delegation, error)
func (*StakingPlugin) GetLastNumber ¶
func (sk *StakingPlugin) GetLastNumber(blockNumber uint64) uint64
func (*StakingPlugin) GetRelatedListByDelAddr ¶
func (sk *StakingPlugin) GetRelatedListByDelAddr(blockHash common.Hash, addr common.Address) (staking.DelRelatedQueue, error)
func (*StakingPlugin) GetValidator ¶
func (sk *StakingPlugin) GetValidator(blockNumber uint64) (*cbfttypes.Validators, error)
func (*StakingPlugin) GetValidatorList ¶
func (sk *StakingPlugin) GetValidatorList(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) ( staking.ValidatorExQueue, error)
flag:NOTE 0: Query previous round consensus validator 1: Query current round consensus validaor 2: Query next round consensus validator
func (*StakingPlugin) GetVerifierList ¶
func (sk *StakingPlugin) GetVerifierList(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.ValidatorExQueue, error)
func (*StakingPlugin) HandleUnCandidateItem ¶
func (*StakingPlugin) HandleUnDelegateItem ¶
func (*StakingPlugin) IncreaseStaking ¶
func (*StakingPlugin) IsCandidate ¶
func (*StakingPlugin) IsCandidateNode ¶
func (sk *StakingPlugin) IsCandidateNode(nodeID discover.NodeID) bool
NOTE: Verify that it is the validator of the current Epoch
func (*StakingPlugin) IsCurrValidator ¶
func (*StakingPlugin) IsCurrVerifier ¶
func (*StakingPlugin) ListCurrentValidatorID ¶
func (*StakingPlugin) ListVerifierNodeID ¶
func (*StakingPlugin) ProposalPassedNotify ¶
func (*StakingPlugin) RollBackStaking ¶
func (sk *StakingPlugin) RollBackStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, addr common.Address, typ uint16) error
/ This method may only be called when creatStaking
func (*StakingPlugin) SetEventMux ¶
func (sk *StakingPlugin) SetEventMux(eventMux *event.TypeMux)