Skip to content

Commit

Permalink
improve(Relayer): Don't include log about outstanding xchain txfers i…
Browse files Browse the repository at this point in the history
…f there are 0 txfers (#1944)

* improve(Relayer): Don't include log about outstanding xchain txfers if there are 0 txfers

* Update Relayer.ts
  • Loading branch information
nicholaspai authored Dec 10, 2024
1 parent e32d3de commit 452ed81
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/relayer/Relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
});
});
Expand Down

0 comments on commit 452ed81

Please sign in to comment.