The MultiTransfer
contract facilitates the distribution of ETH to multiple recipient addresses in a single transaction. The admin role has the capability to initiate these transfers. Should a transfer fail, the contract accumulates the failed amount and ensures its return to the admin.
The contract does not use any custom data structures like structs.
DEFAULT_ADMIN_ROLE
A public constant bytes32
access control role provided by OpenZeppelin's AccessControl
contract that identifies the admin of the contract.
constructor
Initializes the contract and assigns the DEFAULT_ADMIN_ROLE
to the address deploying the contract.
multiTransfer
multiTransfer(address payable[] memory recipients, uint256[] memory amounts)
external
This function accepts two arrays: recipient addresses and their corresponding ETH amounts. It attempts to transfer the specified ETH amounts to the provided addresses. If a transfer fails, the amount is accumulated for a refund to the admin.
withdraw
withdraw() external
Allows the admin to withdraw all accumulated ETH in the contract. Only callable by the admin.
receive (fallback function)
receive() external payable