github.com/ethereum-optimism/optimism@v1.7.2/packages/contracts-bedrock/src/libraries/Constants.sol (about)

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity ^0.8.0;
     3  
     4  import { ResourceMetering } from "src/L1/ResourceMetering.sol";
     5  
     6  /// @title Constants
     7  /// @notice Constants is a library for storing constants. Simple! Don't put everything in here, just
     8  ///         the stuff used in multiple contracts. Constants that only apply to a single contract
     9  ///         should be defined in that contract instead.
    10  library Constants {
    11      /// @notice Special address to be used as the tx origin for gas estimation calls in the
    12      ///         OptimismPortal and CrossDomainMessenger calls. You only need to use this address if
    13      ///         the minimum gas limit specified by the user is not actually enough to execute the
    14      ///         given message and you're attempting to estimate the actual necessary gas limit. We
    15      ///         use address(1) because it's the ecrecover precompile and therefore guaranteed to
    16      ///         never have any code on any EVM chain.
    17      address internal constant ESTIMATION_ADDRESS = address(1);
    18  
    19      /// @notice Value used for the L2 sender storage slot in both the OptimismPortal and the
    20      ///         CrossDomainMessenger contracts before an actual sender is set. This value is
    21      ///         non-zero to reduce the gas cost of message passing transactions.
    22      address internal constant DEFAULT_L2_SENDER = 0x000000000000000000000000000000000000dEaD;
    23  
    24      /// @notice The storage slot that holds the address of a proxy implementation.
    25      /// @dev `bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)`
    26      bytes32 internal constant PROXY_IMPLEMENTATION_ADDRESS =
    27          0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
    28  
    29      /// @notice The storage slot that holds the address of the owner.
    30      /// @dev `bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)`
    31      bytes32 internal constant PROXY_OWNER_ADDRESS = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
    32  
    33      /// @notice Returns the default values for the ResourceConfig. These are the recommended values
    34      ///         for a production network.
    35      function DEFAULT_RESOURCE_CONFIG() internal pure returns (ResourceMetering.ResourceConfig memory) {
    36          ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({
    37              maxResourceLimit: 20_000_000,
    38              elasticityMultiplier: 10,
    39              baseFeeMaxChangeDenominator: 8,
    40              minimumBaseFee: 1 gwei,
    41              systemTxMaxGas: 1_000_000,
    42              maximumBaseFee: type(uint128).max
    43          });
    44          return config;
    45      }
    46  }