cgewecke / hardhat-gas-reporter

Gas Usage Analytics for Hardhat
MIT License
404 stars 55 forks source link

Add Optimism Ecotone Support #214

Closed cgewecke closed 4 months ago

cgewecke commented 4 months ago

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

https://github.com/cgewecke/hardhat-gas-reporter/blob/16fde03738b3e37c33f27a98f408b465dc97d4d7/src/utils/gas.ts#L97-L105

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 commented 4 months ago

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

cgewecke commented 4 months ago

Closed via release 2.0.1: https://github.com/cgewecke/hardhat-gas-reporter/releases/tag/v2.0.1