Skip to content
Verified contractExactMIT

SendETH

Address0x34e08f0a362be117fbd0cf68aeb3a975ff11ed0d
Balance

0 ETH

 

Transactions

8

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
19,350,292
Creation transaction
0x60f209fc8a…7b23d9e537

contracts/MultiRecipientETHDistributionContract.sol

/*
@IMPORTANT The refund process is executed through the scope of the refund policy, which
can be found in the #refund-policy channel.
- This contract is designed to distribute  ETH to a list of recipients, each of them might receive a different amount.
- This contract is permission-less and owner-less.
*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SendETH {

    function batchSend(address[] memory users, uint256[] memory amounts) public payable {
        uint256 numberOfUsers = users.length;
        uint256 numberOfAmounts = amounts.length;

        require(numberOfUsers == numberOfAmounts, "Not equal array lengths");

        // if totalSent < msg.value we will revert below due to insufficient balance of ETH 
        bool success;
        uint256 amt;
        address recipient;
        uint256 totalSent;
        for(uint256 i; i < numberOfUsers; i++){
            amt = amounts[i];
            recipient = users[i];
            (success, ) = recipient.call{value: amt}("");
            require(success, "Failure in sending ETH");
            totalSent += amt;
        }

        uint256 change = msg.value - totalSent;
        if(change > 0){
            (success, ) = msg.sender.call{value: change}("");
            require(success, "Failure in sending ETH");
        }
    }

}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "paris",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.