@@ -52,25 +52,24 @@ static function processDepositTxId($service, $asset, $depositTxId, $block_height
5252 }
5353 $ offer = OfferService::getOfferByReceiveTx ($ depositTxId );
5454 if ($ offer ) {
55- _log ("Found offer {$ offer ['id ' ]} for deposit # {$ depositTxId }" );
5655 if ($ offer ['status ' ] != OfferService::STATUS_DEPOSITING ) {
57- _log (" offer # {$ offer ['id ' ]} status is {$ offer ['status ' ]}" );
56+ _log ($ asset [ ' symbol ' ]. " Offer # {$ offer ['id ' ]} status is {$ offer ['status ' ]} - not deposit status " );
5857 return ;
5958 }
6059 $ depositTx = $ service ->findTransaction ($ depositTxId );
6160 $ last_height = $ depositTx ['height ' ];
6261 if (!$ depositTx ) {
63- _log (" Transaction # {$ depositTxId } not found " );
62+ _log ($ asset [ ' symbol ' ]. " Offer # { $ offer [ ' id ' ]} Transaction {$ depositTxId } not found " );
6463 return ;
6564 }
6665 $ confirmations = $ block_height - $ last_height ;
6766 $ requiredConfirmations =$ service ->getConfirmations ('wait ' );
6867 if ($ confirmations <= $ requiredConfirmations ) {
69- _log (" Deposit # {$ depositTxId } waiting confirmations $ confirmations/ " .$ requiredConfirmations );
68+ _log ($ asset [ ' symbol ' ]. " Offer # { $ offer [ ' id ' ]} deposit {$ depositTxId } waiting confirmations $ confirmations/ " .$ requiredConfirmations );
7069 return ;
7170 }
7271 OfferService::setOfferOpen ($ offer ['id ' ]);
73- _log (" Deposit # {$ depositTxId } opened " );
72+ _log ($ asset [ ' symbol ' ]. " Offer # { $ offer [ ' id ' ]} Deposit # {$ depositTxId } - set status opened " );
7473 } else {
7574 _log ("Not found offer by deposit tx id {$ depositTxId }" );
7675 if ($ depositTxId == "0x07fbf96ce3b9e25ccfa09e2511c5e43be9c7f882cad09a51f09a12bdcd296aca " ) {
@@ -100,8 +99,8 @@ static function processDepositTxId($service, $asset, $depositTxId, $block_height
10099
101100 public static function checkExpiredAcceptedOffers ()
102101 {
103- _log ("Checking expired accepted offers " );
104102 $ expiredOffers = OfferService::getExpiredAcceoptedOffers ();
103+ _log ("Checking expired accepted offers count= " .count ($ expiredOffers ));
105104 foreach ($ expiredOffers as $ offer ) {
106105 $ accepted_at = strtotime ($ offer ['accepted_at ' ]);
107106 $ now = time ();
@@ -135,23 +134,22 @@ public static function checkAssetTransferring($asset)
135134 foreach ($ txIds as $ txId ) {
136135 $ offer = OfferService::getOffersByReceiveTxId ($ txId );
137136 if ($ offer ) {
138- _log ("Found offer # {$ offer ['id ' ]} for transfer transaction $ txId status: " .$ offer ['status ' ]);
139137 if (!($ offer ['status ' ]==OfferService::STATUS_TRANSFERRING && $ offer ['accept_tx_id ' ] == $ txId )) {
140- _log (" Not valid offer " );
138+ _log ($ asset [ ' symbol ' ] . " Offer # { $ offer[ ' id ' ]} status= { $ offer [ ' status ' ]} - not transferring " );
141139 continue ;
142140 }
143141 $ tx = $ service ->findTransaction ($ txId );
144142 if (!$ tx ) {
145- _log (" Transaction # {$ txId } not found " );
143+ _log ($ asset [ ' symbol ' ] . " Offer # { $ offer [ ' id ' ]} - Transaction # {$ txId } not found " );
146144 continue ;
147145 }
148146 $ confirmations = $ block_height - $ tx ['height ' ];
149147 $ requiredConfirmations = $ service ->getConfirmations ('transferring ' );
150148 if ($ confirmations <= $ requiredConfirmations ) {
151- _log (" Waiting confirmations $ confirmations / " . $ requiredConfirmations . " for offer transfer {$ offer ['id ' ]}" );
149+ _log ($ asset [ ' symbol ' ] . " Offer # {$ offer ['id ' ]} Waiting confirmations $ confirmations / " . $ requiredConfirmations );
152150 continue ;
153151 }
154- _log (" Set offer # {$ offer ['id ' ]} for transfer transaction $ txId completed " );
152+ _log ($ asset [ ' symbol ' ] . " Offer # {$ offer ['id ' ]} - set offer transferred " );
155153 OfferService::setAcceptedOfferTransferred ($ offer ['id ' ]);
156154 } else {
157155 $ tx = $ service ->findTransaction ($ txId );
@@ -247,7 +245,7 @@ public static function processPayingOffers()
247245 $ confirmations = $ block_height - $ tx ['height ' ];
248246 $ requiredConfirmations =$ baseService ->getConfirmations ('paying ' );
249247 if ($ confirmations <= $ requiredConfirmations ) {
250- _log ("Waiting confirmations $ confirmations / " .$ requiredConfirmations );
248+ _log ("Offer # " . $ offer [ ' id ' ]. " base= " . $ market [ ' base ' ]. " tx= " . $ offer [ ' base_transfer_tx_id ' ]. " Waiting confirmations $ confirmations / " .$ requiredConfirmations );
251249 continue ;
252250 }
253251 if (empty ($ offer ['quote_transfer_tx_id ' ])) {
@@ -264,9 +262,10 @@ public static function processPayingOffers()
264262 $ confirmations = $ block_height - $ tx ['height ' ];
265263 $ requiredConfirmations =$ baseService ->getConfirmations ('paying ' );
266264 if ($ confirmations <= $ requiredConfirmations ) {
267- _log ("Waiting confirmations $ confirmations / " .$ requiredConfirmations );
265+ _log ("Offer # " . $ offer [ ' id ' ]. " base= " . $ market [ ' quote ' ]. " tx= " . $ offer [ ' quote_transfer_tx_id ' ]. " Waiting confirmations $ confirmations / " .$ requiredConfirmations );
268266 continue ;
269267 }
268+ _log ("Offer # " .$ offer ['id ' ]." payments completed - closed " );
270269 OfferService::setOfferClosed ($ offer );
271270 }
272271 }
0 commit comments