sfctype

package
v1.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DelegationIDSize is size of DelegationID serialized object
	DelegationIDSize = 20 + 4
)

Variables

View Source
var (
	// ForkBit is set if staker has a confirmed pair of fork events
	ForkBit = uint64(1)
	// OfflineBit is set if staker has didn't have confirmed events for a long time
	OfflineBit = uint64(1 << 8)
	// CheaterMask is a combination of severe misbehavings
	CheaterMask = ForkBit
)

Functions

This section is empty.

Types

type DelegationID

type DelegationID struct {
	Delegator common.Address
	StakerID  idx.StakerID
}

DelegationID is a pair of delegator address and staker ID to which delegation is applied

func BytesToDelegationID

func BytesToDelegationID(bb []byte) DelegationID

func (*DelegationID) Bytes

func (id *DelegationID) Bytes() []byte

type EpochStats

type EpochStats struct {
	Start    inter.Timestamp
	End      inter.Timestamp
	TotalFee *big.Int

	Epoch                 idx.Epoch `rlp:"-"` // API-only field
	TotalBaseRewardWeight *big.Int  `rlp:"-"` // API-only field
	TotalTxRewardWeight   *big.Int  `rlp:"-"` // API-only field
}

EpochStats stores general statistics for an epoch

func (*EpochStats) Duration

func (s *EpochStats) Duration() inter.Timestamp

Duration returns epoch duration

type SfcDelegation

type SfcDelegation struct {
	CreatedEpoch idx.Epoch
	CreatedTime  inter.Timestamp

	DeactivatedEpoch idx.Epoch
	DeactivatedTime  inter.Timestamp

	Amount *big.Int
}

SfcDelegation is the node-side representation of SFC delegation

type SfcDelegationAndID

type SfcDelegationAndID struct {
	Delegation *SfcDelegation
	ID         DelegationID
}

SfcDelegationAndID is pair SfcDelegation + address

type SfcStaker

type SfcStaker struct {
	CreatedEpoch idx.Epoch
	CreatedTime  inter.Timestamp

	DeactivatedEpoch idx.Epoch
	DeactivatedTime  inter.Timestamp

	StakeAmount *big.Int
	DelegatedMe *big.Int

	Address common.Address

	Status uint64

	IsValidator bool `rlp:"-"` // API-only field
}

SfcStaker is the node-side representation of SFC staker

func (*SfcStaker) CalcTotalStake

func (s *SfcStaker) CalcTotalStake() *big.Int

CalcTotalStake returns sum of staker's stake and delegated to staker stake

func (*SfcStaker) HasFork

func (s *SfcStaker) HasFork() bool

HasFork returns true if staker has a confirmed fork

func (*SfcStaker) IsCheater

func (s *SfcStaker) IsCheater() bool

IsCheater returns true if staker is cheater

func (*SfcStaker) Offline

func (s *SfcStaker) Offline() bool

Offline returns true if staker was offline for long time

func (*SfcStaker) Ok

func (s *SfcStaker) Ok() bool

Ok returns true if not deactivated and not pruned

type SfcStakerAndID

type SfcStakerAndID struct {
	StakerID idx.StakerID
	Staker   *SfcStaker
}

SfcStakerAndID is pair SfcStaker + StakerID

Jump to

Keyboard shortcuts

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