economics

package
v1.1.66 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBuiltInFunctionsCost

func NewBuiltInFunctionsCost(args *ArgsBuiltInFunctionCost) (*builtInFunctionsCost, error)

NewBuiltInFunctionsCost will create a new instance of builtInFunctionsCost

func NewEconomicsData

func NewEconomicsData(args ArgsNewEconomicsData) (*economicsData, error)

NewEconomicsData will create and object with information about economics parameters

Types

type ArgsBuiltInFunctionCost

type ArgsBuiltInFunctionCost struct {
	GasSchedule core.GasScheduleNotifier
	ArgsParser  process.ArgumentsParser
}

ArgsBuiltInFunctionCost holds all components that are needed to create a new instance of builtInFunctionsCost

type ArgsNewEconomicsData

type ArgsNewEconomicsData struct {
	BuiltInFunctionsCostHandler    BuiltInFunctionsCostHandler
	Economics                      *config.EconomicsConfig
	EpochNotifier                  process.EpochNotifier
	PenalizedTooMuchGasEnableEpoch uint32
	GasPriceModifierEnableEpoch    uint32
}

ArgsNewEconomicsData defines the arguments needed for new economics economicsData

type BuiltInFunctionsCostHandler

type BuiltInFunctionsCostHandler interface {
	ComputeBuiltInCost(tx process.TransactionWithFeeHandler) uint64
	IsBuiltInFuncCall(tx process.TransactionWithFeeHandler) bool
	IsInterfaceNil() bool
}

BuiltInFunctionsCostHandler is able to calculated the cost of a built in function call

type TestEconomicsData

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

TestEconomicsData extends EconomicsData and is used in integration tests as it exposes some functions that are not supposed to be used in production code Exported functions simplify the reproduction of edge cases

func NewTestEconomicsData

func NewTestEconomicsData(internalData *economicsData) *TestEconomicsData

NewTestEconomicsData -

func (TestEconomicsData) CheckValidityTxValues

func (ed TestEconomicsData) CheckValidityTxValues(tx process.TransactionWithFeeHandler) error

CheckValidityTxValues checks if the provided transaction is economically correct

func (TestEconomicsData) ComputeFeeForProcessing

func (ed TestEconomicsData) ComputeFeeForProcessing(tx process.TransactionWithFeeHandler, gasToUse uint64) *big.Int

ComputeFeeForProcessing will compute the fee using the gas price modifier, the gas to use and the actual gas price

func (TestEconomicsData) ComputeGasLimit

func (ed TestEconomicsData) ComputeGasLimit(tx process.TransactionWithFeeHandler) uint64

ComputeGasLimit returns the gas limit need by the provided transaction in order to be executed

func (TestEconomicsData) ComputeGasUsedAndFeeBasedOnRefundValue

func (ed TestEconomicsData) ComputeGasUsedAndFeeBasedOnRefundValue(tx process.TransactionWithFeeHandler, refundValue *big.Int) (uint64, *big.Int)

ComputeGasUsedAndFeeBasedOnRefundValue will compute gas used value and transaction fee using refund value from a SCR

func (TestEconomicsData) ComputeMoveBalanceFee

func (ed TestEconomicsData) ComputeMoveBalanceFee(tx process.TransactionWithFeeHandler) *big.Int

ComputeMoveBalanceFee computes the provided transaction's fee

func (TestEconomicsData) ComputeTxFee

func (ed TestEconomicsData) ComputeTxFee(tx process.TransactionWithFeeHandler) *big.Int

ComputeTxFee computes the provided transaction's fee using enable from epoch approach

func (TestEconomicsData) ComputeTxFeeBasedOnGasUsed

func (ed TestEconomicsData) ComputeTxFeeBasedOnGasUsed(tx process.TransactionWithFeeHandler, gasUsed uint64) *big.Int

ComputeTxFeeBasedOnGasUsed will compute transaction fee

func (TestEconomicsData) DeveloperPercentage

func (ed TestEconomicsData) DeveloperPercentage() float64

DeveloperPercentage will return the developer percentage value

func (TestEconomicsData) EpochConfirmed

func (ed TestEconomicsData) EpochConfirmed(epoch uint32)

EpochConfirmed is called whenever a new epoch is confirmed

func (TestEconomicsData) GasPerDataByte

func (ed TestEconomicsData) GasPerDataByte() uint64

GasPerDataByte will return the gas required for a economicsData byte

func (TestEconomicsData) GasPriceForMove

func (ed TestEconomicsData) GasPriceForMove(tx process.TransactionWithFeeHandler) uint64

GasPriceForMove returns the gas price for transferring funds

func (TestEconomicsData) GasPriceForProcessing

func (ed TestEconomicsData) GasPriceForProcessing(tx process.TransactionWithFeeHandler) uint64

GasPriceForProcessing computes the price for the gas in addition to balance movement and data

func (TestEconomicsData) GasPriceModifier

func (ed TestEconomicsData) GasPriceModifier() float64

GasPriceModifier will return the gas price modifier

func (TestEconomicsData) GenesisTotalSupply

func (ed TestEconomicsData) GenesisTotalSupply() *big.Int

GenesisTotalSupply will return the genesis total supply

func (*TestEconomicsData) GetMinGasLimit

func (ted *TestEconomicsData) GetMinGasLimit() uint64

GetMinGasLimit returns the minimum gas limit for a transaction to be accepted

func (*TestEconomicsData) GetMinGasPrice

func (ted *TestEconomicsData) GetMinGasPrice() uint64

GetMinGasPrice returns the current min gas price

func (TestEconomicsData) IsInterfaceNil

func (ed TestEconomicsData) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (TestEconomicsData) LeaderPercentage

func (ed TestEconomicsData) LeaderPercentage() float64

LeaderPercentage will return leader reward percentage

func (TestEconomicsData) MaxGasLimitPerBlock

func (ed TestEconomicsData) MaxGasLimitPerBlock(shardID uint32) uint64

MaxGasLimitPerBlock will return maximum gas limit allowed per block

func (TestEconomicsData) MaxInflationRate

func (ed TestEconomicsData) MaxInflationRate(year uint32) float64

MaxInflationRate will return the maximum inflation rate

func (TestEconomicsData) MinGasLimit

func (ed TestEconomicsData) MinGasLimit() uint64

MinGasLimit will return min gas limit

func (TestEconomicsData) MinGasPrice

func (ed TestEconomicsData) MinGasPrice() uint64

MinGasPrice will return min gas price

func (TestEconomicsData) MinGasPriceForProcessing

func (ed TestEconomicsData) MinGasPriceForProcessing() uint64

MinGasPriceForProcessing returns the minimum allowed gas price for processing

func (TestEconomicsData) MinInflationRate

func (ed TestEconomicsData) MinInflationRate() float64

MinInflationRate will return the minimum inflation rate

func (TestEconomicsData) ProtocolSustainabilityAddress

func (ed TestEconomicsData) ProtocolSustainabilityAddress() string

ProtocolSustainabilityAddress will return the protocol sustainability address

func (TestEconomicsData) ProtocolSustainabilityPercentage

func (ed TestEconomicsData) ProtocolSustainabilityPercentage() float64

ProtocolSustainabilityPercentage will return the protocol sustainability percentage value

func (TestEconomicsData) RewardsTopUpFactor

func (ed TestEconomicsData) RewardsTopUpFactor() float64

RewardsTopUpFactor returns the rewards top-up factor

func (TestEconomicsData) RewardsTopUpGradientPoint

func (ed TestEconomicsData) RewardsTopUpGradientPoint() *big.Int

RewardsTopUpGradientPoint returns the rewards top-up gradient point

func (*TestEconomicsData) SetGasPerDataByte

func (ted *TestEconomicsData) SetGasPerDataByte(gasPerDataByte uint64)

SetGasPerDataByte sets gas per data byte for a transaction to be accepted

func (*TestEconomicsData) SetMaxGasLimitPerBlock

func (ted *TestEconomicsData) SetMaxGasLimitPerBlock(maxGasLimitPerBlock uint64)

SetMaxGasLimitPerBlock sets the maximum gas limit allowed per one block

func (*TestEconomicsData) SetMaxInflationRate

func (ted *TestEconomicsData) SetMaxInflationRate(maximumInflation float64)

SetMaxInflationRate sets the maximum inflation rate for a transaction to be accepted

func (*TestEconomicsData) SetMinGasLimit

func (ted *TestEconomicsData) SetMinGasLimit(minGasLimit uint64)

SetMinGasLimit sets the minimum gas limit for a transaction to be accepted

func (*TestEconomicsData) SetMinGasPrice

func (ted *TestEconomicsData) SetMinGasPrice(minGasPrice uint64)

SetMinGasPrice sets the minimum gas price for a transaction to be accepted

func (TestEconomicsData) SetStatusHandler

func (ed TestEconomicsData) SetStatusHandler(statusHandler core.AppStatusHandler) error

SetStatusHandler will set the provided status handler if not nil

func (*TestEconomicsData) SetTotalSupply

func (ted *TestEconomicsData) SetTotalSupply(totalSupply *big.Int)

SetTotalSupply sets the total supply when booting the network

func (TestEconomicsData) SplitTxGasInCategories

func (ed TestEconomicsData) SplitTxGasInCategories(tx process.TransactionWithFeeHandler) (gasLimitMove, gasLimitProcess uint64)

SplitTxGasInCategories returns the gas split per categories

Jump to

Keyboard shortcuts

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