xcom

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefualtRule = iota
	StakingRule
	SlashingRule
	RestrictingRule
	RewardRule
	GovernanceRule
)

plugin rule key

View Source
const (
	DefaultMainNet      = iota // PlatON default main net flag
	DefaultAlphaTestNet        // PlatON default Alpha test net flag
	DefaultBetaTestNet         // PlatON default Beta test net flag
	DefaultInnerTestNet        // PlatON default inner test net flag
	DefaultInnerDevNet         // PlatON default inner development net flag
	DefaultDeveloperNet        // PlatON default developer net flag
)

Variables

View Source
var (
	DELTA         = [...]float64{0.08333333333333333, -2.777777777777778E-5, 7.936507936507937E-8, -5.952380952380953E-10, 8.417508417508329E-12, -1.917526917518546E-13, 6.410256405103255E-15, -2.955065141253382E-16, 1.7964371635940225E-17, -1.3922896466162779E-18, 1.338028550140209E-19, -1.542460098679661E-20, 1.9770199298095743E-21, -2.3406566479399704E-22, 1.713480149663986E-23}
	LANCZOS       = [...]float64{0.9999999999999971, 57.15623566586292, -59.59796035547549, 14.136097974741746, -0.4919138160976202, 3.399464998481189E-5, 4.652362892704858E-5, -9.837447530487956E-5, 1.580887032249125E-4, -2.1026444172410488E-4, 2.1743961811521265E-4, -1.643181065367639E-4, 8.441822398385275E-5, -2.6190838401581408E-5, 3.6899182659531625E-6}
	HALF_LOG_2_PI = 0.5 * math.Log(6.283185307179586)
)

Functions

func ActiveUnDelFreezeRatio

func ActiveUnDelFreezeRatio() uint64

func AddLog

func AddLog(state StateDB, blockNumber uint64, contractAddr common.Address, event, data string)

addLog let the result add to event.

func AdditionalCycleTime

func AdditionalCycleTime() uint64

func BlocksWillCreate

func BlocksWillCreate() uint64

func BuildResult

func BuildResult(status bool, data string, errMsg string) []byte

func CancelProposal_SupportRate

func CancelProposal_SupportRate() float64

func CancelProposal_VoteRate

func CancelProposal_VoteRate() float64

func CheckEconomicModel

func CheckEconomicModel() error

func ConsValidatorNum

func ConsValidatorNum() uint64

func DuplicateSignHighSlash

func DuplicateSignHighSlash() uint32

func EconomicString

func EconomicString() string

func ElectionDistance

func ElectionDistance() uint64

func EpochValidatorNum

func EpochValidatorNum() uint64

func ExpectedMinutes

func ExpectedMinutes() uint64

*****

  • Common configure *****

func FailResult

func FailResult(data string, errMsg string) []byte

func HesitateRatio

func HesitateRatio() uint64

func Interval

func Interval() uint64

func MinimumThreshold

func MinimumThreshold() *big.Int

func NewBlockRewardRate

func NewBlockRewardRate() uint64

*****

  • Reward config *****

func PackAmountAbnormal

func PackAmountAbnormal() uint32

*****

  • Slashing config *****

func PackAmountHighAbnormal

func PackAmountHighAbnormal() uint32

func PackAmountHighSlashRate

func PackAmountHighSlashRate() uint32

func PackAmountLowSlashRate

func PackAmountLowSlashRate() uint32

func PlatONFoundationYear

func PlatONFoundationYear() uint32

func PrintObjForErr

func PrintObjForErr(s string, obj interface{})

func PrintObject

func PrintObject(s string, obj interface{})

func SetNodeBlockTimeWindow

func SetNodeBlockTimeWindow(period uint64)

set the value by genesis block

func SetPerRoundBlocks

func SetPerRoundBlocks(amount uint64)

func ShiftValidatorNum

func ShiftValidatorNum() uint64

func StakeThreshold

func StakeThreshold() *big.Int

*****

  • Staking configure *****

func SuccessResult

func SuccessResult(data string, errMsg string) []byte

func TextProposalVote_ConsensusRounds

func TextProposalVote_ConsensusRounds() uint64

func TextProposal_SupportRate

func TextProposal_SupportRate() float64

func TextProposal_VoteRate

func TextProposal_VoteRate() float64

func UnStakeFreezeRatio

func UnStakeFreezeRatio() uint64

func VersionProposalActive_ConsensusRounds

func VersionProposalActive_ConsensusRounds() uint64

func VersionProposalVote_ConsensusRounds

func VersionProposalVote_ConsensusRounds() uint64

*****

  • Governance config *****

func VersionProposal_SupportRate

func VersionProposal_SupportRate() float64

Types

type Beta

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

func (*Beta) RegularizedBeta

func (beta *Beta) RegularizedBeta(x float64, a float64, b float64, epsilon float64, maxIterations int64) (float64, error)

func (*Beta) SimpleRegularizedBeta

func (beta *Beta) SimpleRegularizedBeta(x float64, a float64, b float64) (float64, error)

type BinomialDistribution

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

func NewBinomialDistribution

func NewBinomialDistribution(n int64, p float64) *BinomialDistribution

func (*BinomialDistribution) CumulativeProbability

func (bd *BinomialDistribution) CumulativeProbability(x int64) (float64, error)

func (*BinomialDistribution) InverseCumulativeProbability

func (bd *BinomialDistribution) InverseCumulativeProbability(p float64) (int64, error)

type ContinuedFraction

type ContinuedFraction struct {
}

type EconomicModel

type EconomicModel struct {
	Common   commonConfig
	Staking  stakingConfig
	Slashing slashingConfig
	Gov      governanceConfig
	Reward   rewardConfig
}

total

func GetEc

func GetEc(netId int8) *EconomicModel

Getting the global EconomicModel single instance

type Gamma

type Gamma struct {
}

type Result

type Result struct {
	Status bool
	Data   string
	ErrMsg string
}

inner contract event data

type StateDB

type StateDB interface {
	CreateAccount(common.Address)

	SubBalance(common.Address, *big.Int)
	AddBalance(common.Address, *big.Int)
	GetBalance(common.Address) *big.Int

	GetNonce(common.Address) uint64
	SetNonce(common.Address, uint64)

	GetCodeHash(common.Address) common.Hash
	GetCode(common.Address) []byte
	SetCode(common.Address, []byte)
	GetCodeSize(common.Address) int

	// todo: new func for abi of contract.
	GetAbiHash(common.Address) common.Hash
	GetAbi(common.Address) []byte
	SetAbi(common.Address, []byte)

	AddRefund(uint64)
	SubRefund(uint64)
	GetRefund() uint64

	// todo: hash -> bytes
	GetCommittedState(common.Address, []byte) []byte
	//GetState(common.Address, common.Hash) common.Hash
	//SetState(common.Address, common.Hash, common.Hash)
	GetState(common.Address, []byte) []byte
	SetState(common.Address, []byte, []byte)

	Suicide(common.Address) bool
	HasSuicided(common.Address) bool

	// Exist reports whether the given account exists in state.
	// Notably this should also return true for suicided accounts.
	Exist(common.Address) bool
	// Empty returns whether the given account is empty. Empty
	// is defined according to EIP161 (balance = nonce = code = 0).
	Empty(common.Address) bool

	RevertToSnapshot(int)
	Snapshot() int

	AddLog(*types.Log)
	AddPreimage(common.Hash, []byte)

	ForEachStorage(common.Address, func(common.Hash, common.Hash) bool)

	//ppos add
	TxHash() common.Hash
	TxIdx() uint32

	IntermediateRoot(deleteEmptyObjects bool) common.Hash
}

StateDB is an Plugin database for full state querying.

Jump to

Keyboard shortcuts

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