common

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 15 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 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 ParseBool added in v0.3.0

func ParseBool(s string) (v bool)

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 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
}

func DefaultChainConfig

func DefaultChainConfig() *ChainConfig

type Config

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

func DefaultConfig

func DefaultConfig() *Config

func (*Config) IsEligible added in v0.3.0

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

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()

Jump to

Keyboard shortcuts

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