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_HALVED​

uint256 _CALLDATA_LENGTH_PREMIUM_HALVED

_BASE_TX_GAS_USED​

uint256 _BASE_TX_GAS_USED

GAS_PRICE_ORACLE​

address GAS_PRICE_ORACLE

calldataLengthOffset​

int256 calldataLengthOffset

constructor​

constructor(address gasPriceOracle, int256 calldataLenOffset) public

getCalldataGas​

function getCalldataGas(uint256 calldataLength) external view returns (uint256 calldataGas)

Calculate the calldata cost in gas units on a L2 with a different fee structure than mainnet

Parameters​

NameTypeDescription
calldataLengthuint256The length of the calldata in bytes

Return Values​

NameTypeDescription
calldataGasuint256The gas 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