コード例 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->init();
     $this->output = $output;
     $this->input = $input;
     try {
         $lock = Lock::lock('scanner_' . $this->nameShort);
     } catch (UnableToLockException $e) {
         $this->writeln('Already running');
         return;
     }
     $this->writeln('Started wallet scanner ' . date('Y-m-d H:i:s'));
     if (!($this->round = $this->roundRepo->findOneBy(['started' => true, 'finished' => false]))) {
         $this->writeln('No running round');
         return;
     }
     $this->writeln('Creating new incoming transactions');
     if ($newTransactions = $this->walletManager->getNewIncomingTransactions()) {
         $this->writeln('Found ' . count($newTransactions) . ' new transactions');
         $this->depositManager->saveNewDeposits($newTransactions);
     } else {
         $this->writeln('No new transactions found');
     }
     $this->writeln('Updating deposits');
     $updated = $this->depositManager->updatePendingDeposits();
     $this->writeln('Updated/checked ' . $updated . ' deposits');
     $this->writeln('Realising payouts');
     $payouts = $this->payoutManager->realisePayouts();
     $this->writeln('Realised ' . count($payouts) . ' payouts');
     $this->writeln('Checking round end');
     $this->checkRoundEnd();
 }