Skip to main content

Solidity API

IGasPriceOracle

Implementation: https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/GasPriceOracle.sol Deployment on Base: https://basescan.org/address/0x420000000000000000000000000000000000000f

getL1FeeUpperBound

function getL1FeeUpperBound(uint256 _unsignedTxSize) external view returns (uint256)

BaseGasCalculator

_CALLDATA_LENGTH_PREMIUM

uint256 _CALLDATA_LENGTH_PREMIUM

_BASE_TRANSACTION_GAS_USED

uint256 _BASE_TRANSACTION_GAS_USED

GAS_PRICE_ORACLE

address GAS_PRICE_ORACLE

calldataLengthOffset

int256 calldataLengthOffset

constructor

constructor(address gasPriceOracle, int256 calldataLenOffset) public

getCalldataCost

function getCalldataCost(uint256 calldataLength) external view returns (uint256 calldataCost)

Calculate the cost of calldata in ETH on a L2 with a different fee structure than mainnet

Parameters

NameTypeDescription
calldataLengthuint256The length of the calldata in bytes

Return Values

NameTypeDescription
calldataCostuint256The cost of the calldata in ETH

initialGasUsed

function initialGasUsed(uint256 calldataLength) external pure returns (uint256 gasUsed)

Gets the cost of initial gas used for a transaction with a different calldata fee than mainnet

Parameters

NameTypeDescription
calldataLengthuint256The length of the calldata in bytes

setCalldataLengthOffset

function setCalldataLengthOffset(int256 calldataLenOffset) external

Sets the calldata length offset

Parameters

NameTypeDescription
calldataLenOffsetint256The new calldata length offset