From 34be99cdf8e82cb2023e3b2e440b0b20fcb058aa Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:54:23 +0100 Subject: [PATCH] fix: handle empty erc4626Tokens array f --- .changeset/strange-dolphins-talk.md | 5 +++++ modules/sources/contracts/v3/fetch-unwrap-rates.ts | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/strange-dolphins-talk.md diff --git a/.changeset/strange-dolphins-talk.md b/.changeset/strange-dolphins-talk.md new file mode 100644 index 00000000..df3d8d36 --- /dev/null +++ b/.changeset/strange-dolphins-talk.md @@ -0,0 +1,5 @@ +--- +'backend': patch +--- + +fix: handle empty erc4626Tokens array diff --git a/modules/sources/contracts/v3/fetch-unwrap-rates.ts b/modules/sources/contracts/v3/fetch-unwrap-rates.ts index 0454e6c2..d7d2d282 100644 --- a/modules/sources/contracts/v3/fetch-unwrap-rates.ts +++ b/modules/sources/contracts/v3/fetch-unwrap-rates.ts @@ -14,6 +14,9 @@ export const fetchUnwrapRates = async ( ): Promise<{ [id: string]: string; }> => { + if (erc4626Tokens.length === 0) { + return {}; + } const chain = erc4626Tokens[0].chain; const caller = new Multicaller3Viem(chain, MinimalErc4626Abi); erc4626Tokens.forEach((token) =>