Address io16pvy5zs9ldyl2h28j3vh5cdr2yrkv8kxutv4ax

Contract Overview

Balance:
0 IOTX

IOTX Value:
$ 0

Token:
Txn Hash
Block
From
To
Value [Txn Fee]
158da724bf64d55b4ffbdfe113a0ff9d860eebfcba7367aac0503a484da63f3b 20122747 2022-10-20 14:45:25 +0000 UTC 2 years ago io1qhwut90ax0tm92esy9puggxsulepkc32mezxku  IN    Contract: ConfirmTool 0 IOTX 0.022331
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ConfirmTool

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 20 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

// File: @openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// File: contracts/interfaces/MultiSign.sol



pragma solidity ^0.8.0;

interface MultiSign {
    function submitTransaction(address destination, uint256 value, bytes memory data) external returns(uint256 transactionId);
    function confirmTransaction(uint256 transactionId) external;
}

// File: contracts/interfaces/TimeLock.sol



pragma solidity ^0.8.0;

interface TimeLock {
    function queueTransaction(address target, uint256 value, string memory signature, bytes memory data, uint256 eta) external returns(bytes32);
    function executeTransaction(address target, uint256 value, string memory signature, bytes memory data, uint256 eta) external returns(bytes memory);
}

// File: contracts/interfaces/CToken.sol



pragma solidity ^0.8.0;

interface CToken {
    function _reduceReserves(uint reduceAmount) external returns (uint);
    function isNativeToken() external pure returns (bool);
    function underlying() external view returns (address);
}

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

// File: contracts/SubmitTool.sol



pragma solidity ^0.8.0;





contract SubmitTool is Ownable {

    MultiSign public multisign;
    address public timelock;
    uint256 public startTransactionId;
    uint256 public length;

    event QueueSubmitted(uint256 transactionId, uint256 length);
    event ExecuteSubmitted(uint256 transactionId, uint256 length);

    constructor(address _multisign, address _timelock) {
        require(_multisign != address(0) && _timelock != address(0), "invalid param");

        multisign = MultiSign(_multisign);
        timelock = _timelock;
    }

    function submit(address[] memory ftokens, uint[] memory amounts, address receiver, uint256 eta)
            external onlyOwner returns(uint256 queueId, uint256 executeId) {
        require(ftokens.length == amounts.length, "Inconsistent length");
        
         for (uint8 i = 0; i < ftokens.length; i++) {
            bytes memory ftokenAbi = abi.encodeWithSelector(CToken._reduceReserves.selector, amounts[i]);
         
            uint256 trasactionId = multisign.submitTransaction(ftokens[i], 0, ftokenAbi);
            if (i == 0) {
                startTransactionId = queueId = trasactionId;
            }
        }

        for (uint8 i = 0; i < ftokens.length; i++) {
            CToken cTokenInstance = CToken(ftokens[i]);
            if (cTokenInstance.isNativeToken()) {
                multisign.submitTransaction(receiver, amounts[i], '');
            } else {
                bytes memory transferAbi = abi.encodeWithSelector(IERC20.transfer.selector, receiver, amounts[i]);
                multisign.submitTransaction(cTokenInstance.underlying(), 0, transferAbi);
            }
        }
        emit ExecuteSubmitted(queueId, ftokens.length);  
        length = ftokens.length;
    }
}

// File: contracts/ConfirmTool.sol



pragma solidity ^0.8.0;





contract ConfirmTool is Ownable {
    MultiSign public multisign;

    constructor(address _multisign) {
        require(_multisign != address(0), "invalid param");

        multisign = MultiSign(_multisign);
    }

    function confirmTxByIds(uint256[] memory ids) external onlyOwner {
        for (uint256 i = 0; i < ids.length; i++) {
            multisign.confirmTransaction(ids[i]);
        }
    }

    function confirmTxByScope(uint256 from, uint256 to) external onlyOwner {
        for (uint256 i = from; i <= to; i++) {
            multisign.confirmTransaction(i);
        }
    }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_multisign","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"confirmTxByIds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"to","type":"uint256"}],"name":"confirmTxByScope","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"multisign","outputs":[{"internalType":"contract MultiSign","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Contract Creation Code

608060405234801561001057600080fd5b50600436106100625760003560e01c806334976fa114610067578063715018a614610096578063886548a5146100a05780638da5cb5b146100b3578063ee315959146100bb578063f2fde38b146100ce575b600080fd5b60015461007a906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61009e6100e1565b005b61009e6100ae36600461037a565b6100f5565b61007a6101a1565b61009e6100c9366004610438565b6101b0565b61009e6100dc36600461045a565b610237565b6100e96102b5565b6100f36000610314565b565b6100fd6102b5565b60005b815181101561019d5760015482516001600160a01b039091169063c01a8c84908490849081106101325761013261048a565b60200260200101516040518263ffffffff1660e01b815260040161015891815260200190565b600060405180830381600087803b15801561017257600080fd5b505af1158015610186573d6000803e3d6000fd5b505050508080610195906104a0565b915050610100565b5050565b6000546001600160a01b031690565b6101b86102b5565b815b81811161023257600154604051633006a32160e21b8152600481018390526001600160a01b039091169063c01a8c8490602401600060405180830381600087803b15801561020757600080fd5b505af115801561021b573d6000803e3d6000fd5b50505050808061022a906104a0565b9150506101ba565b505050565b61023f6102b5565b6001600160a01b0381166102a95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6102b281610314565b50565b336102be6101a1565b6001600160a01b0316146100f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102a0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561038d57600080fd5b823567ffffffffffffffff808211156103a557600080fd5b818501915085601f8301126103b957600080fd5b8135818111156103cb576103cb610364565b8060051b604051601f19603f830116810181811085821117156103f0576103f0610364565b60405291825284820192508381018501918883111561040e57600080fd5b938501935b8285101561042c57843584529385019392850192610413565b98975050505050505050565b6000806040838503121561044b57600080fd5b50508035926020909101359150565b60006020828403121561046c57600080fd5b81356001600160a01b038116811461048357600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156104c257634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212202fc3244e6b3964e0c263a527354f9fecb85686a639d75aca4f02d658f7d3819d64736f6c634300080a0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.