common

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DposContractAddress = "0x00000000000000000000000000000000000000fe"

Variables

This section is empty.

Functions

func DecodeTransaction added in v0.2.3

func DecodeTransaction(tx models.Transaction) (functionSig string, params any, err error)

func FormatFloat

func FormatFloat(f float64) string

func GetFunctionName added in v0.4.0

func GetFunctionName(temp interface{}) string

func GetYieldIntervalEnd

func GetYieldIntervalEnd(pbft_count uint64, block_num *uint64, interval uint64) uint64

func MakeThreadPool

func MakeThreadPool() pool.Pool

isn't creating threads, but limiting goroutines count. Mostly used for RPC and db related tasks

func Max added in v1.8.1

func Max[T Number](a, b T) T

func Min added in v1.8.1

func Min[T Number](a, b T) T

func ParseBool added in v0.3.0

func ParseBool(s string) (v bool)

func ParseFloat added in v1.5.6

func ParseFloat(s string) (v float64)

func ParseInt added in v0.3.0

func ParseInt(s string) (v int64)

func ParseStringToBigInt

func ParseStringToBigInt(v string) *big.Int

func ParseToString added in v0.2.3

func ParseToString(item any) (result any, err error)

func ParseUInt added in v0.3.0

func ParseUInt(s string) (v uint64)

func ProcessTransaction added in v0.2.3

func ProcessTransaction(trx *models.Transaction) (err error)

Types

type AspenHfConfig added in v1.5.4

type AspenHfConfig struct {
	BlockNumPartOne  uint64   `json:"block_num_part_one"`
	BlockNumPartTwo  uint64   `json:"block_num_part_two"`
	MaxSupply        *big.Int `json:"max_supply"`
	GeneratedRewards *big.Int `json:"generated_rewards"`
}

func (*AspenHfConfig) UnmarshalJSON added in v1.5.4

func (hf *AspenHfConfig) UnmarshalJSON(data []byte) error

type CallData added in v0.2.3

type CallData struct {
	Name   string `json:"name"`
	Params any    `json:"params"`
}

type ChainConfig

type ChainConfig struct {
	CommitteeSize               *big.Int
	BlocksPerYear               *big.Int
	YieldPercentage             *big.Int
	DagProposersReward          *big.Int
	MaxBlockAuthorReward        *big.Int
	EligibilityBalanceThreshold *big.Int
	Hardforks                   HardforksConfig
}

func DefaultChainConfig

func DefaultChainConfig() *ChainConfig

type Config

type Config struct {
	Chain                         *ChainConfig
	TotalYieldSavingInterval      uint64
	ValidatorsYieldSavingInterval uint64
	SyncQueueLimit                uint64
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) IsEligible added in v0.3.0

func (c *Config) IsEligible(stake *big.Int) bool

type HardforksConfig added in v0.4.0

type HardforksConfig struct {
	RewardsDistributionFrequency map[uint64]uint32 `json:"rewards_distribution_frequency"`
	MagnoliaHf                   MagnoliaHfConfig  `json:"magnolia_hf"`
	AspenHf                      AspenHfConfig     `json:"aspen_hf"`
}

func (*HardforksConfig) GetDistributionFrequency added in v0.4.0

func (c *HardforksConfig) GetDistributionFrequency(period uint64) uint32

func (*HardforksConfig) IsAspenHfOne added in v1.8.1

func (c *HardforksConfig) IsAspenHfOne(blockNum uint64) bool

func (*HardforksConfig) IsAspenHfTwo added in v1.8.1

func (c *HardforksConfig) IsAspenHfTwo(blockNum uint64) bool

type MagnoliaHfConfig added in v0.4.0

type MagnoliaHfConfig struct {
	BlockNum uint64 `json:"block_num"`
}

func (*MagnoliaHfConfig) UnmarshalJSON added in v0.4.0

func (hf *MagnoliaHfConfig) UnmarshalJSON(data []byte) error

type Number added in v1.8.1

type Number interface {
	constraints.Integer | constraints.Float
}

type Task

type Task[P any] struct {
	// contains filtered or unexported fields
}

func MakeTask

func MakeTask[P any](f func(P) error, params P, err *error) *Task[P]

func (*Task[P]) Run

func (t *Task[P]) Run()

type TaskWithResult

type TaskWithResult[P, R any] struct {
	// contains filtered or unexported fields
}

func MakeTaskWithResult

func MakeTaskWithResult[P, R any](f func(P) (R, error), params P, result *R, err *error) *TaskWithResult[P, R]

func (*TaskWithResult[P, R]) Run

func (t *TaskWithResult[P, R]) Run()

type TaskWithoutParams added in v0.4.0

type TaskWithoutParams struct {
	// contains filtered or unexported fields
}

func MakeTaskWithoutParams added in v0.4.0

func MakeTaskWithoutParams(f func() error, err *error) *TaskWithoutParams

func (*TaskWithoutParams) Run added in v0.4.0

func (t *TaskWithoutParams) Run()

Jump to

Keyboard shortcuts

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