Sepolia Testnet

Contract

0x8fFe9b19591b031c7b76a27D1B356eD0A8441B80

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ChainHelper

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 300 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : ChainHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IOPGasPriceOracle} from "../interfaces/IOPGasPriceOracle.sol";

library ChainHelper {
    address public constant OP_GAS_PRICE_ORACLE_ADDR = address(0x420000000000000000000000000000000000000F);
    uint256 public constant OP_MAINNET_CHAIN_ID = 10;
    uint256 public constant OP_GOERLI_TESTNET_CHAIN_ID = 420;
    uint256 public constant OP_DEVNET_L1_CHAIN_ID = 900;
    uint256 public constant OP_DEVNET_L2_CHAIN_ID = 901;
    uint32 public constant OP_BASIC_FULFILLMENT_L1_GAS_USED = 5016;
    uint32 public constant OP_FULFILLMENT_GAS_PER_PARTICIPANT = 652;
    uint256 public constant OP_DIVISOR_DECIMALS = 6;

    function getBlockTime() public view returns (uint256) {
        uint256 chainId = block.chainid;
        if (chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_TESTNET_CHAIN_ID || chainId == OP_DEVNET_L2_CHAIN_ID)
        {
            return 2;
        } else if (chainId == OP_DEVNET_L1_CHAIN_ID) {
            return 3;
        }
        return 12;
    }

    function getCurrentTxL1GasFees() public view returns (uint256) {
        uint256 chainId = block.chainid;
        if (chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_TESTNET_CHAIN_ID || chainId == OP_DEVNET_L2_CHAIN_ID)
        {
            return IOPGasPriceOracle(OP_GAS_PRICE_ORACLE_ADDR).getL1Fee(msg.data);
        }
        return 0;
    }

    function getTxL1GasFees(uint256 l1GasUsed) public view returns (uint256) {
        uint256 chainId = block.chainid;
        if (chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_TESTNET_CHAIN_ID || chainId == OP_DEVNET_L2_CHAIN_ID)
        {
            uint256 l1Fee = l1GasUsed * IOPGasPriceOracle(OP_GAS_PRICE_ORACLE_ADDR).l1BaseFee();
            uint256 divisor = 10 ** OP_DIVISOR_DECIMALS;
            uint256 unscaled = l1Fee * IOPGasPriceOracle(OP_GAS_PRICE_ORACLE_ADDR).scalar();
            return unscaled / divisor;
        }
        return 0;
    }

    function getFulfillmentTxL1GasUsed(uint32 groupSize) public view returns (uint256) {
        uint256 chainId = block.chainid;
        if (chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_TESTNET_CHAIN_ID || chainId == OP_DEVNET_L2_CHAIN_ID)
        {
            return OP_BASIC_FULFILLMENT_L1_GAS_USED + groupSize * OP_FULFILLMENT_GAS_PER_PARTICIPANT;
        }
        return 0;
    }
}

File 2 of 2 : IOPGasPriceOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IOPGasPriceOracle {
    /// @notice Computes the L1 portion of the fee based on the size of the rlp encoded input
    ///         transaction, the current L1 base fee, and the various dynamic parameters.
    /// @param _data Unsigned fully RLP-encoded transaction to get the L1 fee for.
    /// @return L1 fee that should be paid for the tx
    function getL1Fee(bytes memory _data) external view returns (uint256);
    /// @notice Retrieves the current fee scalar.
    /// @return Current fee scalar.
    function scalar() external view returns (uint256);
    /// @notice Retrieves the latest known L1 base fee.
    /// @return Latest known L1 base fee.
    function l1BaseFee() external view returns (uint256);
}

Settings
{
  "remappings": [
    "Randcast-User-Contract/=lib/Randcast-User-Contract/contracts/",
    "Staking-v0.1/=lib/Staking-v0.1/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 300
  },
  "metadata": {
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract ABI

API
[{"inputs":[],"name":"OP_BASIC_FULFILLMENT_L1_GAS_USED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OP_DEVNET_L1_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OP_DEVNET_L2_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OP_DIVISOR_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OP_FULFILLMENT_GAS_PER_PARTICIPANT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OP_GAS_PRICE_ORACLE_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OP_GOERLI_TESTNET_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OP_MAINNET_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentTxL1GasFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"groupSize","type":"uint32"}],"name":"getFulfillmentTxL1GasUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"l1GasUsed","type":"uint256"}],"name":"getTxL1GasFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

61066661003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100de5760003560e01c8063745e0dcf1161008b578063c6f7de0e11610065578063c6f7de0e1461018a578063eea362c814610192578063fbbdd6471461019b57600080fd5b8063745e0dcf1461015c57806387ceff091461016f5780638e3976f61461017757600080fd5b806343fc55f4116100bc57806343fc55f41461012557806352845dd91461012d5780635ecc26881461015357600080fd5b80630bffaaef146100e357806312a5dbf4146100fe578063133985c71461011c575b600080fd5b6100eb600681565b6040519081526020015b60405180910390f35b61010761028c81565b60405163ffffffff90911681526020016100f5565b6100eb61038481565b6100eb600a81565b61013b600f602160991b0181565b6040516001600160a01b0390911681526020016100f5565b6100eb61038581565b6100eb61016a366004610411565b6101a4565b6100eb6101f6565b6100eb61018536600461043e565b61023b565b6100eb610371565b61010761139881565b6100eb6101a481565b600046600a8114806101b757506101a481145b806101c3575061038581145b156101ed576101d461028c8461046d565b6101e090611398610495565b63ffffffff169392505050565b50600092915050565b600046600a81148061020957506101a481145b80610215575061038581145b1561022257600291505090565b610384810361023357600391505090565b600c91505090565b600046600a81148061024e57506101a481145b8061025a575061038581145b156101ed576000600f602160991b016001600160a01b031663519b4bd36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ca91906104b9565b6102d490856104d2565b905060006102e46006600a6105d3565b90506000600f602160991b016001600160a01b031663f45e65d86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561032d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035191906104b9565b61035b90846104d2565b905061036782826105df565b9695505050505050565b600046600a81148061038457506101a481145b80610390575061038581145b15610409576040516324ca470760e11b8152600f602160991b01906349948e0e906103c2906000903690600401610601565b602060405180830381865afa1580156103df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040391906104b9565b91505090565b600091505090565b60006020828403121561042357600080fd5b813563ffffffff8116811461043757600080fd5b9392505050565b60006020828403121561045057600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461048d5761048d610457565b505092915050565b63ffffffff8181168382160190808211156104b2576104b2610457565b5092915050565b6000602082840312156104cb57600080fd5b5051919050565b80820281158282048414176104e9576104e9610457565b92915050565b600181815b8085111561052a57816000190482111561051057610510610457565b8085161561051d57918102915b93841c93908002906104f4565b509250929050565b600082610541575060016104e9565b8161054e575060006104e9565b8160018114610564576002811461056e5761058a565b60019150506104e9565b60ff84111561057f5761057f610457565b50506001821b6104e9565b5060208310610133831016604e8410600b84101617156105ad575081810a6104e9565b6105b783836104ef565b80600019048211156105cb576105cb610457565b029392505050565b60006104378383610532565b6000826105fc57634e487b7160e01b600052601260045260246000fd5b500490565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea2646970667358221220e77d875672a9b432d2fba3cf8690109c470db6a51af5dc47e23a33bf4604143864736f6c63430008120033

Deployed Bytecode

0x738ffe9b19591b031c7b76a27d1b356ed0a8441b8030146080604052600436106100de5760003560e01c8063745e0dcf1161008b578063c6f7de0e11610065578063c6f7de0e1461018a578063eea362c814610192578063fbbdd6471461019b57600080fd5b8063745e0dcf1461015c57806387ceff091461016f5780638e3976f61461017757600080fd5b806343fc55f4116100bc57806343fc55f41461012557806352845dd91461012d5780635ecc26881461015357600080fd5b80630bffaaef146100e357806312a5dbf4146100fe578063133985c71461011c575b600080fd5b6100eb600681565b6040519081526020015b60405180910390f35b61010761028c81565b60405163ffffffff90911681526020016100f5565b6100eb61038481565b6100eb600a81565b61013b600f602160991b0181565b6040516001600160a01b0390911681526020016100f5565b6100eb61038581565b6100eb61016a366004610411565b6101a4565b6100eb6101f6565b6100eb61018536600461043e565b61023b565b6100eb610371565b61010761139881565b6100eb6101a481565b600046600a8114806101b757506101a481145b806101c3575061038581145b156101ed576101d461028c8461046d565b6101e090611398610495565b63ffffffff169392505050565b50600092915050565b600046600a81148061020957506101a481145b80610215575061038581145b1561022257600291505090565b610384810361023357600391505090565b600c91505090565b600046600a81148061024e57506101a481145b8061025a575061038581145b156101ed576000600f602160991b016001600160a01b031663519b4bd36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ca91906104b9565b6102d490856104d2565b905060006102e46006600a6105d3565b90506000600f602160991b016001600160a01b031663f45e65d86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561032d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035191906104b9565b61035b90846104d2565b905061036782826105df565b9695505050505050565b600046600a81148061038457506101a481145b80610390575061038581145b15610409576040516324ca470760e11b8152600f602160991b01906349948e0e906103c2906000903690600401610601565b602060405180830381865afa1580156103df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040391906104b9565b91505090565b600091505090565b60006020828403121561042357600080fd5b813563ffffffff8116811461043757600080fd5b9392505050565b60006020828403121561045057600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461048d5761048d610457565b505092915050565b63ffffffff8181168382160190808211156104b2576104b2610457565b5092915050565b6000602082840312156104cb57600080fd5b5051919050565b80820281158282048414176104e9576104e9610457565b92915050565b600181815b8085111561052a57816000190482111561051057610510610457565b8085161561051d57918102915b93841c93908002906104f4565b509250929050565b600082610541575060016104e9565b8161054e575060006104e9565b8160018114610564576002811461056e5761058a565b60019150506104e9565b60ff84111561057f5761057f610457565b50506001821b6104e9565b5060208310610133831016604e8410600b84101617156105ad575081810a6104e9565b6105b783836104ef565b80600019048211156105cb576105cb610457565b029392505050565b60006104378383610532565b6000826105fc57634e487b7160e01b600052601260045260246000fd5b500490565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea2646970667358221220e77d875672a9b432d2fba3cf8690109c470db6a51af5dc47e23a33bf4604143864736f6c63430008120033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.