util

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RewardFullRate = uint64(10000)
	Stop           = "0"
	TxsReward      = 0
	BlkReward      = 1
)
View Source
const (
	PackageName = "奖励util"
)

Variables

View Source
var (
	//ValidatorBlockReward  *big.Int = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), big.NewInt(0)) // Block reward in wei for successfully mining a block
	MultilCoinBlockReward *big.Int = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), big.NewInt(0)) // Block reward in wei for successfully mining a block upward from Byzantium
	//分母10000
	ByzantiumTxsRewardDen *big.Int = big.NewInt(1000000000) // Block reward in wei for successfully mining a block upward from Byzantium
	ValidatorsBlockReward *big.Int = big.NewInt(5e+18)
	MinersBlockReward     *big.Int = big.NewInt(5e+18)

	ManPrice *big.Int = big.NewInt(1e18)

	Precision *big.Int = big.NewInt(1)
)

Functions

func CalcDepositRate

func CalcDepositRate(reward *big.Int, depositNodes map[common.Address]DepositInfo) map[common.Address]*big.Int

func CalcRateReward

func CalcRateReward(rewardAmount *big.Int, rate uint64) *big.Int

func CalcStockRate

func CalcStockRate(reward *big.Int, depositNodes map[common.Address]DepositInfo) map[common.Address]*big.Int

func MergeReward

func MergeReward(dst map[common.Address]*big.Int, src map[common.Address]*big.Int)

func SetAccountRewards

func SetAccountRewards(rewards map[common.Address]*big.Int, account common.Address, reward *big.Int)

Types

type ChainReader

type ChainReader 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

	// GetHeaderByHash retrieves a block header from the database by its hash.
	GetHeaderByHash(hash common.Hash) *types.Header

	GetBlockByNumber(number uint64) *types.Block

	// GetBlock retrieves a block sfrom the database by hash and number.
	GetBlock(hash common.Hash, number uint64) *types.Block
	StateAt(root common.Hash) (*state.StateDB, error)
	State() (*state.StateDB, error)
	StateAtNumber(number uint64) (*state.StateDB, error)
	GetSuperBlockNum() (uint64, error)
	GetGraphByState(state matrixstate.StateDB) (*mc.TopologyGraph, *mc.ElectGraph, error)
}

type DepositInfo

type DepositInfo struct {
	Deposit  *big.Int
	FixStock uint64
}

type StateDB

type StateDB interface {
	GetBalance(common.Address) common.BalanceType
	GetMatrixData(hash common.Hash) (val []byte)
	SetMatrixData(hash common.Hash, val []byte)
}

Jump to

Keyboard shortcuts

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