BatchSender

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/EIP7702Delegate.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title BatchSender
 * @dev A contract that allows batch sending of ETH to multiple recipients
 * @notice This contract enables gas-efficient batch transfers of ETH
 */
contract BatchSender {
    /**
     * @dev Emitted when a batch transfer is executed
     * @param sender The address that initiated the batch transfer
     * @param recipients Array of recipient addresses
     * @param amounts Array of amounts sent to each recipient
     * @param totalAmount Total amount of ETH transferred
     */
    event BatchTransfer(
        address indexed sender,
        address[] recipients,
        uint256[] amounts,
        uint256 totalAmount
    );

    /**
     * @dev Sends ETH to multiple recipients in a single transaction
     * @param recipients Array of recipient addresses
     * @param amounts Array of amounts to send to each recipient (in wei)
     * @notice The msg.value must equal the sum of all amounts
     * @notice Arrays must have the same length
     */
    function batchSendETH(
        address[] calldata recipients,
        uint256[] calldata amounts
    ) external payable {
        require(recipients.length > 0, "BatchSender: No recipients");
        require(recipients.length == amounts.length, "BatchSender: Array length mismatch");

        uint256 totalAmount = 0;

        // Calculate total amount and validate
        for (uint256 i = 0; i < amounts.length; i++) {
            require(amounts[i] > 0, "BatchSender: Amount must be greater than 0");
            totalAmount += amounts[i];
        }

        require(msg.value == totalAmount, "BatchSender: Incorrect ETH amount");

        // Execute transfers
        for (uint256 i = 0; i < recipients.length; i++) {
            require(recipients[i] != address(0), "BatchSender: Invalid recipient address");
            require(recipients[i] != address(this), "BatchSender: Cannot send to contract");

            (bool success, ) = recipients[i].call{value: amounts[i]}("");
            require(success, "BatchSender: Transfer failed");
        }

        emit BatchTransfer(msg.sender, recipients, amounts, totalAmount);
    }

    /**
     * @dev Allows the contract to receive ETH
     */
    receive() external payable {}

    /**
     * @dev Fallback function to receive ETH
     */
    fallback() external payable {}
}
"
    }
  },
  "settings": {
    "remappings": [
      "@balancer-labs/v3-interfaces/=lib/balancer-v3-monorepo/pkg/interfaces/",
      "@balancer-labs/v3-vault/=lib/balancer-v3-monorepo/pkg/vault/",
      "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
      "permit2/=lib/permit2/",
      "@ensdomains/=node_modules/@ensdomains/",
      "@ethereum-waffle/=node_modules/@ethereum-waffle/",
      "balancer-v3-monorepo/=lib/balancer-v3-monorepo/",
      "ds-test/=lib/forge-std/lib/ds-test/src/",
      "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
      "eth-gas-reporter/=node_modules/eth-gas-reporter/",
      "forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/",
      "forge-std/=lib/forge-std/src/",
      "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
      "hardhat/=node_modules/hardhat/",
      "openzeppelin-contracts/=lib/openzeppelin-contracts/",
      "solmate/=lib/permit2/lib/solmate/"
    ],
    "optimizer": {
      "enabled": true,
      "runs": 999999
    },
    "metadata": {
      "useLiteralContent": false,
      "bytecodeHash": "ipfs",
      "appendCBOR": true
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "shanghai",
    "viaIR": false
  }
}}

Tags:
Factory|addr:0x9bf21550eb82b712c8cb09fe7d37abafdee376fa|verified:true|block:23518328|tx:0x8b20c69ca26fe9f4cd591e26593e8885cf249120f16ff2573bd7345f7867be42|first_check:1759749124

Submitted on: 2025-10-06 13:12:05

Comments

Log in to comment.

No comments yet.