Skip to content

Chore/add mantle testnet gas fee#8386

Draft
jeremy-consensys wants to merge 3 commits intomainfrom
chore/add-mantle-testnet-gas-fee
Draft

Chore/add mantle testnet gas fee#8386
jeremy-consensys wants to merge 3 commits intomainfrom
chore/add-mantle-testnet-gas-fee

Conversation

@jeremy-consensys
Copy link
Copy Markdown
Contributor

Explanation

The existing MantleLayer1GasFeeFlow (added in #8376) handles Mantle mainnet's custom L1 gas fee calculation, which multiplies the oracle's ETH-denominated getL1Fee by tokenRatio() to convert to MNT. This PR extends that same flow to also support Mantle Sepolia testnet (chain ID 0x138b / 5003).

The Sepolia oracle lives at the same OP Stack predeploy address (0x420...000F) and exposes the same ABI (getL1Fee, tokenRatio, getOperatorFee). No new logic is needed -- the testnet chain ID is simply added to the existing MANTLE_CHAIN_IDS array so the flow matches both networks.

On-chain verification confirms:

  • getL1Fee(bytes) works on both mainnet and Sepolia
  • tokenRatio() works on both (mainnet: 3232, Sepolia: 3234)
  • getOperatorFee(uint256) reverts on mainnet (handled gracefully, defaults to 0) and works on Sepolia

Changes

File Change
constants.ts Add MANTLE_SEPOLIA: '0x138b'
MantleLayer1GasFeeFlow.ts Add CHAIN_IDS.MANTLE_SEPOLIA to MANTLE_CHAIN_IDS array
MantleLayer1GasFeeFlow.test.ts 3 new tests: chain matching, oracle address resolution, full fee calculation for Sepolia
CHANGELOG.md Unreleased entry

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Mantle uses MNT as its native gas token, but the OP Stack oracle's
getL1Fee returns values denominated in ETH. Add MantleLayer1GasFeeFlow
that multiplies the L1 fee by tokenRatio (ETH/MNT exchange rate from
the oracle contract) before adding the operator fee.

- New MantleLayer1GasFeeFlow extending OracleLayer1GasFeeFlow
- Registered first in #getLayer1GasFeeFlows() to match before Optimism
- Added MANTLE chain ID (0x1388) to constants
- 8 unit tests covering conversion, operator fee, error handling
…stnet

Add Mantle Sepolia (chain ID 0x138b) to MantleLayer1GasFeeFlow so the
tokenRatio conversion applies to testnet transactions as well.
@jeremy-consensys jeremy-consensys force-pushed the chore/add-mantle-testnet-gas-fee branch from ae1371c to ccea4fa Compare April 7, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant