Transactor.sol 1.38 KB
Newer Older
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 7 8 9

/**
 * @title Transactor
 * @notice Transactor is a minimal contract that can send transactions.
 */
10
contract Transactor is Owned {
11 12 13
    /**
     * @param _owner Initial contract owner.
     */
14
    constructor(address _owner) Owned(_owner) {}
15 16 17 18 19

    /**
     * Sends a CALL to a target address.
     *
     * @param _target Address to call.
20 21 22
     * @param _data   Data to send with the call.
     * @param _value  ETH value to send with the call.
     *
23 24 25 26 27 28 29 30
     * @return Boolean success value.
     * @return Bytes data returned by the call.
     */
    function CALL(
        address _target,
        bytes memory _data,
        uint256 _value
    ) external payable onlyOwner returns (bool, bytes memory) {
31
        return _target.call{ value: _value }(_data);
32 33 34 35 36 37
    }

    /**
     * Sends a DELEGATECALL to a target address.
     *
     * @param _target Address to call.
38 39
     * @param _data   Data to send with the call.
     *
40 41 42
     * @return Boolean success value.
     * @return Bytes data returned by the call.
     */
43 44 45 46 47 48
    function DELEGATECALL(address _target, bytes memory _data)
        external
        payable
        onlyOwner
        returns (bool, bytes memory)
    {
49
        // slither-disable-next-line controlled-delegatecall
50
        return _target.delegatecall(_data);
51 52
    }
}