Documentation
¶
Index ¶
- Constants
- Variables
- func DoAuthHandle(from common.Address, txDataBytes []byte, height int64) (err error)
- func DoBetHandle(from common.Address, to *common.Address, balance *big.Int, txDataBytes []byte, ...) (isBetTx bool, err error)
- func IsAuthBlocked(from common.Address, txDataBytes []byte, height int64) (err error)
- func IsAuthTx(to common.Address) bool
- func IsBetBlocked(from common.Address, to *common.Address, balance *big.Int, txDataBytes []byte, ...) (err error)
- func IsBetTx(to common.Address) bool
- func IsLockTx(to common.Address) bool
- func IsMintBlocked(from common.Address) (err error)
- func IsMintTx(to common.Address) bool
- func IsRelayTx(to common.Address) bool
- func IsUnlockTx(to common.Address) bool
- type AuthData
- type AuthItem
- type AuthTable
- type PosItem
- type PosItemSortedQueue
- type PosItemWithSigner
- type PosTable
- func (posTable *PosTable) CanRemovePosItem() error
- func (posTable *PosTable) Copy() *PosTable
- func (posTable *PosTable) ExportSortedSigners()
- func (posTable *PosTable) InitStruct()
- func (posTable *PosTable) InsertPosItem(signer common.Address, pi *PosItem) error
- func (posTable *PosTable) RemovePosItem(signer common.Address, height int64, slash bool) error
- func (posTable *PosTable) SelectItemByHeightValue(random int64) (common.Address, PosItem)
- func (posTable *PosTable) SelectItemBySeedValue(vrf []byte, len int) (common.Address, PosItem)
- func (posTable *PosTable) SetThreshold(threshold *big.Int)
- func (posTable *PosTable) String() string
- func (posTable *PosTable) TopKSigners(k int) []common.Address
- func (posTable *PosTable) TryRemoveUnbondPosItems(currentHeight int64, sortedUnbondSigners []common.Address) int
- func (posTable *PosTable) UpdatePosItem(signer common.Address, newSlots int64) error
- type TxData
- type UnbondPosItemSortedQueue
- func (pq *UnbondPosItemSortedQueue) Copy() *UnbondPosItemSortedQueue
- func (pq *UnbondPosItemSortedQueue) Len() int
- func (pq *UnbondPosItemSortedQueue) Less(i, j int) bool
- func (pq *UnbondPosItemSortedQueue) Pop() interface{}
- func (pq *UnbondPosItemSortedQueue) Push(x interface{})
- func (pq *UnbondPosItemSortedQueue) Swap(i, j int)
Constants ¶
View Source
const EpochBlocks = int64(200)
View Source
const ThresholdUnit = 1000
it means the lowest bond balance must equal or larger than the 1/1000 of totalBalance
View Source
const UnbondWaitEpochs = 3
Variables ¶
View Source
var ( SendToLock = common.HexToAddress("0x7777777777777777777777777777777777777777") SendToUnlock = common.HexToAddress("0x8888888888888888888888888888888888888888") ErrPosTableNotCreate = errors.New("PosTable has not created yet") ErrPosTableNotInit = errors.New("PosTable has not init yet") UpgradeHeight int64 )
View Source
var ( SendToMint = common.HexToAddress("0x1111111111111111111111111111111111111111") SendToAuth = common.HexToAddress("0x2222222222222222222222222222222222222222") SendToRelay = common.HexToAddress("0x3333333333333333333333333333333333333333") ErrAuthTableNotCreate = errors.New("AuthTable has not created yet") )
View Source
var ( PPChainAdmin common.Address Bigguy common.Address )
Functions ¶
func DoAuthHandle ¶ added in v1.4.5
func DoBetHandle ¶ added in v1.4.5
func IsAuthBlocked ¶ added in v1.4.5
func IsBetBlocked ¶ added in v1.4.5
func IsMintBlocked ¶ added in v1.4.5
func IsUnlockTx ¶
Types ¶
type AuthData ¶ added in v1.4.5
type AuthData struct { PermittedAddress common.Address `json:"permitted_address"` StartBlockHeight int64 `json:"start_block_height"` EndBlockHeight int64 `json:"end_block_height"` OperationType string `json:"operation_type"` ApprovedTxDataHash []byte `json:"approved_tx_data_hash"` }
func UnMarshalAuthTxData ¶ added in v1.4.5
type AuthTable ¶ added in v1.4.5
TODO: merge this map into PosTable
var (
EthAuthTable *AuthTable
)
func CreateAuthTable ¶ added in v1.4.5
func CreateAuthTable() *AuthTable
func NewAuthTable ¶ added in v1.4.5
func NewAuthTable() *AuthTable
func (*AuthTable) DeleteAuthItem ¶ added in v1.4.5
type PosItem ¶
type PosItem struct { Height int64 `json:"height"` Slots int64 `json:"slots"` PubKey abciTypes.PubKey `json:"pubKey"` TmAddress string `json:"tm_address"` BlsKeyString string `json:"bls_key_string"` Beneficiary common.Address `json:"beneficiary"` BeneficiaryBonus *big.Int `json:"beneficiary_bonus"` //currently not used }
func NewPosItem ¶
type PosItemSortedQueue ¶
type PosItemSortedQueue []*PosItemWithSigner
func NewPosItemSortedQueue ¶
func NewPosItemSortedQueue() *PosItemSortedQueue
func (*PosItemSortedQueue) Copy ¶
func (pq *PosItemSortedQueue) Copy() *PosItemSortedQueue
func (*PosItemSortedQueue) Len ¶
func (pq *PosItemSortedQueue) Len() int
func (*PosItemSortedQueue) Less ¶
func (pq *PosItemSortedQueue) Less(i, j int) bool
func (*PosItemSortedQueue) Pop ¶
func (pq *PosItemSortedQueue) Pop() interface{}
func (*PosItemSortedQueue) Push ¶
func (pq *PosItemSortedQueue) Push(x interface{})
func (*PosItemSortedQueue) Swap ¶
func (pq *PosItemSortedQueue) Swap(i, j int)
type PosItemWithSigner ¶
type PosItemWithSigner struct { Height int64 Signer common.Address Slots int64 // contains filtered or unexported fields }
=============================================================================
func (*PosItemWithSigner) Copy ¶
func (pi *PosItemWithSigner) Copy() *PosItemWithSigner
type PosTable ¶
type PosTable struct { Mtx sync.RWMutex `json:"-"` InitFlag bool `json:"-"` PosItemMap map[common.Address]*PosItem `json:"pos_item_map"` SortedPosItems *PosItemSortedQueue `json:"-"` PosItemIndexMap map[common.Address]*PosItemWithSigner `json:"-"` TotalSlots int64 `json:"-"` SortedSigners []common.Address `json:"-"` UnbondPosItemMap map[common.Address]*PosItem `json:"unbond_pos_item_map"` SortedUnbondPosItems *UnbondPosItemSortedQueue `json:"-"` UnbondPosItemIndexMap map[common.Address]*PosItemWithSigner `json:"-"` SortedUnbondSigners []common.Address `json:"-"` TmAddressToSignerMap map[string]common.Address `json:"-"` BlsKeyStringToSignerMap map[string]common.Address `json:"-"` Threshold *big.Int `json:"threshold"` // threshold value of PosTable ChangedFlagThisBlock bool `json:"-"` }
var (
EthPosTable *PosTable
)
func CreatePosTable ¶
func CreatePosTable() *PosTable
func NewPosTable ¶
func NewPosTable() *PosTable
func (*PosTable) CanRemovePosItem ¶
func (*PosTable) ExportSortedSigners ¶
func (posTable *PosTable) ExportSortedSigners()
func (*PosTable) InitStruct ¶
func (posTable *PosTable) InitStruct()
func (*PosTable) InsertPosItem ¶ added in v1.4.5
func (*PosTable) RemovePosItem ¶
func (*PosTable) SelectItemByHeightValue ¶
func (*PosTable) SelectItemBySeedValue ¶
func (*PosTable) SetThreshold ¶
func (*PosTable) TryRemoveUnbondPosItems ¶
type TxData ¶
type TxData struct { PubKey abciTypes.PubKey `json:"pub_key"` Beneficiary string `json:"beneficiary"` BlsKeyString string `json:"bls_key_string"` }
func UnMarshalTxData ¶
type UnbondPosItemSortedQueue ¶
type UnbondPosItemSortedQueue []*PosItemWithSigner
func NewUnbondPosItemSortedQueue ¶
func NewUnbondPosItemSortedQueue() *UnbondPosItemSortedQueue
func (*UnbondPosItemSortedQueue) Copy ¶
func (pq *UnbondPosItemSortedQueue) Copy() *UnbondPosItemSortedQueue
func (*UnbondPosItemSortedQueue) Len ¶
func (pq *UnbondPosItemSortedQueue) Len() int
func (*UnbondPosItemSortedQueue) Less ¶
func (pq *UnbondPosItemSortedQueue) Less(i, j int) bool
func (*UnbondPosItemSortedQueue) Pop ¶
func (pq *UnbondPosItemSortedQueue) Pop() interface{}
func (*UnbondPosItemSortedQueue) Push ¶
func (pq *UnbondPosItemSortedQueue) Push(x interface{})
func (*UnbondPosItemSortedQueue) Swap ¶
func (pq *UnbondPosItemSortedQueue) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.