|
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract BatchTrans is Ownable {
function batchToken(address token, address[] memory toAddrs, uint256[] memory amounts) public {
require(Address.isContract(token), "BatchTrans: not a token");
require(toAddrs.length > 0, "BatchTrans: to addresses is empty");
require(toAddrs.length <= 100, "BatchTrans: to addresses more than 100");
require(toAddrs.length == amounts.length, "BatchTrans: amounts error");
for (uint256 i = 0 ; i < toAddrs.length ; i++) {
Address.functionCall(token, abi.encodeWithSelector(0x23b872dd, _msgSender(), toAddrs[i], amounts[i]));
}
}
function batchToken(address token, address[] memory toAddrs, uint256 amount) public {
require(Address.isContract(token), "BatchTrans: not a token");
require(toAddrs.length > 0, "BatchTrans: to addresses is empty");
require(toAddrs.length <= 100, "BatchTrans: to addresses more than 100");
for (uint256 i = 0 ; i < toAddrs.length ; i++) {
Address.functionCall(token, abi.encodeWithSelector(0x23b872dd, _msgSender(), toAddrs[i], amount));
}
}
}
|
|