Beispiel #1
0
 /**
  * @param Payout[] $payouts
  * @return PayoutTx the tx out
  */
 public function sendPayouts(array $payouts)
 {
     $amounts = [];
     foreach ($payouts as $payout) {
         if (!isset($amounts[$payout->getAccount()->getWithdrawAddress()])) {
             $amounts[$payout->getAccount()->getWithdrawAddress()] = 0;
         }
         $amounts[$payout->getAccount()->getWithdrawAddress()] += $payout->getAmount();
     }
     $tx = $this->manager->sendMany($this->round->getWalletAccount(), $amounts);
     $walletTx = $this->manager->getTransaction($tx);
     $tx = new PayoutTx();
     $tx->setTxFee($walletTx->getFee());
     $tx->setTxOut($walletTx->getTxId());
     $this->em->persist($tx);
     $this->em->flush();
     return $tx;
 }