Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/subdomains/supporting/log/log-job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,16 @@ export class LogJobService {
const cryptoInput = [Blockchain.MONERO, Blockchain.LIGHTNING, Blockchain.ZANO].includes(curr.blockchain)
? 0
: pendingPayIns.reduce((sum, tx) => sum + (tx.asset.id === curr.id ? tx.amount : 0), 0);
const exchangeOrder = pendingExchangeOrders.reduce(
(sum, tx) => sum + (tx.pipeline.rule.targetAsset.id === curr.id ? tx.inputAmount : 0),
0,
);
const exchangeOrder = pendingExchangeOrders.reduce((sum, tx) => {
if (tx.pipeline.rule.targetAsset.id !== curr.id) return sum;

// for transfer/deposit: only count when action.system matches the target asset's exchange
// (funds leaving this exchange, balance decreased). Skip when funds arrive from another
// exchange, as the destination balance already reflects those funds before order completion.
if (tx.action.command !== 'withdraw' && tx.action.system !== (curr.blockchain as string)) return sum;

return sum + tx.inputAmount;
}, 0);
const bridgeOrder = pendingBridgeOrders.reduce(
(sum, tx) => sum + (tx.pipeline.rule.targetAsset.id === curr.id ? tx.inputAmount : 0),
0,
Expand Down
Loading