Documentation ¶
Index ¶
- Constants
- Variables
- func EVMBlockGasLimit(gasRatio *util.Ratio32) uint64
- func EVMCallGasLimit(gasRatio *util.Ratio32) uint64
- func EVMGasToISC(evmGas uint64, gasRatio *util.Ratio32) uint64
- func FeeFromGas(gasUnits uint64, gasPerToken util.Ratio32) uint64
- func ISCGasBudgetToEVM(iscGasBudget uint64, gasRatio *util.Ratio32) uint64
- func ISCGasBurnedToEVM(iscGasBurned uint64, gasRatio *util.Ratio32) uint64
- func ReadRatio32(mu *marshalutil.MarshalUtil) (ret util.Ratio32, err error)
- type BurnCode
- type BurnCodeRecord
- type BurnFunction
- type BurnLog
- type BurnRecord
- type BurnTable
- type GasFeePolicy
- func (p *GasFeePolicy) Bytes() []byte
- func (p *GasFeePolicy) FeeFromGas(gasUnits uint64) uint64
- func (p *GasFeePolicy) FeeFromGasBurned(gasUnits, availableTokens uint64) (sendToOwner, sendToValidator uint64)
- func (p *GasFeePolicy) GasBudgetFromTokens(availableTokens uint64) uint64
- func (p *GasFeePolicy) IsEnoughForMinimumFee(availableTokens uint64) bool
- func (p *GasFeePolicy) MinFee() uint64
- func (p *GasFeePolicy) String() string
Constants ¶
View Source
const ( MaxGasPerBlock = uint64(1_000_000_000) MinGasPerRequest = uint64(10000) MaxGasPerRequest = MaxGasPerBlock / 20 // one request cannot use more than 5% of maximum block gas MaxGasExternalViewCall = MaxGasPerRequest )
View Source
const ( BurnCodeStorage1P = BurnCode(iota) BurnCodeReadFromState1P BurnCodeCallTargetNotFound BurnCodeGetContext BurnCodeGetCallerData BurnCodeGetAllowance BurnCodeGetStateAnchorInfo BurnCodeGetBalance BurnCodeGetNFTData BurnCodeCallContract BurnCodeDeployContract BurnCodeEmitEventFixed BurnCodeTransferAllowance BurnCodeEstimateStorageDepositCost BurnCodeSendL1Request BurnCodeUtilsHashingBlake2b BurnCodeUtilsHashingSha3 BurnCodeUtilsHashingHname BurnCodeUtilsHexEncode BurnCodeUtilsHexDecode BurnCodeUtilsED25519ValidSig BurnCodeUtilsED25519AddrFromPubKey BurnCodeUtilsBLSValidSignature BurnCodeUtilsBLSAddrFromPubKey BurnCodeUtilsBLSAggregateBLS1P BurnCodeWasm1P BurnCodeMinimumGasPerRequest1P BurnCodeEVM1P )
View Source
const ( Coef1Send = 200 CoefBLSAggregate = 400 )
Variables ¶
View Source
var DefaultEVMGasRatio = util.Ratio32{A: 1, B: 1}
<ISC gas> = <EVM Gas> * <A> / <B>
View Source
var ( // By default each token pays for 100 units of gas DefaultGasPerToken = util.Ratio32{A: 100, B: 1} )
View Source
var ErrInvalidRatio = errors.New("ratio must have both components != 0")
View Source
var ErrUnknownBurnCode = errors.New("unknown gas burn code")
Functions ¶
func EVMBlockGasLimit ¶ added in v1.0.3
EVMBlockGasLimit returns the ISC block gas limit converted to EVM gas units
func EVMCallGasLimit ¶ added in v1.0.3
EVMCallGasLimit returns the maximum gas limit accepted for an EVM tx
func ISCGasBudgetToEVM ¶ added in v1.0.3
func ISCGasBurnedToEVM ¶ added in v1.0.3
func ReadRatio32 ¶
func ReadRatio32(mu *marshalutil.MarshalUtil) (ret util.Ratio32, err error)
Types ¶
type BurnCodeRecord ¶
type BurnCodeRecord struct { Name string BurnFunction }
type BurnFunction ¶
type BurnLog ¶
type BurnLog struct {
Records []BurnRecord `json:"records" swagger:"required"`
}
func NewGasBurnLog ¶
func NewGasBurnLog() *BurnLog
type BurnRecord ¶
type BurnTable ¶
type BurnTable map[BurnCode]BurnCodeRecord
type GasFeePolicy ¶
type GasFeePolicy struct { // GasFeeTokenID contains iotago.NativeTokenID used to pay for gas, or nil if base token are used for gas fee GasFeeTokenID iotago.NativeTokenID // GasFeeTokenDecimals the number of decimals in the native token used to pay for gas fees. Only considered if GasFeeTokenID != nil GasFeeTokenDecimals uint32 // GasPerToken specifies how many gas units are paid for each token. GasPerToken util.Ratio32 // EVMGasRatio expresses the ratio at which EVM gas is converted to ISC gas EVMGasRatio util.Ratio32 // X = ISC gas, Y = EVM gas => ISC gas = EVM gas * A/B // 0 mean all goes to Governor // >=100 all goes to Validator ValidatorFeeShare uint8 }
func DefaultGasFeePolicy ¶
func DefaultGasFeePolicy() *GasFeePolicy
func FeePolicyFromBytes ¶
func FeePolicyFromBytes(data []byte) (*GasFeePolicy, error)
func MustGasFeePolicyFromBytes ¶
func MustGasFeePolicyFromBytes(data []byte) *GasFeePolicy
func (*GasFeePolicy) Bytes ¶
func (p *GasFeePolicy) Bytes() []byte
func (*GasFeePolicy) FeeFromGas ¶
func (p *GasFeePolicy) FeeFromGas(gasUnits uint64) uint64
func (*GasFeePolicy) FeeFromGasBurned ¶
func (p *GasFeePolicy) FeeFromGasBurned(gasUnits, availableTokens uint64) (sendToOwner, sendToValidator uint64)
FeeFromGasBurned calculates the how many tokens to take and where to deposit them.
func (*GasFeePolicy) GasBudgetFromTokens ¶
func (p *GasFeePolicy) GasBudgetFromTokens(availableTokens uint64) uint64
func (*GasFeePolicy) IsEnoughForMinimumFee ¶
func (p *GasFeePolicy) IsEnoughForMinimumFee(availableTokens uint64) bool
func (*GasFeePolicy) MinFee ¶
func (p *GasFeePolicy) MinFee() uint64
func (*GasFeePolicy) String ¶
func (p *GasFeePolicy) String() string
Click to show internal directories.
Click to hide internal directories.