Contract Address Details

0x0eC0ABCe47484B64B44d87754c211970Ce6a4611

Contract Name
BatchTransfer
Creator
0x10a53b–5b9c74 at 0xd7f70e–36c351
Balance
0 VSC
Tokens
Fetching tokens...
Transactions
552,587 Transactions
Transfers
0 Transfers
Gas Used
166,286,245,925
Last Balance Update
13265448
Contract name:
BatchTransfer




Optimization enabled
false
Compiler version
v0.8.19+commit.7dd6d404




EVM Version
default




Verified at
2023-04-14T08:11:28.906850Z

Contract source code

// SPDX-License-Identifier: MIT

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


pragma solidity ^0.8.0;


contract BatchTransfer {
    function batchSend(address payable[] memory recipients, uint256[] memory amounts) public payable {
        require(recipients.length == amounts.length, "Arrays must have the same length");
        
        uint256 total = 0;
        for (uint256 i = 0; i < amounts.length; i++) {
            total += amounts[i];
        }
        
        require(msg.value >= total, "Insufficient value sent");
        
        for (uint256 i = 0; i < recipients.length; i++) {
            recipients[i].transfer(amounts[i]);
        }

        uint256 balance = address(this).balance;
        if (balance > 0)
            payable(msg.sender).transfer(balance);
    }

    function batchSendERC20(address tokenAddress, address[] memory recipients, uint256[] memory amounts) public {
        require(recipients.length == amounts.length, "Arrays must have the same length");
        
        IERC20 token = IERC20(tokenAddress);
        
        for (uint256 i = 0; i < recipients.length; i++) {
            require(token.transferFrom(msg.sender, recipients[i], amounts[i]), "Transfer failed");
        }

        uint256 remainingBalance = token.balanceOf(address(this));

        require(remainingBalance > 0, "No remaining ERC20 balance to withdraw");
        require(token.transfer(msg.sender, remainingBalance), "ERC20 withdrawal failed");
    }
}
        

Contract ABI

[{"type":"function","stateMutability":"payable","outputs":[],"name":"batchSend","inputs":[{"type":"address[]","name":"recipients","internalType":"address payable[]"},{"type":"uint256[]","name":"amounts","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchSendERC20","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"address[]","name":"recipients","internalType":"address[]"},{"type":"uint256[]","name":"amounts","internalType":"uint256[]"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50610e86806100206000396000f3fe6080604052600436106100295760003560e01c806310a7319c1461002e5780637a53bcfc14610057575b600080fd5b34801561003a57600080fd5b50610055600480360381019061005091906107df565b610073565b005b610071600480360381019061006c919061096b565b610354565b005b80518251146100b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ae90610a40565b60405180910390fd5b600083905060005b83518110156101ce578173ffffffffffffffffffffffffffffffffffffffff166323b872dd338684815181106100f8576100f7610a60565b5b602002602001015186858151811061011357610112610a60565b5b60200260200101516040518463ffffffff1660e01b815260040161013993929190610aad565b6020604051808303816000875af1158015610158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017c9190610b1c565b6101bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101b290610b95565b60405180910390fd5b80806101c690610be4565b9150506100bf565b5060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161020a9190610c2c565b602060405180830381865afa158015610227573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024b9190610c5c565b905060008111610290576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028790610cfb565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016102cb929190610d1b565b6020604051808303816000875af11580156102ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030e9190610b1c565b61034d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161034490610d90565b60405180910390fd5b5050505050565b8051825114610398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038f90610a40565b60405180910390fd5b6000805b82518110156103e0578281815181106103b8576103b7610a60565b5b6020026020010151826103cb9190610db0565b915080806103d890610be4565b91505061039c565b5080341015610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90610e30565b60405180910390fd5b60005b83518110156104be5783818151811061044357610442610a60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff166108fc84838151811061047757610476610a60565b5b60200260200101519081150290604051600060405180830381858888f193505050501580156104aa573d6000803e3d6000fd5b5080806104b690610be4565b915050610427565b5060004790506000811115610515573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610513573d6000803e3d6000fd5b505b50505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061055a8261052f565b9050919050565b61056a8161054f565b811461057557600080fd5b50565b60008135905061058781610561565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105db82610592565b810181811067ffffffffffffffff821117156105fa576105f96105a3565b5b80604052505050565b600061060d61051b565b905061061982826105d2565b919050565b600067ffffffffffffffff821115610639576106386105a3565b5b602082029050602081019050919050565b600080fd5b600061066261065d8461061e565b610603565b905080838252602082019050602084028301858111156106855761068461064a565b5b835b818110156106ae578061069a8882610578565b845260208401935050602081019050610687565b5050509392505050565b600082601f8301126106cd576106cc61058d565b5b81356106dd84826020860161064f565b91505092915050565b600067ffffffffffffffff821115610701576107006105a3565b5b602082029050602081019050919050565b6000819050919050565b61072581610712565b811461073057600080fd5b50565b6000813590506107428161071c565b92915050565b600061075b610756846106e6565b610603565b9050808382526020820190506020840283018581111561077e5761077d61064a565b5b835b818110156107a757806107938882610733565b845260208401935050602081019050610780565b5050509392505050565b600082601f8301126107c6576107c561058d565b5b81356107d6848260208601610748565b91505092915050565b6000806000606084860312156107f8576107f7610525565b5b600061080686828701610578565b935050602084013567ffffffffffffffff8111156108275761082661052a565b5b610833868287016106b8565b925050604084013567ffffffffffffffff8111156108545761085361052a565b5b610860868287016107b1565b9150509250925092565b600067ffffffffffffffff821115610885576108846105a3565b5b602082029050602081019050919050565b60006108a18261052f565b9050919050565b6108b181610896565b81146108bc57600080fd5b50565b6000813590506108ce816108a8565b92915050565b60006108e76108e28461086a565b610603565b9050808382526020820190506020840283018581111561090a5761090961064a565b5b835b81811015610933578061091f88826108bf565b84526020840193505060208101905061090c565b5050509392505050565b600082601f8301126109525761095161058d565b5b81356109628482602086016108d4565b91505092915050565b6000806040838503121561098257610981610525565b5b600083013567ffffffffffffffff8111156109a05761099f61052a565b5b6109ac8582860161093d565b925050602083013567ffffffffffffffff8111156109cd576109cc61052a565b5b6109d9858286016107b1565b9150509250929050565b600082825260208201905092915050565b7f417272617973206d7573742068617665207468652073616d65206c656e677468600082015250565b6000610a2a6020836109e3565b9150610a35826109f4565b602082019050919050565b60006020820190508181036000830152610a5981610a1d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610a988161054f565b82525050565b610aa781610712565b82525050565b6000606082019050610ac26000830186610a8f565b610acf6020830185610a8f565b610adc6040830184610a9e565b949350505050565b60008115159050919050565b610af981610ae4565b8114610b0457600080fd5b50565b600081519050610b1681610af0565b92915050565b600060208284031215610b3257610b31610525565b5b6000610b4084828501610b07565b91505092915050565b7f5472616e73666572206661696c65640000000000000000000000000000000000600082015250565b6000610b7f600f836109e3565b9150610b8a82610b49565b602082019050919050565b60006020820190508181036000830152610bae81610b72565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610bef82610712565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610c2157610c20610bb5565b5b600182019050919050565b6000602082019050610c416000830184610a8f565b92915050565b600081519050610c568161071c565b92915050565b600060208284031215610c7257610c71610525565b5b6000610c8084828501610c47565b91505092915050565b7f4e6f2072656d61696e696e672045524332302062616c616e636520746f20776960008201527f7468647261770000000000000000000000000000000000000000000000000000602082015250565b6000610ce56026836109e3565b9150610cf082610c89565b604082019050919050565b60006020820190508181036000830152610d1481610cd8565b9050919050565b6000604082019050610d306000830185610a8f565b610d3d6020830184610a9e565b9392505050565b7f4552433230207769746864726177616c206661696c6564000000000000000000600082015250565b6000610d7a6017836109e3565b9150610d8582610d44565b602082019050919050565b60006020820190508181036000830152610da981610d6d565b9050919050565b6000610dbb82610712565b9150610dc683610712565b9250828201905080821115610dde57610ddd610bb5565b5b92915050565b7f496e73756666696369656e742076616c75652073656e74000000000000000000600082015250565b6000610e1a6017836109e3565b9150610e2582610de4565b602082019050919050565b60006020820190508181036000830152610e4981610e0d565b905091905056fea264697066735822122027fa729343e55888d9760ea451a658647dca1ca68e49ef2823a622b44847001364736f6c63430008130033

Deployed ByteCode

0x6080604052600436106100295760003560e01c806310a7319c1461002e5780637a53bcfc14610057575b600080fd5b34801561003a57600080fd5b50610055600480360381019061005091906107df565b610073565b005b610071600480360381019061006c919061096b565b610354565b005b80518251146100b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100ae90610a40565b60405180910390fd5b600083905060005b83518110156101ce578173ffffffffffffffffffffffffffffffffffffffff166323b872dd338684815181106100f8576100f7610a60565b5b602002602001015186858151811061011357610112610a60565b5b60200260200101516040518463ffffffff1660e01b815260040161013993929190610aad565b6020604051808303816000875af1158015610158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017c9190610b1c565b6101bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101b290610b95565b60405180910390fd5b80806101c690610be4565b9150506100bf565b5060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161020a9190610c2c565b602060405180830381865afa158015610227573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024b9190610c5c565b905060008111610290576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028790610cfb565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016102cb929190610d1b565b6020604051808303816000875af11580156102ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030e9190610b1c565b61034d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161034490610d90565b60405180910390fd5b5050505050565b8051825114610398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038f90610a40565b60405180910390fd5b6000805b82518110156103e0578281815181106103b8576103b7610a60565b5b6020026020010151826103cb9190610db0565b915080806103d890610be4565b91505061039c565b5080341015610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90610e30565b60405180910390fd5b60005b83518110156104be5783818151811061044357610442610a60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff166108fc84838151811061047757610476610a60565b5b60200260200101519081150290604051600060405180830381858888f193505050501580156104aa573d6000803e3d6000fd5b5080806104b690610be4565b915050610427565b5060004790506000811115610515573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610513573d6000803e3d6000fd5b505b50505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061055a8261052f565b9050919050565b61056a8161054f565b811461057557600080fd5b50565b60008135905061058781610561565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105db82610592565b810181811067ffffffffffffffff821117156105fa576105f96105a3565b5b80604052505050565b600061060d61051b565b905061061982826105d2565b919050565b600067ffffffffffffffff821115610639576106386105a3565b5b602082029050602081019050919050565b600080fd5b600061066261065d8461061e565b610603565b905080838252602082019050602084028301858111156106855761068461064a565b5b835b818110156106ae578061069a8882610578565b845260208401935050602081019050610687565b5050509392505050565b600082601f8301126106cd576106cc61058d565b5b81356106dd84826020860161064f565b91505092915050565b600067ffffffffffffffff821115610701576107006105a3565b5b602082029050602081019050919050565b6000819050919050565b61072581610712565b811461073057600080fd5b50565b6000813590506107428161071c565b92915050565b600061075b610756846106e6565b610603565b9050808382526020820190506020840283018581111561077e5761077d61064a565b5b835b818110156107a757806107938882610733565b845260208401935050602081019050610780565b5050509392505050565b600082601f8301126107c6576107c561058d565b5b81356107d6848260208601610748565b91505092915050565b6000806000606084860312156107f8576107f7610525565b5b600061080686828701610578565b935050602084013567ffffffffffffffff8111156108275761082661052a565b5b610833868287016106b8565b925050604084013567ffffffffffffffff8111156108545761085361052a565b5b610860868287016107b1565b9150509250925092565b600067ffffffffffffffff821115610885576108846105a3565b5b602082029050602081019050919050565b60006108a18261052f565b9050919050565b6108b181610896565b81146108bc57600080fd5b50565b6000813590506108ce816108a8565b92915050565b60006108e76108e28461086a565b610603565b9050808382526020820190506020840283018581111561090a5761090961064a565b5b835b81811015610933578061091f88826108bf565b84526020840193505060208101905061090c565b5050509392505050565b600082601f8301126109525761095161058d565b5b81356109628482602086016108d4565b91505092915050565b6000806040838503121561098257610981610525565b5b600083013567ffffffffffffffff8111156109a05761099f61052a565b5b6109ac8582860161093d565b925050602083013567ffffffffffffffff8111156109cd576109cc61052a565b5b6109d9858286016107b1565b9150509250929050565b600082825260208201905092915050565b7f417272617973206d7573742068617665207468652073616d65206c656e677468600082015250565b6000610a2a6020836109e3565b9150610a35826109f4565b602082019050919050565b60006020820190508181036000830152610a5981610a1d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610a988161054f565b82525050565b610aa781610712565b82525050565b6000606082019050610ac26000830186610a8f565b610acf6020830185610a8f565b610adc6040830184610a9e565b949350505050565b60008115159050919050565b610af981610ae4565b8114610b0457600080fd5b50565b600081519050610b1681610af0565b92915050565b600060208284031215610b3257610b31610525565b5b6000610b4084828501610b07565b91505092915050565b7f5472616e73666572206661696c65640000000000000000000000000000000000600082015250565b6000610b7f600f836109e3565b9150610b8a82610b49565b602082019050919050565b60006020820190508181036000830152610bae81610b72565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610bef82610712565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610c2157610c20610bb5565b5b600182019050919050565b6000602082019050610c416000830184610a8f565b92915050565b600081519050610c568161071c565b92915050565b600060208284031215610c7257610c71610525565b5b6000610c8084828501610c47565b91505092915050565b7f4e6f2072656d61696e696e672045524332302062616c616e636520746f20776960008201527f7468647261770000000000000000000000000000000000000000000000000000602082015250565b6000610ce56026836109e3565b9150610cf082610c89565b604082019050919050565b60006020820190508181036000830152610d1481610cd8565b9050919050565b6000604082019050610d306000830185610a8f565b610d3d6020830184610a9e565b9392505050565b7f4552433230207769746864726177616c206661696c6564000000000000000000600082015250565b6000610d7a6017836109e3565b9150610d8582610d44565b602082019050919050565b60006020820190508181036000830152610da981610d6d565b9050919050565b6000610dbb82610712565b9150610dc683610712565b9250828201905080821115610dde57610ddd610bb5565b5b92915050565b7f496e73756666696369656e742076616c75652073656e74000000000000000000600082015250565b6000610e1a6017836109e3565b9150610e2582610de4565b602082019050919050565b60006020820190508181036000830152610e4981610e0d565b905091905056fea264697066735822122027fa729343e55888d9760ea451a658647dca1ca68e49ef2823a622b44847001364736f6c63430008130033