Documentation ¶
Index ¶
- func APIs(chain PosChainReader, backend ethapi.Backend) []rpc.API
- type Activity
- type ApiClientProbability
- type ApiStakerInfo
- type ClientInfo
- type DelegatorInfo
- type EpRnpActivity
- type LeaderJson
- type PartnerInfo
- type PosApi
- func (a PosApi) CalProbability(amountCoin uint64, lockTime uint64) (string, error)
- func (a PosApi) GetActivity(epochID uint64) (*Activity, error)
- func (a PosApi) GetBootNodePK() string
- func (a PosApi) GetChainQuality(epochid uint64, slotid uint64) (uint64, error)
- func (a PosApi) GetEpRnpActivity(epochID uint64) (*EpRnpActivity, error)
- func (a PosApi) GetEpochBlkCnt(epochId uint64) (uint64, error)
- func (a PosApi) GetEpochGasPool(epochID uint64) (string, error)
- func (a PosApi) GetEpochID() uint64
- func (a PosApi) GetEpochIDByTime(timeUnix uint64) uint64
- func (a PosApi) GetEpochIdByBlockNumber(blockNumber uint64) uint64
- func (a PosApi) GetEpochIncentive(epochID uint64) (string, error)
- func (a PosApi) GetEpochIncentiveBlockNumber(epochID uint64) (uint64, error)
- func (a PosApi) GetEpochIncentivePayDetail(epochID uint64) ([]ValidatorInfo, error)
- func (a PosApi) GetEpochLeadersAddrByEpochID(epochID uint64) ([]common.Address, error)
- func (a PosApi) GetEpochLeadersByEpochID(epochID uint64) (map[string]string, error)
- func (a PosApi) GetEpochRemain(epochID uint64) (string, error)
- func (a PosApi) GetEpochStakeOut(epochID uint64) ([]RefundInfo, error)
- func (a PosApi) GetEpochStakerInfo(epochID uint64, addr common.Address) (ApiStakerInfo, error)
- func (a PosApi) GetEpochStakerInfoAll(epochID uint64) ([]ApiStakerInfo, error)
- func (a PosApi) GetIncentivePool(epochID uint64) ([]string, error)
- func (a PosApi) GetIncentiveRunTimes() (string, error)
- func (a PosApi) GetLeaderGroupByEpochID(epochID uint64) ([]LeaderJson, error)
- func (a PosApi) GetLocalPK() (string, error)
- func (a PosApi) GetMaxStableBlkNumber() uint64
- func (a PosApi) GetPosInfo() (info PosInfoJson)
- func (a PosApi) GetRBAddress(epochID uint64) []common.Address
- func (a PosApi) GetRandom(epochId uint64, blockNr int64) (*big.Int, error)
- func (a PosApi) GetRandomProposersAddrByEpochID(epochID uint64) ([]common.Address, error)
- func (a PosApi) GetRandomProposersByEpochID(epochID uint64) (map[string]string, error)
- func (a PosApi) GetRbSignatureCount(epochId uint64, blockNr int64) (int, error)
- func (a PosApi) GetRbStage(slotId uint64) uint64
- func (a PosApi) GetReorgState(epochid uint64) ([]uint64, error)
- func (a PosApi) GetSlStage(slotId uint64) uint64
- func (a PosApi) GetSlotActivity(epochID uint64) (*SlotActivity, error)
- func (a PosApi) GetSlotCount() int
- func (a PosApi) GetSlotCreateStatusByEpochID(epochID uint64) bool
- func (a PosApi) GetSlotID() uint64
- func (a PosApi) GetSlotIDByTime(timeUnix uint64) uint64
- func (a PosApi) GetSlotLeaderByEpochIDAndSlotID(epochID uint64, slotID uint64) string
- func (a PosApi) GetSlotScCallTimesByEpochID(epochID uint64) uint64
- func (a PosApi) GetSlotTime() int
- func (a PosApi) GetSmaByEpochID(epochID uint64) (map[string]string, error)
- func (a PosApi) GetStakerInfo(targetBlkNum uint64) ([]*StakerJson, error)
- func (a PosApi) GetTimeByEpochID(epochID uint64) uint64
- func (a PosApi) GetTotalIncentive() (string, error)
- func (a PosApi) GetTotalRemain() (string, error)
- func (a PosApi) GetTps(fromNumber uint64, toNumber uint64) (string, error)
- func (a PosApi) GetValidRBCnt(epochId uint64) ([]uint64, error)
- func (a PosApi) GetValidSMACnt(epochId uint64) ([]uint64, error)
- func (a PosApi) GetValidatorActivity(epochID uint64) (*ValidatorActivity, error)
- func (a PosApi) GetWhiteListConfig() ([]vm.UpgradeWhiteEpochLeaderParam, error)
- func (a PosApi) GetWhiteListbyEpochID(epochID uint64) ([]string, error)
- func (a PosApi) Version() string
- type PosChainReader
- type PosInfoJson
- type RefundInfo
- type SlotActivity
- type StakerJson
- type ValidatorActivity
- type ValidatorInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activity ¶
type Activity struct { EpLeader []common.Address `json:"epLeader"` EpActivity []int `json:"epActivity"` RpLeader []common.Address `json:"rpLeader"` RpActivity []int `json:"rpActivity"` SltLeader []common.Address `json:"sltLeader"` SlBlocks []int `json:"slBlocks"` SlActivity float64 `json:"slActivity"` SlCtrlCount int `json:"slCtrlCount"` }
type ApiClientProbability ¶
type ApiClientProbability struct { Addr common.Address Probability *math.HexOrDecimal256 }
type ApiStakerInfo ¶
type ApiStakerInfo struct { Addr common.Address Infors []ApiClientProbability FeeRate uint64 TotalProbability *math.HexOrDecimal256 }
type ClientInfo ¶
type ClientInfo struct { Address common.Address `json:"address"` Amount *math.HexOrDecimal256 `json:"amount"` StakeAmount *math.HexOrDecimal256 `json:"votingPower"` QuitEpoch uint64 `json:"quitEpoch"` }
type DelegatorInfo ¶
type DelegatorInfo struct { Address common.Address `json:"address"` Incentive *math.HexOrDecimal256 `json:"incentive"` Type string `json:"type"` }
type EpRnpActivity ¶
type LeaderJson ¶
type LeaderJson struct { Type uint8 `json:"type"` SecAddr common.Address `json:"secAddr"` PubSec256 string `json:"pubSec256"` PubBn256 string `json:"pubBn256"` }
func ToLeaderJson ¶
func ToLeaderJson(leader []vm.Leader) []LeaderJson
type PartnerInfo ¶
type PartnerInfo struct { Address common.Address `json:"address"` Amount *math.HexOrDecimal256 `json:"amount"` StakeAmount *math.HexOrDecimal256 `json:"votingPower"` Renewal bool `json:"renewal"` LockEpochs uint64 `json:"lockEpochs"` StakingEpoch uint64 `json:"stakingEpoch"` }
type PosApi ¶
type PosApi struct {
// contains filtered or unexported fields
}
func (PosApi) CalProbability ¶
CalProbability use to calc the probability of a staker with amount by stake wan coins. The probability is different in different time, so you should input each epoch ID you want to calc Such as CalProbability(390, 10000, 60, 360) means begin from epoch 360 lock 60 epochs stake 10000 to calc 390's probability.
func (PosApi) GetActivity ¶
GetActivity get epoch leader, random proposer, slot leader 's addresses and activity
func (PosApi) GetBootNodePK ¶
func (PosApi) GetChainQuality ¶
func (PosApi) GetEpRnpActivity ¶
func (a PosApi) GetEpRnpActivity(epochID uint64) (*EpRnpActivity, error)
GetEpRnpActivity get epoch leader, random leader proposer activity
func (PosApi) GetEpochID ¶
func (PosApi) GetEpochIDByTime ¶
GetEpochIDByTime can get Epoch ID by input time second Unix.
func (PosApi) GetEpochIdByBlockNumber ¶
func (PosApi) GetEpochIncentiveBlockNumber ¶
func (PosApi) GetEpochIncentivePayDetail ¶
func (a PosApi) GetEpochIncentivePayDetail(epochID uint64) ([]ValidatorInfo, error)
func (PosApi) GetEpochLeadersAddrByEpochID ¶
func (PosApi) GetEpochLeadersByEpochID ¶
func (PosApi) GetEpochStakeOut ¶
func (a PosApi) GetEpochStakeOut(epochID uint64) ([]RefundInfo, error)
func (PosApi) GetEpochStakerInfo ¶
func (PosApi) GetEpochStakerInfoAll ¶
func (a PosApi) GetEpochStakerInfoAll(epochID uint64) ([]ApiStakerInfo, error)
func (PosApi) GetIncentiveRunTimes ¶
func (PosApi) GetLeaderGroupByEpochID ¶
func (a PosApi) GetLeaderGroupByEpochID(epochID uint64) ([]LeaderJson, error)
func (PosApi) GetLocalPK ¶
func (PosApi) GetMaxStableBlkNumber ¶
func (PosApi) GetPosInfo ¶
func (a PosApi) GetPosInfo() (info PosInfoJson)
func (PosApi) GetRandomProposersAddrByEpochID ¶
func (PosApi) GetRandomProposersByEpochID ¶
func (PosApi) GetRbSignatureCount ¶
func (PosApi) GetRbStage ¶
func (PosApi) GetSlStage ¶
func (PosApi) GetSlotActivity ¶
func (a PosApi) GetSlotActivity(epochID uint64) (*SlotActivity, error)
GetSlotActivity get slot activity of epoch
func (PosApi) GetSlotCount ¶
func (PosApi) GetSlotCreateStatusByEpochID ¶
func (PosApi) GetSlotIDByTime ¶
GetSlotIDByTime can get Slot ID by input time second Unix.
func (PosApi) GetSlotLeaderByEpochIDAndSlotID ¶
func (PosApi) GetSlotScCallTimesByEpochID ¶
func (PosApi) GetSlotTime ¶
func (PosApi) GetSmaByEpochID ¶
func (PosApi) GetStakerInfo ¶
func (a PosApi) GetStakerInfo(targetBlkNum uint64) ([]*StakerJson, error)
this is the static snap of stekers by the block Number.
func (PosApi) GetTimeByEpochID ¶
GetTimeByEpochID can get time second Unix by epoch ID.
func (PosApi) GetTotalIncentive ¶
func (PosApi) GetTotalRemain ¶
func (PosApi) GetValidatorActivity ¶
func (a PosApi) GetValidatorActivity(epochID uint64) (*ValidatorActivity, error)
GetValidatorActivity get epoch leader, random proposer addresses and activity
func (PosApi) GetWhiteListConfig ¶
func (a PosApi) GetWhiteListConfig() ([]vm.UpgradeWhiteEpochLeaderParam, error)
func (PosApi) GetWhiteListbyEpochID ¶
type PosChainReader ¶
type PosChainReader interface { // Config retrieves the blockchain's chain configuration. Config() *params.ChainConfig // CurrentHeader retrieves the current header from the local chain. CurrentHeader() *types.Header // GetHeader retrieves a block header from the database by hash and number. GetHeader(hash common.Hash, number uint64) *types.Header // GetHeaderByNumber retrieves a block header from the database by number. GetHeaderByNumber(number uint64) *types.Header // GetHeaderByHash retrieves a block header from the database by its hash. GetHeaderByHash(hash common.Hash) *types.Header // GetBlock retrieves a block from the database by hash and number. GetBlock(hash common.Hash, number uint64) *types.Block //get chain quality,return quality * 1000 ChainQuality(epochid uint64, slotid uint64) (uint64, error) }
type PosInfoJson ¶
type RefundInfo ¶
type RefundInfo struct { Addr common.Address `json:"address"` Amount *math.HexOrDecimal256 `json:"amount"` }
type SlotActivity ¶
type StakerJson ¶
type StakerJson struct { Address common.Address `json:"address"` PubSec256 string `json:"pubSec256"` //stakeholder’s wan public key PubBn256 string `json:"pubBn256"` //stakeholder’s bn256 public key Amount *math.HexOrDecimal256 `json:"amount"` StakeAmount *math.HexOrDecimal256 `json:"votingPower"` LockEpochs uint64 `json:"lockEpochs"` //lock time which is input by user. 0 means unexpired. NextLockEpochs uint64 `json:"nextLockEpochs"` //lock time which is input by user. 0 means unexpired. From common.Address `json:"from"` StakingEpoch uint64 `json:"stakingEpoch"` //the user’s staking time FeeRate uint64 `json:"feeRate"` //NextFeeRate uint64 Clients []ClientInfo `json:"clients"` Partners []PartnerInfo `json:"partners"` MaxFeeRate uint64 `json:"maxFeeRate"` FeeRateChangedEpoch uint64 `json:"feeRateChangedEpoch"` }
func ToStakerJson ¶
func ToStakerJson(staker *vm.StakerInfo) *StakerJson
type ValidatorActivity ¶
type ValidatorInfo ¶
type ValidatorInfo struct { Address common.Address `json:"address"` WalletAddress common.Address `json:"stakeInFromAddr"` Incentive *math.HexOrDecimal256 `json:"incentive"` Type string `json:"type"` Delegators []DelegatorInfo `json:"delegators"` }