fees

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateL1DataFee

func CalculateL1DataFee(tx *types.Transaction, state StateDB) (*big.Int, error)

func CalculateL1GasUsed

func CalculateL1GasUsed(data []byte, overhead *big.Int) *big.Int

CalculateL1GasUsed computes the L1 gas used based on the calldata and constant sized overhead. The overhead can be decreased as the cost of the batch submission goes down via contract optimizations. This will not overflow under standard network conditions.

func EstimateL1DataFeeForMessage

func EstimateL1DataFeeForMessage(msg Message, baseFee, chainID *big.Int, signer types.Signer, state StateDB) (*big.Int, error)

Types

type Message

type Message interface {
	From() common.Address
	To() *common.Address
	GasPrice() *big.Int
	Gas() uint64
	GasFeeCap() *big.Int
	GasTipCap() *big.Int
	Value() *big.Int
	Nonce() uint64
	Data() []byte
	AccessList() types.AccessList
	IsL1MessageTx() bool
}

Message represents the interface of a message. It should be a subset of the methods found on types.Message

type StateDB

type StateDB interface {
	GetState(common.Address, common.Hash) common.Hash
	GetBalance(addr common.Address) *big.Int
}

StateDB represents the StateDB interface required to compute the L1 fee

Jump to

Keyboard shortcuts

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