Skip to content

Commit

Permalink
Merge branch 'improve-calculator-logs' into 'dev'
Browse files Browse the repository at this point in the history
improve logs

Closes #529

See merge request ergo/rosen-bridge/ui!440
  • Loading branch information
vorujack committed Jan 29, 2025
2 parents 9738fe1 + bdd526e commit d1f3c09
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-llamas-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rosen-ui/asset-calculator': patch
---

Improve base calculator logs
15 changes: 9 additions & 6 deletions packages/asset-calculator/lib/asset-calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ class AssetCalculator {
) as Network[];

for (const nativeResidentToken of nativeResidentTokens) {
this.logger.info(
`Started calculating values for ${nativeResidentToken.name} native on chain ${residencyChain}`,
);
const newToken = {
id: nativeResidentToken[chainIdKey],
decimal: nativeResidentToken.decimals,
Expand Down Expand Up @@ -269,7 +272,7 @@ class AssetCalculator {
address: newLockedAsset.address,
});
this.logger.info(
`Updated asset [${nativeResidentToken[chainIdKey]}] total locked amount to [${lockedItem.amount}]`,
`Updated asset [${nativeResidentToken[chainIdKey]}] locked amount to [${lockedItem.amount}] for address [${lockedItem.address}]`,
);
this.logger.debug(
`Updated asset details for [${JsonBigInt.stringify(
Expand All @@ -287,11 +290,11 @@ class AssetCalculator {
residencyChain,
);
this.logger.debug(
`Asset [${nativeResidentToken[chainIdKey]}] total emitted amount is [${emission}]`,
`Asset [${nativeResidentToken[chainIdKey]}] emitted amount on chain ${chain} is [${emission}]`,
);
if (!emission) {
this.logger.debug(
`Total emitted amount of asset ${nativeResidentToken.name} on ${chain} is zero. skipping bridged asset update.`,
`Emitted amount of asset ${nativeResidentToken.name} on ${chain} is zero. skipping bridged asset update.`,
);
continue;
}
Expand All @@ -317,17 +320,17 @@ class AssetCalculator {
chain: newBridgedAsset.chain,
});
this.logger.info(
`Updated asset [${nativeResidentToken[chainIdKey]}] total locked amount to [${emission}]`,
`Updated asset [${nativeResidentToken[chainIdKey]}] bridged amount on chain ${chain} to [${emission}]`,
);
this.logger.debug(
`Updated asset details for [${JsonBigInt.stringify(
`Updated bridged asset details for [${JsonBigInt.stringify(
newBridgedAsset,
)}]`,
);
}
} catch (e) {
this.logger.warn(
`Skipping asset [${nativeResidentToken[chainIdKey]}] locked amount update, error: [${e}]`,
`Skipping asset [${nativeResidentToken[chainIdKey]}] bridged amount update, error: [${e}]`,
);
if (e instanceof Error && e.stack)
this.logger.debug(`Error stack trace: [${e.stack}]`);
Expand Down

0 comments on commit d1f3c09

Please sign in to comment.