RWMAirdrop

0xcbae845f9cb66f0ad13cbc73c3e8eed109ee0079

Verification
Verified
v0.8.26+commit.8a97fa7a
Type
Contract
864 bytes
ABI entries
7
1 read · 1 write
License
none

Contract information

Address
0xcbae845f9cb66f0ad13cbc73c3e8eed109ee0079
Chain
Robinhood Chain (4663)
Compiler
v0.8.26+commit.8a97fa7a
Optimization
Enabled
Creation tx
0xc1d6eb1742…d3bdb7b7a4

Token

Not a token

This contract does not expose ERC-20 metadata.

Read contract (1)

MAX_BATCH_SIZE()uint256

ABI

[
  {
    "inputs": [],
    "name": "InvalidBatchSize",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "LengthMismatch",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      }
    ],
    "name": "SafeERC20FailedOperation",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ZeroAddress",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ZeroAmount",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "MAX_BATCH_SIZE",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "contract IERC20",
        "name": "token",
        "type": "address"
      },
      {
        "internalType": "address[]",
        "name": "recipients",
        "type": "address[]"
      },
      {
        "internalType": "uint256[]",
        "name": "amounts",
        "type": "uint256[]"
      }
    ],
    "name": "batchTransfer",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

Source code

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @notice Distributes ERC-20 tokens from the caller to a bounded list of recipients.
contract RWMAirdrop {
    using SafeERC20 for IERC20;

    uint256 public constant MAX_BATCH_SIZE = 250;

    error InvalidBatchSize();
    error LengthMismatch();
    error ZeroAddress();
    error ZeroAmount();

    function batchTransfer(
        IERC20 token,
        address[] calldata recipients,
        uint256[] calldata amounts
    ) external {
        uint256 length = recipients.length;
        if (length == 0 || length > MAX_BATCH_SIZE) revert InvalidBatchSize();
        if (length != amounts.length) revert LengthMismatch();
        if (address(token) == address(0)) revert ZeroAddress();

        for (uint256 i; i < length; ++i) {
            address recipient = recipients[i];
            if (recipient == address(0)) revert ZeroAddress();

            uint256 amount = amounts[i];
            if (amount == 0) revert ZeroAmount();

            token.safeTransferFrom(msg.sender, recipient, amount);
        }
    }
}
Chain explorer1301msChain node76ms