I understand there are many approaches to do multisend but for me timing is a priority and I do not want to stop the transaction if a address.send fails.

   function multiSend() internal isAdmin {
     for (uint initial = iter; iter < initial + 100 && iter < sendList.length; iter++) {
         if(!sendList[iter].send(valueMap[sendList[iter]])) {}
     }
   }

addresses in the sendLinst need to be sent ether mapped to them in valueMap.

iter is set to 0 initially, so the first time above function is called the first 100 (or length of array) addresses will be sent their mapped amounts. The nest time above function is called the next 100 addressed are paid and so on.

changes to sendList and valueMap are locked at this point and iter is not manipulated anywhere else. The function still does its job when the address reverts or runs out of gas.

this it what that looks like

enter image description here

I know I have ignored a bunch of security recommendations with this but are there any obvious security concerns with this approach ?

  • What is the purpose of the if statement? Why isn't the line just sendList[iter].send(...)? – smarx Nov 8 at 20:32
  • This code seems mostly okay, if it's really your intention to just silently ignore failures. – smarx Nov 8 at 20:32
  • the transaction fails entirely unless the send failure is handled. – praneeth mendu Nov 9 at 8:54
  • 1
    That's incorrect. – smarx Nov 9 at 15:51
  • 1
    Extraordinary claims require extraordinary proof. Provide a full runnable example that exhibits the problem. I'm nor going to spend time doing that. – smarx Nov 10 at 16:23

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.