When I send EOS in a contract to several recipients, it can happen that this fails, e.g. because a recipient has a contract running like that:

Example contract of one recipient:

void deposit(name from, name to, eosio::asset quantity, std::string memo){
  if (from == get_self() || to != get_self()){

Withdraw function in my contract:

void withdrawall(std::list<transaction> trans)
  for(auto& tr : trans)
      permission_level{ get_self(), "active"_n},
      std::make_tuple(get_self(), tr.to, tr.funds, std::string(""))

Because one transaction cannot be executed, all transactions fail. Is there a way to catch such failures in the contract and execute alternative code?

  • Hm, the only thing I can think of is instead of an sending an action per item in your list, sending a deferred tx per item in your list. Maybe batches of tx wrapped in deffered tx. But that approach would be slower and consume much more CPU.
    – cmadh
    Commented Sep 24, 2019 at 1:16
  • This is not a pleasant way to go, but if there is no alternative I will use it. Thanks for the tip.
    – elpol
    Commented Sep 24, 2019 at 22:48


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.