utils

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BlockGasFee      *big.Int
	StateChangeQueue []StateChangeObject
	// Recording addresses associated with travis tx (stake/governance) in one block
	// Transfer transaction is not allowed if the sender of which was found in this recording
	// TODO to be removed
	TravisTxAddrs   []*common.Address
	NonceCheckedTx  map[common.Hash]bool = make(map[common.Hash]bool)
	PendingProposal                      = &pendingProposal{
		make(map[string]uint64),
		math.MaxUint64,
		nil,
	}
	MintAccount    = common.HexToAddress("0000000000000000000000000000000000000000")
	HoldAccount    = common.HexToAddress("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
	GovHoldAccount = common.HexToAddress("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
)
View Source
var (
	// Keys for store prefixes
	ParamKey = []byte{0x01} // key for global parameters

)

Functions

func CalGasFee

func CalGasFee(gasUsed uint64, gasPrice uint64) *big.Int

func CheckParamType

func CheckParamType(name, value string) bool

func CleanParams

func CleanParams() (before bool)

func GetNow

func GetNow() string

func IsEthTx

func IsEthTx(tx *types.Transaction) bool

func LoadParams

func LoadParams(b []byte)

load/save the global params

func ParseFloat

func ParseFloat(str string) float64

func ParseInt

func ParseInt(str string) *big.Int

func SetParam

func SetParam(name, value string) bool

func ToWei

func ToWei(value int64) (result *big.Int)

func UnloadParams

func UnloadParams() (b []byte)

Types

type Params

type Params struct {
	HoldAccount               common.Address `json:"hold_account"`         // PubKey where all bonded coins are held
	MaxVals                   uint16         `json:"max_vals" type:"uint"` // maximum number of validators
	SelfStakingRatio          string         `json:"self_staking_ratio" type:"float"`
	InflationRate             int64          `json:"inflation_rate" type:"uint"`
	ValidatorSizeThreshold    string         `json:"validator_size_threshold" type:"float"`
	UnstakeWaitingPeriod      uint64         `json:"unstake_waiting_period" type:"uint"`
	ProposalExpirePeriod      uint64         `json:"proposal_expire_period" type:"uint"`
	DeclareCandidacy          uint64         `json:"declare_candidacy" type:"uint"`
	UpdateCandidacy           uint64         `json:"update_candidacy" type:"uint"`
	TransferFundProposal      uint64         `json:"transfer_fund_proposal" type:"uint"`
	ChangeParamsProposal      uint64         `json:"change_params_proposal" type:"uint"`
	GasPrice                  uint64         `json:"gas_price" type:"uint"`
	MinStakingAmount          int64          `json:"min_staking_amount" type:"int"`
	ValidatorsBlockAwardRatio int64          `json:"validators_block_award_ratio" type:"int"`
	MaxSlashingBlocks         int16          `json:"max_slashing_blocks" type:"int"`
	SlashingRatio             string         `json:"slashing_ratio" type:"float"`
	CubePubKeys               string         `json:"cube_pub_keys" type:"json"`
}

func GetParams

func GetParams() *Params

type StateChangeObject

type StateChangeObject struct {
	From   common.Address
	To     common.Address
	Amount *big.Int

	Reactor StateChangeReactor
}

type StateChangeReactor

type StateChangeReactor interface {
	React(result, msg string)
}

Jump to

Keyboard shortcuts

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