Skip to main content

IL2GasCalculator

The IL2GasCalculator interface provides functions to calculate gas costs specific to Layer 2 (L2) solutions with different fee structures compared to the Ethereum mainnet.

Functions

getCalldataCost

function getCalldataCost(uint256 length) external view returns (uint256 calldataCostETH);

Calculates the cost of calldata in Ether on an L2 with a different fee structure than mainnet.

Parameters

NameTypeDescription
lengthuint256The length of the calldata.

Return Value

TypeDescription
uint256The cost of the calldata in Ether.

initialGasUsed

function initialGasUsed(uint256 calldataLength) external view returns (uint256 gasUsed);

Calculates the initial gas used for a transaction with a different calldata fee structure than mainnet.

Parameters

NameTypeDescription
calldataLengthuint256The length of the calldata.

Return Value

TypeDescription
uint256The initial gas used for the transaction.