You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: introduce operator fee for OP stack networks (#6979)
## Explanation
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:
* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->
## References
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
## 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](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds OP Stack operator fee to `layer1GasFee` by querying the oracle
(`getOperatorFee`) and summing with `getL1Fee`, plus BN utilities and
tests.
>
> - **Layer 1 Gas Fee (oracle flow)**:
> - Sum oracle `getL1Fee` with operator fee from
`getOperatorFee(gasUsed)`; default operator fee to zero on
failure/undefined; output normalized hex via `add0x` +
`padHexToEvenLength`.
> - Refactor to BN-based math and value coercion via new `toBN`; extract
`#getGasPriceOracleContract`; keep default OP Stack oracle address and
optional signing.
> - Extend ABI with `getOperatorFee`.
> - **Utils**:
> - Add `bnFromHex` and `toBN` helpers for parsing/converting to `BN`.
> - **Tests**:
> - Update `OracleLayer1GasFeeFlow.test.ts` to mock BN returns and cover
operator fee present/failure/undefined paths.
> - Add tests for `bnFromHex` and `toBN`.
> - **Docs**:
> - Update `CHANGELOG.md` to note inclusion of operator fee in
`layer1GasFee`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6e8d304. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
0 commit comments