Skip to content

Commit

Permalink
Update/token balance log ethers error (#3585)
Browse files Browse the repository at this point in the history
* log network and contract address on ethers error in token-balance EA

* add changeset
  • Loading branch information
mmcallister-cll authored Nov 25, 2024
1 parent c033089 commit 46b9d57
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-peas-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/token-balance-adapter': patch
---

log descriptive error if ethers call fails
14 changes: 12 additions & 2 deletions packages/sources/token-balance/src/transport/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ export class ERC20TokenBalanceTransport extends SubscriptionTransport<BaseEndpoi
walletAddress: wallet,
balance: String(iface.decodeFunctionResult(balanceOfSignature, result)[0]),
decimals,
})),
}))
.catch((err) => {
logger.error(
`caught balanceOf error on ${network}, contract: ${contractAddress}, wallet ${wallet}`,
)
throw err
}),
)
}
}
Expand Down Expand Up @@ -203,7 +209,11 @@ export class ERC20TokenBalanceTransport extends SubscriptionTransport<BaseEndpoi
network,
contractAddress,
decimals: Number(iface.decodeFunctionResult(decimalsSignature, result)[0]),
})),
}))
.catch((err) => {
logger.error(`caught decimals error on ${network}, contract: ${contractAddress}`)
throw err
}),
)
}

Expand Down

0 comments on commit 46b9d57

Please sign in to comment.