fee

package
v1.11.11 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IntrinsicAddPermissionlessValidatorTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			intrinsicValidatorBandwidth +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		fee.DBRead:  1,
		fee.DBWrite: 1,
		fee.Compute: 0,
	}
	IntrinsicAddPermissionlessDelegatorTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			intrinsicValidatorBandwidth +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen,
		fee.DBRead:  1,
		fee.DBWrite: 1,
		fee.Compute: 0,
	}
	IntrinsicAddSubnetValidatorTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			intrinsicSubnetValidatorBandwidth +
			wrappers.IntLen +
			wrappers.IntLen,
		fee.DBRead:  2,
		fee.DBWrite: 1,
		fee.Compute: 0,
	}
	IntrinsicBaseTxComplexities = fee.Dimensions{
		fee.Bandwidth: codec.VersionSize +
			wrappers.IntLen +
			wrappers.IntLen +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		fee.DBRead:  0,
		fee.DBWrite: 0,
		fee.Compute: 0,
	}
	IntrinsicCreateChainTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			ids.IDLen +
			wrappers.ShortLen +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		fee.DBRead:  1,
		fee.DBWrite: 1,
		fee.Compute: 0,
	}
	IntrinsicCreateSubnetTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			wrappers.IntLen,
		fee.DBRead:  0,
		fee.DBWrite: 1,
		fee.Compute: 0,
	}
	IntrinsicExportTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			ids.IDLen +
			wrappers.IntLen,
		fee.DBRead:  0,
		fee.DBWrite: 0,
		fee.Compute: 0,
	}
	IntrinsicImportTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			ids.IDLen +
			wrappers.IntLen,
		fee.DBRead:  0,
		fee.DBWrite: 0,
		fee.Compute: 0,
	}
	IntrinsicRemoveSubnetValidatorTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			ids.NodeIDLen +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen,
		fee.DBRead:  2,
		fee.DBWrite: 1,
		fee.Compute: 0,
	}
	IntrinsicTransferSubnetOwnershipTxComplexities = fee.Dimensions{
		fee.Bandwidth: IntrinsicBaseTxComplexities[fee.Bandwidth] +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		fee.DBRead:  1,
		fee.DBWrite: 1,
		fee.Compute: 0,
	}
)
View Source
var ErrUnsupportedTx = errors.New("unsupported transaction type")

Functions

func AuthComplexity

func AuthComplexity(authIntf verify.Verifiable) (fee.Dimensions, error)

AuthComplexity returns the complexity an authorization adds to a transaction. It does not include the typeID of the authorization. It does includes the complexity that the corresponding credential will add. It does not include the typeID of the credential.

func InputComplexity

func InputComplexity(ins ...*avax.TransferableInput) (fee.Dimensions, error)

InputComplexity returns the complexity inputs add to a transaction. It includes the complexity that the corresponding credentials will add.

func OutputComplexity

func OutputComplexity(outs ...*avax.TransferableOutput) (fee.Dimensions, error)

OutputComplexity returns the complexity outputs add to a transaction.

func OwnerComplexity

func OwnerComplexity(ownerIntf fx.Owner) (fee.Dimensions, error)

OwnerComplexity returns the complexity an owner adds to a transaction. It does not include the typeID of the owner.

func SignerComplexity

func SignerComplexity(s signer.Signer) (fee.Dimensions, error)

SignerComplexity returns the complexity a signer adds to a transaction. It does not include the typeID of the signer.

func TxComplexity

func TxComplexity(tx txs.UnsignedTx) (fee.Dimensions, error)

Types

type Calculator

type Calculator interface {
	CalculateFee(tx txs.UnsignedTx) (uint64, error)
}

Calculator calculates the minimum required fee, in nAVAX, that an unsigned transaction must pay for valid inclusion into a block.

func NewDynamicCalculator

func NewDynamicCalculator(
	weights fee.Dimensions,
	price fee.GasPrice,
) Calculator

func NewStaticCalculator

func NewStaticCalculator(config StaticConfig) Calculator

type StaticConfig

type StaticConfig struct {
	// Fee that is burned by every non-state creating transaction
	TxFee uint64 `json:"txFee"`

	// Fee that must be burned by every subnet creating transaction
	CreateSubnetTxFee uint64 `json:"createSubnetTxFee"`

	// Fee that must be burned by every transform subnet transaction
	TransformSubnetTxFee uint64 `json:"transformSubnetTxFee"`

	// Fee that must be burned by every blockchain creating transaction
	CreateBlockchainTxFee uint64 `json:"createBlockchainTxFee"`

	// Transaction fee for adding a primary network validator
	AddPrimaryNetworkValidatorFee uint64 `json:"addPrimaryNetworkValidatorFee"`

	// Transaction fee for adding a primary network delegator
	AddPrimaryNetworkDelegatorFee uint64 `json:"addPrimaryNetworkDelegatorFee"`

	// Transaction fee for adding a subnet validator
	AddSubnetValidatorFee uint64 `json:"addSubnetValidatorFee"`

	// Transaction fee for adding a subnet delegator
	AddSubnetDelegatorFee uint64 `json:"addSubnetDelegatorFee"`
}

Jump to

Keyboard shortcuts

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