Skip to content

Commit

Permalink
fix(Monitor): Be robust to whacky output tokens (#1503)
Browse files Browse the repository at this point in the history
Dong-Ha identified that a deposit on Arbitrum incorrectly used the
Arbitrum USDC.e address as the outputToken for a fill on Arbitrum. In
case the outputToken can't be resolved, fall back to using the address
and log the raw amount.
  • Loading branch information
pxrl authored May 10, 2024
1 parent 1a171d3 commit ee28415
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/monitor/Monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,18 @@ export class Monitor {
const chainId = parseInt(chainIdStr);
mrkdwn += `*Destination: ${getNetworkName(chainId)}*\n`;
for (const tokenAddress of Object.keys(amountByToken)) {
const { symbol, decimals } = this.clients.hubPoolClient.getTokenInfoForAddress(tokenAddress, chainId);
let symbol: string;
let unfilledAmount: string;
try {
let decimals: number;
({ symbol, decimals } = this.clients.hubPoolClient.getTokenInfoForAddress(tokenAddress, chainId));
unfilledAmount = convertFromWei(amountByToken[tokenAddress].toString(), decimals);
} catch {
symbol = tokenAddress; // Using the address helps investigation.
unfilledAmount = amountByToken[tokenAddress].toString();
}

// Convert to number of tokens for readability.
const unfilledAmount = convertFromWei(amountByToken[tokenAddress].toString(), decimals);
mrkdwn += `${symbol}: ${unfilledAmount}\n`;
}
}
Expand Down

0 comments on commit ee28415

Please sign in to comment.