fees

package
v1.0.1-action-workflow... Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateFees

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

func CalculateL1Fee

func CalculateL1Fee(data []byte, overhead, l1GasPrice *big.Int, scalar *big.Int) *big.Int

CalculateL1Fee computes the L1 fee

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 CalculateL1MsgFee

func CalculateL1MsgFee(msg Message, state StateDB) (*big.Int, error)

CalculateL1MsgFee computes the L1 portion of the fee given a Message and a StateDB Reference: https://github.com/ethereum-optimism/optimism/blob/develop/l2geth/rollup/fees/rollup_fee.go

func VerifyFee

func VerifyFee(signer types.Signer, tx *types.Transaction, state StateDB) error

Types

type Message

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

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