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
Name | Type | Description |
---|---|---|
calldataLength | uint256 | The length of the calldata in bytes |
Return Values
Name | Type | Description |
---|---|---|
calldataCost | uint256 | The 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
Name | Type | Description |
---|---|---|
calldataLength | uint256 | The length of the calldata in bytes |
setCalldataLengthOffset
function setCalldataLengthOffset(int256 calldataLenOffset) external
Sets the calldata length offset
Parameters
Name | Type | Description |
---|---|---|
calldataLenOffset | int256 | The new calldata length offset |