Assume that we have two MultiSend function, one for ether and another for ERC20/ERC223 token respectively.
My question is what would happen if one or more of the address fail. Will all the transaction be reverted and stuck forever? eg: One of the ether is transfer to address of smart contract that reject incoming ether transfer().
To simplify, i think that it will be a success transfer for an address but not the case for a contract address.
If it is the case, wouldn't that the MultiSend() function will not be succeed forever? And what is the solution to it. Or it just ignore the fail transaction only.
The full code can be view here
function multiTransfer(address[] _addresses, uint[] _amounts)
payable public returns(bool)
{
uint toReturn = msg.value;
for (uint i = 0; i < _addresses.length; i++) {
_safeTransfer(_addresses[i], _amounts[i]);
toReturn = SafeMath.sub(toReturn, _amounts[i]);
MultiTransfer(msg.sender, msg.value, _addresses[i], _amounts[i]);
}
_safeTransfer(msg.sender, toReturn);
return true;
}
function multiERC20Transfer(
ERC20 _token,
address[] _addresses,
uint[] _amounts
) public {
for (uint i = 0; i < _addresses.length; i++) {
_safeERC20Transfer(_token, _addresses[i], _amounts[i]);
MultiERC20Transfer(
msg.sender,
msg.value,
_addresses[i],
_amounts[i],
_token
);
}