From 452ed8138d863627157c32167e00cf08b8adff88 Mon Sep 17 00:00:00 2001 From: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Date: Tue, 10 Dec 2024 09:51:18 -0600 Subject: [PATCH] improve(Relayer): Don't include log about outstanding xchain txfers if there are 0 txfers (#1944) * improve(Relayer): Don't include log about outstanding xchain txfers if there are 0 txfers * Update Relayer.ts --- src/relayer/Relayer.ts | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/relayer/Relayer.ts b/src/relayer/Relayer.ts index fa2428dd9..3f992385e 100644 --- a/src/relayer/Relayer.ts +++ b/src/relayer/Relayer.ts @@ -1251,21 +1251,29 @@ export class Relayer { if (this.clients.inventoryClient.isInventoryManagementEnabled() && chainId !== hubChainId) { // Shortfalls are mapped to deposit output tokens so look up output token in token symbol map. const l1Token = this.clients.hubPoolClient.getL1TokenInfoForAddress(token, chainId); - crossChainLog = - "There is " + - formatter( - this.clients.inventoryClient.crossChainTransferClient - .getOutstandingCrossChainTransferAmount(this.relayerAddress, chainId, l1Token.address, token) - // TODO: Add in additional l2Token param here once we can specify it - .toString() - ) + - ` inbound L1->L2 ${symbol} transfers. `; + const outstandingCrossChainTransferAmount = + this.clients.inventoryClient.crossChainTransferClient.getOutstandingCrossChainTransferAmount( + this.relayerAddress, + chainId, + l1Token.address, + token + ); + crossChainLog = outstandingCrossChainTransferAmount.gt(0) + ? " There is " + + formatter( + this.clients.inventoryClient.crossChainTransferClient + .getOutstandingCrossChainTransferAmount(this.relayerAddress, chainId, l1Token.address, token) + // TODO: Add in additional l2Token param here once we can specify it + .toString() + ) + + ` inbound L1->L2 ${symbol} transfers. ` + : undefined; } mrkdwn += ` - ${symbol} cumulative shortfall of ` + `${formatter(shortfall.toString())} ` + `(have ${formatter(balance.toString())} but need ` + - `${formatter(needed.toString())}). ${crossChainLog}` + + `${formatter(needed.toString())}).${crossChainLog}` + `This is blocking deposits: ${deposits}.\n`; }); });