ETH Price: $2,507.97 (-2.03%)

Contract

0x356167aaf46C80Fe8E1817785d3EE943E08c644b

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Gov1035560172023-06-01 11:59:00723 days ago1685620740IN
Minerva Money: Batch Sender
0 ETH0.0001331923680.001

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BatchSender

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 50 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "../libraries/token/IERC20.sol";
import "../libraries/math/SafeMath.sol";

import "../access/Governable.sol";

contract BatchSender is Governable {
    using SafeMath for uint256;

    mapping(address => bool) public isHandler;

    event BatchSend(uint256 indexed typeId, address indexed token, address[] accounts, uint256[] amounts);

    modifier onlyHandler() {
        require(isHandler[msg.sender], "BatchSender: forbidden");
        _;
    }

    constructor() public {
        isHandler[msg.sender] = true;
    }

    function setHandler(address _handler, bool _isActive) external onlyGov {
        isHandler[_handler] = _isActive;
    }

    function send(
        IERC20 _token,
        address[] memory _accounts,
        uint256[] memory _amounts
    ) public onlyHandler {
        _send(_token, _accounts, _amounts, 0);
    }

    function sendAndEmit(
        IERC20 _token,
        address[] memory _accounts,
        uint256[] memory _amounts,
        uint256 _typeId
    ) public onlyHandler {
        _send(_token, _accounts, _amounts, _typeId);
    }

    function _send(
        IERC20 _token,
        address[] memory _accounts,
        uint256[] memory _amounts,
        uint256 _typeId
    ) private {
        for (uint256 i = 0; i < _accounts.length; i++) {
            address account = _accounts[i];
            uint256 amount = _amounts[i];
            _token.transferFrom(msg.sender, account, amount);
        }

        emit BatchSend(_typeId, address(_token), _accounts, _amounts);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

contract Governable {
    address public gov;

    constructor() public {
        gov = msg.sender;
    }

    modifier onlyGov() {
        require(msg.sender == gov, "Governable: forbidden");
        _;
    }

    function setGov(address _gov) external onlyGov {
        gov = _gov;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 50
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"typeId","type":"uint256"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address[]","name":"accounts","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"BatchSend","type":"event"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isHandler","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"uint256","name":"_typeId","type":"uint256"}],"name":"sendAndEmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_handler","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setHandler","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b0319163390811782558152600160208190526040909120805460ff191690911790556107518061004d6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806312d43a511461006757806346ea87af1461008b578063745ae40b146100c55780639cb7de4b146101fc578063cfad57a21461022a578063f8129cd214610250575b600080fd5b61006f610383565b604080516001600160a01b039092168252519081900360200190f35b6100b1600480360360208110156100a157600080fd5b50356001600160a01b0316610392565b604080519115158252519081900360200190f35b6101fa600480360360808110156100db57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561010557600080fd5b82018360208201111561011757600080fd5b803590602001918460208302840111600160201b8311171561013857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561018757600080fd5b82018360208201111561019957600080fd5b803590602001918460208302840111600160201b831117156101ba57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050913592506103a7915050565b005b6101fa6004803603604081101561021257600080fd5b506001600160a01b0381351690602001351515610416565b6101fa6004803603602081101561024057600080fd5b50356001600160a01b0316610498565b6101fa6004803603606081101561026657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561029057600080fd5b8201836020820111156102a257600080fd5b803590602001918460208302840111600160201b831117156102c357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561031257600080fd5b82018360208201111561032457600080fd5b803590602001918460208302840111600160201b8311171561034557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610511945050505050565b6000546001600160a01b031681565b60016020526000908152604090205460ff1681565b3360009081526001602052604090205460ff16610404576040805162461bcd60e51b81526020600482015260166024820152752130ba31b429b2b73232b91d103337b93134b23232b760511b604482015290519081900360640190fd5b61041084848484610580565b50505050565b6000546001600160a01b0316331461046d576040805162461bcd60e51b815260206004820152601560248201527423b7bb32b93730b136329d103337b93134b23232b760591b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146104ef576040805162461bcd60e51b815260206004820152601560248201527423b7bb32b93730b136329d103337b93134b23232b760591b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526001602052604090205460ff1661056e576040805162461bcd60e51b81526020600482015260166024820152752130ba31b429b2b73232b91d103337b93134b23232b760511b604482015290519081900360640190fd5b61057b8383836000610580565b505050565b60005b835181101561064e57600084828151811061059a57fe5b6020026020010151905060008483815181106105b257fe5b602090810291909101810151604080516323b872dd60e01b81523360048201526001600160a01b038681166024830152604482018490529151929450908a16926323b872dd926064808401938290030181600087803b15801561061457600080fd5b505af1158015610628573d6000803e3d6000fd5b505050506040513d602081101561063e57600080fd5b5050600190920191506105839050565b50836001600160a01b0316817fa1552778fd4edc5098fd82f614c100bf0f42c781e7926907643e2894679da0f38585604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106c15781810151838201526020016106a9565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156107005781810151838201526020016106e8565b5050505090500194505050505060405180910390a35050505056fea2646970667358221220c3a1bef83909e21b938e20a1a68b74d24ff4f562b4ffeddb452d8c3832caba5d64736f6c634300060c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100625760003560e01c806312d43a511461006757806346ea87af1461008b578063745ae40b146100c55780639cb7de4b146101fc578063cfad57a21461022a578063f8129cd214610250575b600080fd5b61006f610383565b604080516001600160a01b039092168252519081900360200190f35b6100b1600480360360208110156100a157600080fd5b50356001600160a01b0316610392565b604080519115158252519081900360200190f35b6101fa600480360360808110156100db57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561010557600080fd5b82018360208201111561011757600080fd5b803590602001918460208302840111600160201b8311171561013857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561018757600080fd5b82018360208201111561019957600080fd5b803590602001918460208302840111600160201b831117156101ba57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050913592506103a7915050565b005b6101fa6004803603604081101561021257600080fd5b506001600160a01b0381351690602001351515610416565b6101fa6004803603602081101561024057600080fd5b50356001600160a01b0316610498565b6101fa6004803603606081101561026657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561029057600080fd5b8201836020820111156102a257600080fd5b803590602001918460208302840111600160201b831117156102c357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561031257600080fd5b82018360208201111561032457600080fd5b803590602001918460208302840111600160201b8311171561034557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610511945050505050565b6000546001600160a01b031681565b60016020526000908152604090205460ff1681565b3360009081526001602052604090205460ff16610404576040805162461bcd60e51b81526020600482015260166024820152752130ba31b429b2b73232b91d103337b93134b23232b760511b604482015290519081900360640190fd5b61041084848484610580565b50505050565b6000546001600160a01b0316331461046d576040805162461bcd60e51b815260206004820152601560248201527423b7bb32b93730b136329d103337b93134b23232b760591b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146104ef576040805162461bcd60e51b815260206004820152601560248201527423b7bb32b93730b136329d103337b93134b23232b760591b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526001602052604090205460ff1661056e576040805162461bcd60e51b81526020600482015260166024820152752130ba31b429b2b73232b91d103337b93134b23232b760511b604482015290519081900360640190fd5b61057b8383836000610580565b505050565b60005b835181101561064e57600084828151811061059a57fe5b6020026020010151905060008483815181106105b257fe5b602090810291909101810151604080516323b872dd60e01b81523360048201526001600160a01b038681166024830152604482018490529151929450908a16926323b872dd926064808401938290030181600087803b15801561061457600080fd5b505af1158015610628573d6000803e3d6000fd5b505050506040513d602081101561063e57600080fd5b5050600190920191506105839050565b50836001600160a01b0316817fa1552778fd4edc5098fd82f614c100bf0f42c781e7926907643e2894679da0f38585604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106c15781810151838201526020016106a9565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156107005781810151838201526020016106e8565b5050505090500194505050505060405180910390a35050505056fea2646970667358221220c3a1bef83909e21b938e20a1a68b74d24ff4f562b4ffeddb452d8c3832caba5d64736f6c634300060c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.