Skip to content
Verified contractPartialMIT

OPContractsManagerStandardValidator

Address0xae6153ec750dfb0871b3e2287caacc0c19f9e809
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.15

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.15+commit.e14f2714
Language
solidity
Optimization
Yes, 200 runs
EVM version
london
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,480,487
Creation transaction
0xddd9a4984f…b14dee3220

50 files

The source code is large: one file is shown at a time. Choose a file in the list.

scripts/libraries/Config.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { Vm, VmSafe } from "forge-std/Vm.sol";
import { LibString } from "@solady/utils/LibString.sol";

/// @notice Enum representing different ways of outputting genesis allocs.
/// @custom:value NONE    No output, used in internal tests.
/// @custom:value LATEST  Output allocs only for latest fork.
/// @custom:value ALL     Output allocs for all intermediary forks.
enum OutputMode {
    NONE,
    LATEST,
    ALL
}

library OutputModeUtils {
    function toString(OutputMode _mode) internal pure returns (string memory) {
        if (_mode == OutputMode.NONE) {
            return "none";
        } else if (_mode == OutputMode.LATEST) {
            return "latest";
        } else if (_mode == OutputMode.ALL) {
            return "all";
        } else {
            return "unknown";
        }
    }
}

/// @notice Enum of forks available for selection when generating genesis allocs.
enum Fork {
    NONE,
    DELTA,
    ECOTONE,
    FJORD,
    GRANITE,
    HOLOCENE,
    ISTHMUS,
    JOVIAN,
    KARST,
    LAGOON
}

Fork constant LATEST_FORK = Fork.LAGOON;

library ForkUtils {
    function toString(Fork _fork) internal pure returns (string memory) {
        if (_fork == Fork.NONE) {
            return "none";
        } else if (_fork == Fork.DELTA) {
            return "delta";
        } else if (_fork == Fork.ECOTONE) {
            return "ecotone";
        } else if (_fork == Fork.FJORD) {
            return "fjord";
        } else if (_fork == Fork.GRANITE) {
            return "granite";
        } else if (_fork == Fork.HOLOCENE) {
            return "holocene";
        } else if (_fork == Fork.ISTHMUS) {
            return "isthmus";
        } else if (_fork == Fork.JOVIAN) {
            return "jovian";
        } else if (_fork == Fork.KARST) {
            return "karst";
        } else {
            return "unknown";
        }
    }
}

/// @title Config
/// @notice Contains all env var based config. Add any new env var parsing to this file
///         to ensure that all config is in a single place.
library Config {
    /// @notice Foundry cheatcode VM.
    Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));

    /// @notice Returns the path on the local filesystem where the deployment artifact is
    ///         written to disk after doing a deployment.
    function deploymentOutfile() internal view returns (string memory env_) {
        env_ = vm.envOr(
            "DEPLOYMENT_OUTFILE",
            string.concat(vm.projectRoot(), "/deployments/", vm.toString(block.chainid), "-deploy.json")
        );
    }

    /// @notice Returns the path on the local filesystem where the deploy config is
    function deployConfigPath() internal view returns (string memory env_) {
        env_ = vm.envOr("DEPLOY_CONFIG_PATH", string(""));
        require(bytes(env_).length > 0, "Config: must set DEPLOY_CONFIG_PATH to filesystem path of deploy config");
    }

    /// @notice Returns the chainid from the EVM context or the value of the CHAIN_ID env var as
    ///         an override.
    function chainID() internal view returns (uint256 env_) {
        env_ = vm.envOr("CHAIN_ID", block.chainid);
    }

    /// @notice The CREATE2 salt to be used when deploying the implementations.
    function implSalt() internal view returns (string memory env_) {
        env_ = vm.envOr("IMPL_SALT", string("ethers phoenix"));
    }

    /// @notice Returns the path that the state dump file should be written to or read from
    ///         on the local filesystem.
    function stateDumpPath(string memory _suffix) internal view returns (string memory env_) {
        env_ = vm.envOr(
            "STATE_DUMP_PATH",
            string.concat(vm.projectRoot(), "/state-dump-", vm.toString(block.chainid), _suffix, ".json")
        );
    }

    /// @notice Returns the name of the file that the forge deployment artifact is written to on the local
    ///         filesystem. By default, it is the name of the deploy script with the suffix `-latest.json`.
    ///         This was useful for creating hardhat deploy style artifacts and will be removed in a future release.
    function deployFile(string memory _sig) internal view returns (string memory env_) {
        env_ = vm.envOr("DEPLOY_FILE", string.concat(_sig, "-latest.json"));
    }

    /// @notice Returns the private key that is used to configure drippie.
    function drippieOwnerPrivateKey() internal view returns (uint256 env_) {
        env_ = vm.envUint("DRIPPIE_OWNER_PRIVATE_KEY");
    }

    /// @notice Returns the API key for the Etherscan API.
    function etherscanApiKey() internal view returns (string memory env_) {
        env_ = vm.envString("ETHERSCAN_API_KEY");
    }

    /// @notice Returns the block explorer to use for fetching creation code.
    function blockExplorer() internal view returns (string memory env_) {
        env_ = vm.envOr("BLOCK_EXPLORER", string("blockscout"));
    }

    /// @notice Returns the base URL for the Blockscout API.
    function blockscoutApiUrl() internal view returns (string memory) {
        string memory envUrl = vm.envOr("BLOCKSCOUT_API_URL", string(""));
        if (bytes(envUrl).length > 0) {
            return envUrl;
        }

        if (block.chainid == 1) {
            // Ethereum
            return "https://eth.blockscout.com";
        } else if (block.chainid == 10) {
            // OP Mainnet
            return "https://explorer.optimism.io";
        } else if (block.chainid == 11155111) {
            // Sepolia
            return "https://eth-sepolia.blockscout.com";
        } else if (block.chainid == 8453) {
            // Base
            return "https://base.blockscout.com";
        } else if (block.chainid == 84532) {
            // Base Sepolia
            return "https://base-sepolia.blockscout.com";
        } else if (block.chainid == 11155420) {
            // OP Sepolia
            return "https://optimism-sepolia.blockscout.com";
        } else {
            return "";
        }
    }

    /// @notice Returns the OutputMode for genesis allocs generation.
    ///         It reads the mode from the environment variable OUTPUT_MODE.
    ///         If it is unset, OutputMode.ALL is returned.
    function outputMode() internal view returns (OutputMode) {
        string memory modeStr = vm.envOr("OUTPUT_MODE", string("latest"));
        bytes32 modeHash = keccak256(bytes(modeStr));
        if (modeHash == keccak256(bytes("none"))) {
            return OutputMode.NONE;
        } else if (modeHash == keccak256(bytes("latest"))) {
            return OutputMode.LATEST;
        } else if (modeHash == keccak256(bytes("all"))) {
            return OutputMode.ALL;
        } else {
            revert(string.concat("Config: unknown output mode: ", modeStr));
        }
    }

    /// @notice Returns the latest fork to use for genesis allocs generation.
    ///         It reads the fork from the environment variable FORK. If it is
    ///         unset, NONE is returned.
    ///         If set to the special value "latest", the latest fork is returned.
    function fork() internal view returns (Fork) {
        string memory forkStr = vm.envOr("FORK", string(""));
        if (bytes(forkStr).length == 0) {
            return Fork.NONE;
        }
        bytes32 forkHash = keccak256(bytes(forkStr));
        if (forkHash == keccak256(bytes("latest"))) {
            return LATEST_FORK;
        } else if (forkHash == keccak256(bytes("delta"))) {
            return Fork.DELTA;
        } else if (forkHash == keccak256(bytes("ecotone"))) {
            return Fork.ECOTONE;
        } else if (forkHash == keccak256(bytes("fjord"))) {
            return Fork.FJORD;
        } else if (forkHash == keccak256(bytes("granite"))) {
            return Fork.GRANITE;
        } else if (forkHash == keccak256(bytes("holocene"))) {
            return Fork.HOLOCENE;
        } else if (forkHash == keccak256(bytes("isthmus"))) {
            return Fork.ISTHMUS;
        } else if (forkHash == keccak256(bytes("jovian"))) {
            return Fork.JOVIAN;
        } else if (forkHash == keccak256(bytes("karst"))) {
            return Fork.KARST;
        } else {
            revert(string.concat("Config: unknown fork: ", forkStr));
        }
    }

    /// @notice Returns the address of the L1CrossDomainMessengerProxy to use for the L2 genesis usage.
    function l2Genesis_L1CrossDomainMessengerProxy() internal view returns (address payable) {
        return payable(vm.envAddress("L2GENESIS_L1CrossDomainMessengerProxy"));
    }

    /// @notice Returns the address of the L1StandardBridgeProxy to use for the L2 genesis usage.
    function l2Genesis_L1StandardBridgeProxy() internal view returns (address payable) {
        return payable(vm.envAddress("L2GENESIS_L1StandardBridgeProxy"));
    }

    /// @notice Returns the address of the L1ERC721BridgeProxy to use for the L2 genesis usage.
    function l2Genesis_L1ERC721BridgeProxy() internal view returns (address payable) {
        return payable(vm.envAddress("L2GENESIS_L1ERC721BridgeProxy"));
    }

    /// @notice Returns the string identifier of the OP chain use for forking.
    ///         If not set, "op" is returned.
    function forkOpChain() internal view returns (string memory) {
        return vm.envOr("FORK_OP_CHAIN", string("op"));
    }

    /// @notice Returns the string identifier of the base chain to use for forking.
    ///         if not set, "mainnet" is returned.
    function forkBaseChain() internal view returns (string memory) {
        return vm.envOr("FORK_BASE_CHAIN", string("mainnet"));
    }

    /// @notice Returns the RPC URL of the mainnet.
    ///         If not set, an empty string is returned.
    function mainnetRpcUrl() internal view returns (string memory) {
        return vm.envOr("MAINNET_RPC_URL", string(""));
    }

    /// @notice Returns the RPC URL to use for forking.
    function forkRpcUrl() internal view returns (string memory) {
        return vm.envString("FORK_RPC_URL");
    }

    /// @notice Returns the block number to use for forking.
    function forkBlockNumber() internal view returns (uint256) {
        return vm.envUint("FORK_BLOCK_NUMBER");
    }

    /// @notice Returns the profile to use for the foundry commands.
    ///         If not set, "default" is returned.
    function foundryProfile() internal view returns (string memory) {
        return vm.envOr("FOUNDRY_PROFILE", string("default"));
    }

    /// @notice Returns true when the compiler output is not production-like. This includes
    ///         coverage mode (which adds instrumentation) and unoptimized Foundry profiles
    ///         (which produce different bytecode, CREATE2 addresses, and gas costs).
    function isUnoptimized() internal view returns (bool) {
        if (vm.isContext(VmSafe.ForgeContext.Coverage)) {
            return true;
        }
        string memory profile = foundryProfile();
        return !LibString.eq(profile, "default") && !LibString.eq(profile, "ci");
    }

    /// @notice Returns the path to the superchain ops allocs.
    function superchainOpsAllocsPath() internal view returns (string memory) {
        return vm.envOr("SUPERCHAIN_OPS_ALLOCS_PATH", string(""));
    }

    /// @notice Returns true if the fork is a test fork.
    function l1ForkTest() internal view returns (bool) {
        return vm.envOr("FORK_TEST", false);
    }

    /// @notice Returns true if this is an L2 fork test.
    function l2ForkTest() internal view returns (bool) {
        return vm.envOr("L2_FORK_TEST", false);
    }

    /// @notice Returns true if this is a L2CM activation test.
    function l2CMActivationTest() internal view returns (bool) {
        return vm.envOr("L2CM_ACTIVATION_TEST", false);
    }

    /// @notice Returns the L2 RPC URL for forking.
    function l2ForkRpcUrl() internal view returns (string memory) {
        return vm.envString("L2_FORK_RPC_URL");
    }

    /// @notice Returns the L2 block after the fork.
    function l2BlockAfterFork() internal view returns (uint256) {
        if (l2CMActivationTest()) {
            return vm.envOr("L2_FORK_BLOCK_NUMBER", uint256(0));
        }
        revert("Config: l2BlockAfterFork called outside of L2CM activation test");
    }

    /// @notice Returns the path to the committed NUT bundle JSON to verify against.
    function nutBundlePath() internal view returns (string memory) {
        return vm.envString("NUT_BUNDLE_PATH");
    }

    /// @notice Returns the L2 block number to fork at. Defaults to 0 (latest).
    ///         If L2CM activation test is enabled, returns the block before the fork.
    function l2ForkBlockNumber() internal view returns (uint256) {
        if (l2CMActivationTest()) {
            return vm.envUint("L2_BLOCK_BEFORE_FORK");
        }
        return vm.envOr("L2_FORK_BLOCK_NUMBER", uint256(0));
    }

    /// @notice Returns the L2 chain identifier (e.g., "op", "base", "mode").
    function l2ForkChain() internal view returns (string memory) {
        return vm.envOr("L2_FORK_CHAIN", string("op"));
    }

    /// @notice Returns true if the development feature BRIDGE_HOOK is enabled.
    function devFeatureBridgeHook() internal view returns (bool) {
        return vm.envOr("DEV_FEATURE__BRIDGE_HOOK", false);
    }

    /// @notice Returns true if the development feature OP_PRIVATE is enabled.
    function devFeatureOpPrivate() internal view returns (bool) {
        return vm.envOr("DEV_FEATURE__OP_PRIVATE", false);
    }

    /// @notice Returns true if the development feature super root games migration is enabled.
    /// @dev Defaults to true: SUPER_ROOT_GAMES_MIGRATION is the default OPCM migration codepath. See TODO(#21662).
    function devFeatureSuperRootGamesMigration() internal pure returns (bool) {
        return true;
    }

    /// @notice Returns true if the system feature custom_gas_token is enabled.
    function sysFeatureCustomGasToken() internal view returns (bool) {
        return vm.envOr("SYS_FEATURE__CUSTOM_GAS_TOKEN", false);
    }

    /// @notice Returns true if the system feature interop is enabled.
    function sysFeatureInterop() internal view returns (bool) {
        return vm.envOr("SYS_FEATURE__INTEROP", false);
    }

    /// @notice Returns true if running in kontrol context.
    function isKontrolContext() internal view returns (bool) {
        return vm.envOr("KONTROL_CONTEXT", false);
    }
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "london",
  "remappings": [
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-v5/=lib/openzeppelin-contracts-v5/contracts/",
    "@rari-capital/solmate/=lib/solmate/",
    "@lib-keccak/=lib/lib-keccak/contracts/lib/",
    "@solady/=lib/solady/src/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "safe-contracts/=lib/safe-contracts/contracts/",
    "kontrol-cheatcodes/=lib/kontrol-cheatcodes/src/",
    "interfaces/=interfaces/",
    "lib/lib-keccak/:solady/=lib/lib-keccak/lib/solady/",
    "lib/lib-keccak/:solady/=lib/lib-keccak/lib/solady/",
    "@solady-test/=lib/lib-keccak/lib/solady/test/",
    "erc4626-tests/=lib/openzeppelin-contracts-v5/lib/erc4626-tests/",
    "lib-keccak/=lib/lib-keccak/contracts/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts-v5/=lib/openzeppelin-contracts-v5/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solady/=lib/solady/",
    "solmate/=lib/solmate/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.