From ad98a3cb2157fbd1dc0f656a516ee908bc160433 Mon Sep 17 00:00:00 2001 From: Mark Grothe Date: Mon, 29 Jul 2024 15:16:49 -0500 Subject: [PATCH] fix: default emode [skip cypress] (#2124) --- src/store/poolSelectors.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/store/poolSelectors.ts b/src/store/poolSelectors.ts index 0fe31c465c..f5ee65f95a 100644 --- a/src/store/poolSelectors.ts +++ b/src/store/poolSelectors.ts @@ -66,5 +66,19 @@ export const formatEmodes = (reserves: ReserveDataHumanized[]) => { return acc; }, {} as Record); + // If all reserves have an eMode cateogry other than 0, we need to add the default empty one. + // The UI assumes that there is always an eMode category 0, which is 'none'. + if (!eModes[0]) { + eModes[0] = { + liquidationBonus: 0, + id: 0, + label: '', + liquidationThreshold: 0, + ltv: 0, + priceSource: '0x0000000000000000000000000000000000000000', + assets: [], + }; + } + return eModes; };