/** * @Route("/{round}/transactions", name="wallet_transactions", requirements={"round": "\d+"}) * @Template() */ public function walletTransactionsListAction($round = null) { $round = $round ? $this->roundRepo->find($round) : $this->roundRepo->findCurrent(); $result = $this->manager->rawRequest('listtransactions', [$round->getWalletAccount(), 999999]); // we need to decode and encode to get pretty formated result $result = json_encode(json_decode($result), JSON_PRETTY_PRINT); return new Response('<pre>' . $result . '</pre>'); }
/** * @Route("/", name="admin") * @Template() */ public function adminAction(Request $request) { $this->checkIp($request); if (!($currentRound = $this->roundRepo->findOneBy(['started' => true, 'finished' => false]))) { return $this->redirect($this->generateUrl('admin_round')); } if ($this->manager->getInfo()->getUnlockedUntil() === null) { $walletStatus = 'Not encrypted'; } elseif ($this->manager->getInfo()->getUnlockedUntil() === 0) { $walletStatus = 'Locked'; } elseif ($this->manager->getInfo()->getUnlockedUntil() > 0) { $walletStatus = 'UnpLocked'; } else { $walletStatus = 'Unknown'; } return $this->render('AppBundle:Admin:admin.html.twig', ['currentRound' => $currentRound, 'walletStatus' => $walletStatus]); }
/** * @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; }