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

     1  // SPDX-License-Identifier: MIT
     2  pragma solidity ^0.8.0;
     3  
     4  import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
     5  
     6  /// @title Transactor
     7  /// @notice Transactor is a minimal contract that can send transactions.
     8  contract Transactor is Owned {
     9      /// @param _owner Initial contract owner.
    10      constructor(address _owner) Owned(_owner) { }
    11  
    12      /// @notice Sends a CALL to a target address.
    13      /// @param _target Address to call.
    14      /// @param _data   Data to send with the call.
    15      /// @param _value  ETH value to send with the call.
    16      /// @return success_ Boolean success value.
    17      /// @return data_ Bytes data returned by the call.
    18      function CALL(
    19          address _target,
    20          bytes memory _data,
    21          uint256 _value
    22      )
    23          external
    24          payable
    25          onlyOwner
    26          returns (bool success_, bytes memory data_)
    27      {
    28          (success_, data_) = _target.call{ value: _value }(_data);
    29      }
    30  
    31      /// @notice Sends a DELEGATECALL to a target address.
    32      /// @param _target Address to call.
    33      /// @param _data   Data to send with the call.
    34      /// @return success_ Boolean success value.
    35      /// @return data_ Bytes data returned by the call.
    36      function DELEGATECALL(
    37          address _target,
    38          bytes memory _data
    39      )
    40          external
    41          payable
    42          onlyOwner
    43          returns (bool success_, bytes memory data_)
    44      {
    45          // slither-disable-next-line controlled-delegatecall
    46          (success_, data_) = _target.delegatecall(_data);
    47      }
    48  }