Created
June 12, 2024 12:48
-
-
Save parv3213/9eadbb0a285326c79511a60069ea72aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract BulkSender { | |
// This function sends specified amounts of ETH to multiple addresses. | |
function sendETH(address[] memory recipients, uint256 value) public payable { | |
// Send ETH to each recipient | |
for (uint256 i = 0; i < recipients.length; i++) { | |
(bool sent, ) = recipients[i].call{value: value}(""); | |
require(sent, "Failed to send ETH"); | |
} | |
} | |
// Fallback function to accept ETH sent to the contract | |
receive() external payable {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Polygon: 0x963323B5e8913c19e1095548Cc0ad42dbFcE0089