rollups

package
v0.0.0-...-23e1d9f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	// SystemContextAddress is the address of the "Precompiled contract that calls that holds the current gas per pubdata byte"
	// https://sepolia.explorer.zksync.io/address/0x000000000000000000000000000000000000800b#contract
	SystemContextAddress = "0x000000000000000000000000000000000000800B"

	// ZksyncGasInfo_GetL2GasPerPubDataBytes is the a hex encoded call to:
	// function gasPerPubdataByte() external view returns (uint256 gasPerPubdataByte);
	SystemContext_gasPerPubdataByteMethod = "gasPerPubdataByte"
	ZksyncGasInfo_getGasPerPubdataByteL2  = "0x7cb9357e"

	// ZksyncGasInfo_GetL2GasPrice is the a hex encoded call to:
	// `function gasPrice() external view returns (uint256);`
	SystemContext_gasPriceMethod = "gasPrice"
	ZksyncGasInfo_getGasPriceL2  = "0xfe173b97"
)
View Source
const GasEstimateL1ComponentAbiString = `` /* 478-byte string literal not displayed */

ABI found at https://arbiscan.io/address/0x00000000000000000000000000000000000000C8#code

View Source
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

View Source
const GetL1FeeAbiString = `` /* 196-byte string literal not displayed */
View Source
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

View Source
const OPBaseFeeScalarAbiString = `` /* 145-byte string literal not displayed */
View Source
const OPBlobBaseFeeAbiString = `` /* 145-byte string literal not displayed */
View Source
const OPBlobBaseFeeScalarAbiString = `` /* 149-byte string literal not displayed */
View Source
const OPDecimalsAbiString = `` /* 142-byte string literal not displayed */
View Source
const OPIsEcotoneAbiString = `` /* 137-byte string literal not displayed */

ABIs for OP Stack GasPriceOracle methods needed to calculated encoded gas price

View Source
const OPIsFjordAbiString = `` /* 135-byte string literal not displayed */
View Source
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 IsRollupWithL1Support(chainType chaintype.ChainType) bool

func NewArbitrumL1GasOracle

func NewArbitrumL1GasOracle(lggr logger.Logger, ethClient l1OracleClient) (*arbitrumL1Oracle, error)

func NewCustomCalldataDAOracle

func NewCustomCalldataDAOracle(lggr logger.Logger, ethClient l1OracleClient, chainType chaintype.ChainType, daOracleConfig evmconfig.DAOracle) (*customCalldataDAOracle, error)

NewCustomCalldataDAOracle creates a new custom calldata DA oracle. The CustomCalldataDAOracle fetches gas price from whatever function is specified in the DAOracle's CustomGasPriceCalldata field. This allows for more flexibility when chains have custom DA gas calculation methods.

func NewOpStackL1GasOracle

func NewOpStackL1GasOracle(lggr logger.Logger, ethClient l1OracleClient, chainType chaintype.ChainType, daOracle evmconfig.DAOracle) (*optimismL1Oracle, error)

func NewZkSyncL1GasOracle

func NewZkSyncL1GasOracle(lggr logger.Logger, ethClient l1OracleClient) *zkSyncL1Oracle

Types

type ArbL1GasOracle

type ArbL1GasOracle interface {
	L1Oracle
	GetPricesInArbGas() (perL2Tx uint32, perL1CalldataUnit uint32, err error)
}

type DAClient

type DAClient interface {
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (feeHistory *ethereum.FeeHistory, err error)
}

DAClient is interface of client connections for additional chains layers

type L1Oracle

type L1Oracle interface {
	services.Service

	GasPrice(ctx context.Context) (*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

func NewL1GasOracle

func NewL1GasOracle(lggr logger.Logger, ethClient l1OracleClient, chainType chaintype.ChainType, daOracle evmconfig.DAOracle, clientsByChainID map[string]DAClient) (L1Oracle, error)

type TestDAOracle

type TestDAOracle struct {
	toml.DAOracle
}

func CreateTestDAOracle

func CreateTestDAOracle(t *testing.T, oracleType toml.DAOracleType, oracleAddress string, customGasPriceCalldata string) *TestDAOracle

func (*TestDAOracle) CustomGasPriceCalldata

func (d *TestDAOracle) CustomGasPriceCalldata() *string

func (*TestDAOracle) OracleAddress

func (d *TestDAOracle) OracleAddress() *types.EIP55Address

func (*TestDAOracle) OracleType

func (d *TestDAOracle) OracleType() *toml.DAOracleType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL