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

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity ^0.8.0;
     3  
     4  /// @title Types
     5  /// @notice Contains various types used throughout the Optimism contract system.
     6  library Types {
     7      /// @notice OutputProposal represents a commitment to the L2 state. The timestamp is the L1
     8      ///         timestamp that the output root is posted. This timestamp is used to verify that the
     9      ///         finalization period has passed since the output root was submitted.
    10      /// @custom:field outputRoot    Hash of the L2 output.
    11      /// @custom:field timestamp     Timestamp of the L1 block that the output root was submitted in.
    12      /// @custom:field l2BlockNumber L2 block number that the output corresponds to.
    13      struct OutputProposal {
    14          bytes32 outputRoot;
    15          uint128 timestamp;
    16          uint128 l2BlockNumber;
    17      }
    18  
    19      /// @notice Struct representing the elements that are hashed together to generate an output root
    20      ///         which itself represents a snapshot of the L2 state.
    21      /// @custom:field version                  Version of the output root.
    22      /// @custom:field stateRoot                Root of the state trie at the block of this output.
    23      /// @custom:field messagePasserStorageRoot Root of the message passer storage trie.
    24      /// @custom:field latestBlockhash          Hash of the block this output was generated from.
    25      struct OutputRootProof {
    26          bytes32 version;
    27          bytes32 stateRoot;
    28          bytes32 messagePasserStorageRoot;
    29          bytes32 latestBlockhash;
    30      }
    31  
    32      /// @notice Struct representing a deposit transaction (L1 => L2 transaction) created by an end
    33      ///         user (as opposed to a system deposit transaction generated by the system).
    34      /// @custom:field from        Address of the sender of the transaction.
    35      /// @custom:field to          Address of the recipient of the transaction.
    36      /// @custom:field isCreation  True if the transaction is a contract creation.
    37      /// @custom:field value       Value to send to the recipient.
    38      /// @custom:field mint        Amount of ETH to mint.
    39      /// @custom:field gasLimit    Gas limit of the transaction.
    40      /// @custom:field data        Data of the transaction.
    41      /// @custom:field l1BlockHash Hash of the block the transaction was submitted in.
    42      /// @custom:field logIndex    Index of the log in the block the transaction was submitted in.
    43      struct UserDepositTransaction {
    44          address from;
    45          address to;
    46          bool isCreation;
    47          uint256 value;
    48          uint256 mint;
    49          uint64 gasLimit;
    50          bytes data;
    51          bytes32 l1BlockHash;
    52          uint256 logIndex;
    53      }
    54  
    55      /// @notice Struct representing a withdrawal transaction.
    56      /// @custom:field nonce    Nonce of the withdrawal transaction
    57      /// @custom:field sender   Address of the sender of the transaction.
    58      /// @custom:field target   Address of the recipient of the transaction.
    59      /// @custom:field value    Value to send to the recipient.
    60      /// @custom:field gasLimit Gas limit of the transaction.
    61      /// @custom:field data     Data of the transaction.
    62      struct WithdrawalTransaction {
    63          uint256 nonce;
    64          address sender;
    65          address target;
    66          uint256 value;
    67          uint256 gasLimit;
    68          bytes data;
    69      }
    70  }