L1GasPriceOracle is TeQoin's contract-level source of truth for L1 data pricing on L2.
It tracks sequencer-updated L1 fee inputs, exposes a gas-optimized fee path for transaction estimation, and provides the operational controls needed to move from calldata pricing toward blob pricing over time.
This repository is modeled as a focused smart contract implementation repo in the same spirit as contract-specific projects like ERC721A: one core contract, strong documentation, runnable tests, and a clean path for production integration.
The oracle is responsible for:
- storing current L1 calldata and blob fee inputs
- applying TeQoin's scalar and compression parameters
- exposing a hot-path
getL1Fee(bytes)function - providing a front-end friendly fee breakdown view
- giving the owner and sequencer the operational hooks required for live fee updates
contracts/
L1GasPriceOracle.sol
interfaces/IL1GasPriceOracle.sol
docs/
SPECIFICATION.md
scripts/
deploy.js
test/
L1GasPriceOracle.test.js
- Solidity
^0.8.20 - fixed storage layout for future upgrade paths
- sequencer-gated updates for L1 gas data
- owner-gated admin controls
- Yul-optimized fee calculation hot path
- explicit custom errors
- unit tests covering permissions, bounds, and fee math
The effective L1 fee is:
L1_Fee = txDataCost(txData) × l1Price × scalar / 1e6
Where:
txDataCostapplies zero-byte and non-zero-byte calldata pricingcompressionRatiodiscounts post-compression data weightl1Priceselectsl1BaseFeeorl1BlobBaseFeescalaris a dynamic sequencer-controlled multiplier
See docs/SPECIFICATION.md for the full operational model.
npm cinpm run compilenpm testnpm run coverageCopy .env.example to .env and set:
PRIVATE_KEYSEQUENCER_ADDRESSTEQOIN_RPC_URL
Then run:
npm run deploy -- --network teqoinimport "./contracts/interfaces/IL1GasPriceOracle.sol";
contract FeeConsumer {
IL1GasPriceOracle public immutable oracle;
constructor(address oracle_) {
oracle = IL1GasPriceOracle(oracle_);
}
function quote(bytes calldata txData) external view returns (uint256) {
return oracle.getL1Fee(txData);
}
}- Treat this contract as part of TeQoin's fee-critical infrastructure.
- Do not disclose vulnerabilities publicly before coordinated review.
- Follow SECURITY.md for reporting.
Please read CONTRIBUTING.md before opening a pull request.
Distributed under the MIT License. See LICENSE.
This repository is provided for transparency and integration purposes. Teams integrating with the oracle should perform their own review and testing for their specific usage patterns.