Documentation ¶
Index ¶
- Constants
- func IsRollupWithL1Support(chainType chaintype.ChainType) bool
- func NewArbitrumL1GasOracle(lggr logger.Logger, ethClient l1OracleClient) *arbitrumL1Oracle
- type ArbL1GasOracle
- type L1Oracle
- type OptimismL1Oracle
- func (o *OptimismL1Oracle) Close() error
- func (o *OptimismL1Oracle) GasPrice(_ context.Context) (l1GasPrice *assets.Wei, err error)
- func (o *OptimismL1Oracle) GetDAGasPrice(ctx context.Context) (*big.Int, error)
- func (o *OptimismL1Oracle) GetGasCost(ctx context.Context, tx *gethtypes.Transaction, blockNum *big.Int) (*assets.Wei, error)
- func (o *OptimismL1Oracle) HealthReport() map[string]error
- func (o *OptimismL1Oracle) Name() string
- func (o *OptimismL1Oracle) Start(ctx context.Context) error
Constants ¶
const ( // ArbGasInfoAddress is the address of the "Precompiled contract that exists in every Arbitrum chain." // https://github.com/OffchainLabs/nitro/blob/f7645453cfc77bf3e3644ea1ac031eff629df325/contracts/src/precompiles/ArbGasInfo.sol ArbGasInfoAddress = "0x000000000000000000000000000000000000006C" // ArbGasInfo_getL1BaseFeeEstimate is the a hex encoded call to: // `function getL1BaseFeeEstimate() external view returns (uint256);` ArbGasInfo_getL1BaseFeeEstimate = "getL1BaseFeeEstimate" // NodeInterfaceAddress is the address of the precompiled contract that is only available through RPC // https://github.com/OffchainLabs/nitro/blob/e815395d2e91fb17f4634cad72198f6de79c6e61/nodeInterface/NodeInterface.go#L37 ArbNodeInterfaceAddress = "0x00000000000000000000000000000000000000C8" // ArbGasInfo_getPricesInArbGas is the a hex encoded call to: // `function gasEstimateL1Component(address to, bool contractCreation, bytes calldata data) external payable returns (uint64 gasEstimateForL1, uint256 baseFee, uint256 l1BaseFeeEstimate);` ArbNodeInterface_gasEstimateL1Component = "gasEstimateL1Component" // ArbGasInfo_getPricesInArbGas is the a hex encoded call to: // `function getPricesInArbGas() external view returns (uint256, uint256, uint256);` ArbGasInfo_getPricesInArbGas = "02199f34" )
const ( // OPStackGasOracle_isEcotone fetches if the OP Stack GasPriceOracle contract has upgraded to Ecotone OPStackGasOracle_isEcotone = "isEcotone" // OPStackGasOracle_getL1GasUsed fetches the l1 gas used for given tx bytes OPStackGasOracle_getL1GasUsed = "getL1GasUsed" // OPStackGasOracle_isEcotonePollingPeriod is the interval to poll if chain has upgraded to Ecotone // Set to poll every 4 hours OPStackGasOracle_isEcotonePollingPeriod = 14400 // OPStackGasOracleAddress is the address of the precompiled contract that exists on OP stack chain. // OPStackGasOracle_l1BaseFee fetches the l1 base fee set in the OP Stack GasPriceOracle contract // OPStackGasOracle_l1BaseFee is a hex encoded call to: // `function l1BaseFee() external view returns (uint256);` OPStackGasOracle_l1BaseFee = "l1BaseFee" // OPStackGasOracle_getL1Fee fetches the l1 fee for given tx bytes // OPStackGasOracle_getL1Fee is a hex encoded call to: // `function getL1Fee(bytes) external view returns (uint256);` OPStackGasOracle_getL1Fee = "getL1Fee" // This is the case for Optimism and Base. OPGasOracleAddress = "0x420000000000000000000000000000000000000F" // GasOracleAddress is the address of the precompiled contract that exists on Kroma chain. // This is the case for Kroma. KromaGasOracleAddress = "0x4200000000000000000000000000000000000005" // ScrollGasOracleAddress is the address of the precompiled contract that exists on Scroll chain. ScrollGasOracleAddress = "0x5300000000000000000000000000000000000002" )
const GasEstimateL1ComponentAbiString = `` /* 478-byte string literal not displayed */
ABI found at https://arbiscan.io/address/0x00000000000000000000000000000000000000C8#code
const GetL1BaseFeeEstimateAbiString = `` /* 154-byte string literal not displayed */
ABIs for Arbitrum Gas Info and Node Interface precompile contract methods needed for the L1 oracle
ABI found at https://arbiscan.io/address/0x000000000000000000000000000000000000006C#code
const GetL1FeeAbiString = `` /* 196-byte string literal not displayed */
const L1BaseFeeAbiString = `` /* 143-byte string literal not displayed */
ABIs for Optimism, Scroll, and Kroma precompile contract methods needed for the L1 oracle
All ABIs found at https://optimistic.etherscan.io/address/0xc0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3000f#code
const OPGetL1GasUsedAbiString = `` /* 200-byte string literal not displayed */
const OPIsEcotoneAbiString = `` /* 137-byte string literal not displayed */
ABIs for OP Stack Ecotone GasPriceOracle methods needed to calculated encoded gas price
const ( // Interval at which to poll for L1BaseFee. A good starting point is the L1 block time. PollPeriod = 6 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsRollupWithL1Support ¶
func NewArbitrumL1GasOracle ¶ added in v2.12.0
Types ¶
type ArbL1GasOracle ¶ added in v2.12.0
type L1Oracle ¶
type L1Oracle interface { services.Service GasPrice(ctx context.Context) (*assets.Wei, error) GetGasCost(ctx context.Context, tx *types.Transaction, blockNum *big.Int) (*assets.Wei, error) }
L1Oracle provides interface for fetching L1-specific fee components if the chain is an L2. For example, on Optimistic Rollups, this oracle can return rollup-specific l1BaseFee
type OptimismL1Oracle ¶ added in v2.12.0
type OptimismL1Oracle struct { services.StateMachine // contains filtered or unexported fields }
Reads L2-specific precompiles and caches the l1GasPrice set by the L2.
func NewOpStackL1GasOracle ¶ added in v2.12.0
func NewOpStackL1GasOracle(lggr logger.Logger, ethClient l1OracleClient, chainType chaintype.ChainType) *OptimismL1Oracle
func (*OptimismL1Oracle) Close ¶ added in v2.12.0
func (o *OptimismL1Oracle) Close() error
func (*OptimismL1Oracle) GetDAGasPrice ¶ added in v2.12.0
func (*OptimismL1Oracle) GetGasCost ¶ added in v2.12.0
func (o *OptimismL1Oracle) GetGasCost(ctx context.Context, tx *gethtypes.Transaction, blockNum *big.Int) (*assets.Wei, error)
Gets the L1 gas cost for the provided transaction at the specified block num If block num is not provided, the value on the latest block num is used
func (*OptimismL1Oracle) HealthReport ¶ added in v2.12.0
func (o *OptimismL1Oracle) HealthReport() map[string]error
func (*OptimismL1Oracle) Name ¶ added in v2.12.0
func (o *OptimismL1Oracle) Name() string