Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Optimism Ecotone Support #214

Closed
cgewecke opened this issue Mar 14, 2024 · 2 comments
Closed

Add Optimism Ecotone Support #214

cgewecke opened this issue Mar 14, 2024 · 2 comments

Comments

@cgewecke
Copy link
Owner

cgewecke commented Mar 14, 2024

PR open for this in #213 but blobBaseFee (necessary to calculate the cost) isn't available from any endpoints yet.

export function getOptimismEcotoneL1Cost(
txCompressed: number,
baseFee: number,
blobBaseFee: number
): number {
const weightedBaseFee = 16 * OPTIMISM_ECOTONE_BASE_FEE_SCALAR * baseFee;
const weightedBlobBaseFee = OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR * blobBaseFee;
return txCompressed * (weightedBaseFee + weightedBlobBaseFee);
}

A stopgap is to read this off the GasOracle they published yesterday at 0xb528d11cc114e026f138fe568744c6d45ce6da7a on L2

Will have to generate the ABI - it hasn't been verified on the scan. And call with an Alchemy or Infura key.

Source

    /// @notice Retrieves the current blob base fee.
    /// @return Current blob base fee.
    function blobBaseFee() public view returns (uint256) {
        return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFee();
    }

    /// @notice Retrieves the current base fee scalar.
    /// @return Current base fee scalar.
    function baseFeeScalar() public view returns (uint32) {
        return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).baseFeeScalar();
    }

    /// @notice Retrieves the current blob base fee scalar.
    /// @return Current blob base fee scalar.
    function blobBaseFeeScalar() public view returns (uint32) {
        return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFeeScalar();
    }
@cgewecke
Copy link
Owner Author

Screen Shot 2024-03-14 at 12 48 35 PM

@cgewecke
Copy link
Owner Author

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

No branches or pull requests

1 participant