From f511eb3162f66949d0fc52be1538a1ba7379c82a Mon Sep 17 00:00:00 2001 From: therealemjy Date: Wed, 10 Sep 2025 10:07:44 +0200 Subject: [PATCH 1/4] feat: add isBorrowable prop to Asset and EModeAssetSettings types --- apps/evm/src/__mocks__/models/asset.ts | 4 ++ apps/evm/src/__mocks__/models/eModeGroup.ts | 1 + .../__snapshots__/index.spec.tsx.snap | 1 + .../__snapshots__/index.spec.tsx.snap | 9 ++++ .../__snapshots__/index.eMode.spec.ts.snap | 39 +++++++++++++++++ .../__snapshots__/index.prime.spec.ts.snap | 42 +++++++++++++++++++ .../__snapshots__/index.spec.ts.snap | 42 +++++++++++++++++++ .../formatOutput/generateFakeEModeGroup.tsx | 4 ++ .../getPools/formatOutput/index.ts | 1 + .../Tabs/EMode/EModeGroup/Header/index.tsx | 14 +++---- .../src/pages/Vai/AccountVaiData/index.tsx | 1 + apps/evm/src/types/index.ts | 2 + 12 files changed, 153 insertions(+), 7 deletions(-) diff --git a/apps/evm/src/__mocks__/models/asset.ts b/apps/evm/src/__mocks__/models/asset.ts index c0d7e0ffb7..f84143d2a2 100644 --- a/apps/evm/src/__mocks__/models/asset.ts +++ b/apps/evm/src/__mocks__/models/asset.ts @@ -23,6 +23,7 @@ export const assetData: Asset[] = [ badDebtMantissa: 6789000000000000000n, supplierCount: 100, borrowerCount: 10, + isBorrowable: true, exchangeRateVTokens: new BigNumber(49.589181233), userWalletBalanceTokens: new BigNumber('100'), userWalletBalanceCents: new BigNumber('12786'), @@ -92,6 +93,7 @@ export const assetData: Asset[] = [ badDebtMantissa: 0n, supplierCount: 100, borrowerCount: 10, + isBorrowable: false, exchangeRateVTokens: new BigNumber(1), userWalletBalanceTokens: new BigNumber('0'), userWalletBalanceCents: new BigNumber('0'), @@ -179,6 +181,7 @@ export const assetData: Asset[] = [ badDebtMantissa: 0n, supplierCount: 100, borrowerCount: 10, + isBorrowable: true, exchangeRateVTokens: new BigNumber(0.981982), userWalletBalanceTokens: new BigNumber('900'), userWalletBalanceCents: new BigNumber('90000'), @@ -262,6 +265,7 @@ export const assetData: Asset[] = [ badDebtMantissa: 0n, supplierCount: 100, borrowerCount: 10, + isBorrowable: true, exchangeRateVTokens: new BigNumber(1.000003), userWalletBalanceTokens: new BigNumber('110'), userWalletBalanceCents: new BigNumber('11000'), diff --git a/apps/evm/src/__mocks__/models/eModeGroup.ts b/apps/evm/src/__mocks__/models/eModeGroup.ts index f7d6e41d91..c14e8f817b 100644 --- a/apps/evm/src/__mocks__/models/eModeGroup.ts +++ b/apps/evm/src/__mocks__/models/eModeGroup.ts @@ -17,6 +17,7 @@ const generateEModeGroup = ({ liquidationPenaltyPercentage: a.userLiquidationThresholdPercentage - 50, liquidityCents: a.liquidityCents.toNumber(), liquidityTokens: a.cashTokens, + isBorrowable: a.isBorrowable, })), }); diff --git a/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap b/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap index 173871b0ff..2dd218b1f7 100644 --- a/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap @@ -36,6 +36,7 @@ exports[`useGetAsset > returns the correct asset 1`] = ` "collateralFactor": 0.5, "disabledTokenActions": [], "exchangeRateVTokens": "49.589181233", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 50, "liquidityCents": "8036465875", diff --git a/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap b/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap index a5927ec5fd..828b102290 100644 --- a/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap @@ -38,6 +38,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` "collateralFactor": 0.5, "disabledTokenActions": [], "exchangeRateVTokens": "49.589181233", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 50, "liquidityCents": "8036465875", @@ -149,6 +150,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` "supply", ], "exchangeRateVTokens": "1", + "isBorrowable": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "1702951959", @@ -275,6 +277,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` "swapAndSupply", ], "exchangeRateVTokens": "0.981982", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "5534102886", @@ -393,6 +396,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` "supply", ], "exchangeRateVTokens": "1.000003", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "3654492935", @@ -482,6 +486,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` "assetSettings": [ { "collateralFactor": 0.6, + "isBorrowable": true, "liquidationPenaltyPercentage": 0, "liquidationThresholdPercentage": 62, "liquidityCents": 8036465875, @@ -500,6 +505,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` }, { "collateralFactor": 0.9, + "isBorrowable": false, "liquidationPenaltyPercentage": 30, "liquidationThresholdPercentage": 92, "liquidityCents": 1702951959, @@ -518,6 +524,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 30, "liquidationThresholdPercentage": 92, "liquidityCents": 5534102886, @@ -543,6 +550,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 30, "liquidationThresholdPercentage": 92, "liquidityCents": 5534102886, @@ -561,6 +569,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 30, "liquidationThresholdPercentage": 92, "liquidityCents": 3654492935, diff --git a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap index 2c565a3bfd..0073b873ef 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap +++ b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap @@ -22,6 +22,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "enterMarket", ], "exchangeRateVTokens": "49.19405324154271215086", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -92,6 +93,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -177,6 +179,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -248,6 +251,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.6, "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -318,6 +322,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -402,6 +407,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.81, "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -466,6 +472,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.1, + "isBorrowable": false, "liquidationPenaltyPercentage": -50, "liquidationThresholdPercentage": 12, "liquidityCents": 1.0000000008050355e+23, @@ -485,6 +492,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 0, @@ -505,6 +513,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 555.6233762724731, @@ -532,6 +541,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 555.6233762724731, @@ -570,6 +580,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.1, + "isBorrowable": false, "liquidationPenaltyPercentage": -50, "liquidationThresholdPercentage": 12, "liquidityCents": 1.0000000008050355e+23, @@ -589,6 +600,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 0, @@ -609,6 +621,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 555.6233762724731, @@ -650,6 +663,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -707,6 +721,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 264929173.1707, @@ -733,6 +748,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 264929173.1707, @@ -770,6 +786,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 264929173.1707, @@ -810,6 +827,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -852,6 +870,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 10116602.3761, @@ -895,6 +914,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 10116602.3761, @@ -935,6 +955,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -998,6 +1019,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.45, "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -1040,6 +1062,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1103100000, @@ -1059,6 +1082,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.55, + "isBorrowable": true, "liquidationPenaltyPercentage": -0.4999999999999929, "liquidationThresholdPercentage": 61.50000000000001, "liquidityCents": 0.0705300034659891, @@ -1102,6 +1126,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1103100000, @@ -1121,6 +1146,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.55, + "isBorrowable": true, "liquidationPenaltyPercentage": -0.4999999999999929, "liquidationThresholdPercentage": 61.50000000000001, "liquidityCents": 0.0705300034659891, @@ -1161,6 +1187,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.75, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -1203,6 +1230,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.85, + "isBorrowable": true, "liquidationPenaltyPercentage": 32.500000000000014, "liquidationThresholdPercentage": 94.50000000000001, "liquidityCents": 600600, @@ -1246,6 +1274,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.85, + "isBorrowable": true, "liquidationPenaltyPercentage": 32.500000000000014, "liquidationThresholdPercentage": 94.50000000000001, "liquidityCents": 600600, @@ -1300,6 +1329,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.65, "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -1362,6 +1392,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -1419,6 +1450,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.75, + "isBorrowable": true, "liquidationPenaltyPercentage": 21.5, "liquidationThresholdPercentage": 83.5, "liquidityCents": 3256964.033967793, @@ -1438,6 +1470,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 99817453.518, @@ -1481,6 +1514,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.75, + "isBorrowable": true, "liquidationPenaltyPercentage": 21.5, "liquidationThresholdPercentage": 83.5, "liquidityCents": 3256964.033967793, @@ -1500,6 +1534,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 99817453.518, @@ -1540,6 +1575,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -1582,6 +1618,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1000000, @@ -1608,6 +1645,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1000000, @@ -1645,6 +1683,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, + "isBorrowable": true, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1000000, diff --git a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap index cabdb6f6aa..d184f8b937 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap +++ b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap @@ -39,6 +39,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "enterMarket", ], "exchangeRateVTokens": "49.19405324154271215086", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -126,6 +127,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -211,6 +213,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -282,6 +285,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.6, "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -368,6 +372,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -484,6 +489,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.81, "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -583,6 +589,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -659,6 +666,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -737,6 +745,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -817,6 +826,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.45, "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -878,6 +888,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.75, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -953,6 +964,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.65, "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -1032,6 +1044,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -1142,6 +1155,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -1259,6 +1273,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "enterMarket", ], "exchangeRateVTokens": "49.19405324154271215086", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -1357,6 +1372,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -1442,6 +1458,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -1513,6 +1530,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.6, "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -1610,6 +1628,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -1748,6 +1767,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.81, "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -1858,6 +1878,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -1934,6 +1955,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -2023,6 +2045,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -2114,6 +2137,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.45, "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -2175,6 +2199,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.75, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -2250,6 +2275,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.65, "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -2340,6 +2366,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -2472,6 +2499,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -2584,6 +2612,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "enterMarket", ], "exchangeRateVTokens": "49.19405324154271215086", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -2666,6 +2695,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -2751,6 +2781,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -2822,6 +2853,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.6, "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -2903,6 +2935,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -3009,6 +3042,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.81, "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -3103,6 +3137,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -3179,6 +3214,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -3252,6 +3288,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -3327,6 +3364,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.45, "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -3388,6 +3426,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.75, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -3463,6 +3502,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.65, "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -3537,6 +3577,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -3637,6 +3678,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", diff --git a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap index ae100ac27a..4265efe23f 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap +++ b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap @@ -22,6 +22,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "enterMarket", ], "exchangeRateVTokens": "49.19405324154271215086", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -92,6 +93,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -177,6 +179,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -248,6 +251,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.6, "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -318,6 +322,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -402,6 +407,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.81, "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -485,6 +491,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -561,6 +568,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -622,6 +630,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -685,6 +694,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.45, "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -746,6 +756,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.75, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -821,6 +832,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.65, "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -883,6 +895,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -959,6 +972,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -1031,6 +1045,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "enterMarket", ], "exchangeRateVTokens": "49.19405324154271215086", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -1101,6 +1116,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -1186,6 +1202,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -1257,6 +1274,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.6, "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -1327,6 +1345,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -1411,6 +1430,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.81, "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -1494,6 +1514,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -1570,6 +1591,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -1631,6 +1653,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -1694,6 +1717,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.45, "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -1755,6 +1779,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.75, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -1830,6 +1855,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.65, "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -1892,6 +1918,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -1968,6 +1995,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -2040,6 +2068,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "enterMarket", ], "exchangeRateVTokens": "49.19405324154271215086", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -2110,6 +2139,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -2195,6 +2225,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -2266,6 +2297,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.6, "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -2336,6 +2368,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -2420,6 +2453,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.81, "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -2503,6 +2537,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -2579,6 +2614,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -2640,6 +2676,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -2703,6 +2740,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.45, "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -2764,6 +2802,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.75, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -2839,6 +2878,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.65, "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -2901,6 +2941,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", + "isBorrowable": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -2977,6 +3018,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "collateralFactor": 0.8, "disabledTokenActions": [], "exchangeRateVTokens": "1", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", diff --git a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx index f7986f0b8c..580ce44c4e 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx +++ b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx @@ -73,6 +73,10 @@ export const generateFakeEModeGroup = ({ liquidationPenaltyPercentage: liquidationThresholdPercentage - 50, liquidityCents: liquidityTokens.multipliedBy(100).toNumber(), liquidityTokens, + isBorrowable: + underlyingToken.symbol !== 'XVS' && + underlyingToken.symbol !== 'BTCB' && + underlyingToken.symbol !== 'BUSD', }; return [...acc, assetSettings]; diff --git a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts index a91af448cb..541b39bbb4 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts +++ b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts @@ -325,6 +325,7 @@ export const formatOutput = ({ userWalletBalanceCents, userCollateralFactor, userLiquidationThresholdPercentage, + isBorrowable: true, // TODO: get from API // This will be calculated after all assets have been formatted userPercentOfLimit: 0, isCollateralOfUser, diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx index 2e2a873c79..0223a1c3b0 100644 --- a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx +++ b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx @@ -24,9 +24,6 @@ export const Header: React.FC = ({ eModeGroup, pool, className }) = // TODO: wire up const enableEModeGroup = () => {}; - // TODO: calculate - const hypotheticalPoolUserHealthFactor = 8.4; - const poolUserHealthFactor = pool.userLiquidationThresholdCents && pool.userBorrowBalanceCents && @@ -37,11 +34,14 @@ export const Header: React.FC = ({ eModeGroup, pool, className }) = const isEModeGroupEnabled = pool.userEModeGroup && pool.userEModeGroup.id === eModeGroup.id; - // TODO: check user may enable group - const isUserEligible = true; // TODO: pass actual blocking assets const blockingAssets = pool.assets.slice(0, 3); + const isUserEligible = blockingAssets.length === 0; + + // TODO: calculate + const hypotheticalPoolUserHealthFactor = 8.4; + let buttonLabel = t('pool.eMode.group.enableButtonLabel'); if (isEModeGroupEnabled) { @@ -57,7 +57,7 @@ export const Header: React.FC = ({ eModeGroup, pool, className }) =

{eModeGroup.name}

- {poolUserHealthFactor && !isEModeGroupEnabled && isUserEligible && ( + {!!poolUserHealthFactor && !isEModeGroupEnabled && isUserEligible && ( = ({ eModeGroup, pool, className }) =
- {poolUserHealthFactor && !isEModeGroupEnabled && isUserEligible && ( + {!!poolUserHealthFactor && !isEModeGroupEnabled && isUserEligible && ( = ({ amountTokens, ac borrowPointDistributions: [], disabledTokenActions: [], isCollateralOfUser: false, + isBorrowable: true, userCollateralFactor: 0, collateralFactor: 0, userLiquidationThresholdPercentage: 0, diff --git a/apps/evm/src/types/index.ts b/apps/evm/src/types/index.ts index 60cf3e7889..c44b93046c 100644 --- a/apps/evm/src/types/index.ts +++ b/apps/evm/src/types/index.ts @@ -118,6 +118,7 @@ export interface PointDistribution { export interface Asset { vToken: VToken; tokenPriceCents: BigNumber; + isBorrowable: boolean; reserveFactor: number; collateralFactor: number; badDebtMantissa: bigint; @@ -167,6 +168,7 @@ export interface EModeAssetSettings { liquidationPenaltyPercentage: number; liquidityCents: number; liquidityTokens: BigNumber; + isBorrowable: boolean; } export interface EModeGroup { From 6401538ccc695460e539f254473acd299a185841 Mon Sep 17 00:00:00 2001 From: therealemjy Date: Wed, 10 Sep 2025 10:56:27 +0200 Subject: [PATCH 2/4] feat: show borrowable state of assets --- apps/evm/src/__mocks__/models/eModeGroup.ts | 7 +- .../__snapshots__/index.spec.tsx.snap | 3 - .../__snapshots__/index.eMode.spec.ts.snap | 28 ------- .../formatOutput/generateFakeEModeGroup.tsx | 3 - .../getPools/formatOutput/index.ts | 3 - apps/evm/src/components/Apy/index.tsx | 14 ++-- apps/evm/src/components/EModeBanner/index.tsx | 15 ++-- .../__snapshots__/index.spec.tsx.snap | 2 + .../libs/translations/translations/en.json | 6 +- apps/evm/src/pages/Pool/Assets/index.tsx | 2 +- .../EModeGroup/EModeGroupCard/Asset/index.tsx | 24 +++++- apps/evm/src/pages/Pool/Tabs/EMode/index.tsx | 3 +- .../Pool/Tabs/EMode/useGetColumns/index.tsx | 42 ++++------ .../__snapshots__/index.eMode.spec.tsx.snap | 7 ++ .../__snapshots__/index.spec.tsx.snap | 3 + .../pages/Pool/__tests__/index.eMode.spec.tsx | 82 +++++++++++++++++++ .../src/pages/Pool/__tests__/index.spec.tsx | 30 ++++++- apps/evm/src/types/index.ts | 1 - 18 files changed, 180 insertions(+), 95 deletions(-) create mode 100644 apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap create mode 100644 apps/evm/src/pages/Pool/__tests__/__snapshots__/index.spec.tsx.snap create mode 100644 apps/evm/src/pages/Pool/__tests__/index.eMode.spec.tsx diff --git a/apps/evm/src/__mocks__/models/eModeGroup.ts b/apps/evm/src/__mocks__/models/eModeGroup.ts index c14e8f817b..4ab5e7bb8c 100644 --- a/apps/evm/src/__mocks__/models/eModeGroup.ts +++ b/apps/evm/src/__mocks__/models/eModeGroup.ts @@ -5,11 +5,9 @@ const generateEModeGroup = ({ groupAssets, id, name, - description, -}: { groupAssets: Asset[]; id: number; name: string; description: string }) => ({ +}: { groupAssets: Asset[]; id: number; name: string }): EModeGroup => ({ id, name, - description, assetSettings: groupAssets.map(a => ({ vToken: a.vToken, collateralFactor: a.userCollateralFactor + 0.1, @@ -25,19 +23,16 @@ export const eModeGroups: EModeGroup[] = [ generateEModeGroup({ id: 0, name: 'Stablecoins', - description: 'This block contains the assets of this category', groupAssets: assetData.slice(0, 3), }), generateEModeGroup({ id: 1, name: 'DeFi', - description: 'This block contains the assets of this category', groupAssets: assetData.slice(2, 4), }), generateEModeGroup({ id: 2, name: '#ToTheMoon', - description: 'This block contains the assets of this category', groupAssets: assetData.slice(5, 8), }), ]; diff --git a/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap b/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap index 828b102290..2523c573ae 100644 --- a/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap @@ -542,7 +542,6 @@ exports[`useGetPool > returns the correct asset 1`] = ` }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -587,13 +586,11 @@ exports[`useGetPool > returns the correct asset 1`] = ` }, }, ], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, diff --git a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap index 0073b873ef..4796bc56f6 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap +++ b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap @@ -533,7 +533,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -561,13 +560,11 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, @@ -641,7 +638,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -740,7 +736,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -767,13 +762,11 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, @@ -805,7 +798,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -889,19 +881,16 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, @@ -933,7 +922,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -1101,19 +1089,16 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, @@ -1165,7 +1150,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -1249,19 +1233,16 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, @@ -1293,7 +1274,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -1489,19 +1469,16 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, @@ -1553,7 +1530,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -1637,7 +1613,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, @@ -1664,13 +1639,11 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 1, "name": "DeFi", }, { "assetSettings": [], - "description": "This block contains the assets of this category", "id": 2, "name": "#ToTheMoon", }, @@ -1702,7 +1675,6 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, }, ], - "description": "This block contains the assets of this category", "id": 0, "name": "Stablecoins", }, diff --git a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx index 580ce44c4e..6e1b041c17 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx +++ b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx @@ -20,19 +20,16 @@ export const generateFakeEModeGroup = ({ chainId, id, name, - description, }: { apiMarkets: ApiMarket[]; tokens: Token[]; chainId: ChainId; id: number; name: string; - description: string; }) => { const group: EModeGroup = { id, name, - description, assetSettings: apiMarkets.reduce((acc, market, i) => { const underlyingToken = findTokenByAddress({ tokens, diff --git a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts index 541b39bbb4..cfdb833f18 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts +++ b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts @@ -68,7 +68,6 @@ export const formatOutput = ({ userEModeGroup = generateFakeEModeGroup({ id: 0, name: 'Stablecoins', - description: 'This block contains the assets of this category', tokens, chainId, apiMarkets: apiPool.markets.slice(0, 6), @@ -79,7 +78,6 @@ export const formatOutput = ({ generateFakeEModeGroup({ id: 1, name: 'DeFi', - description: 'This block contains the assets of this category', tokens, chainId, apiMarkets: apiPool.markets.slice(2, 8), @@ -87,7 +85,6 @@ export const formatOutput = ({ generateFakeEModeGroup({ id: 2, name: '#ToTheMoon', - description: 'This block contains the assets of this category', tokens, chainId, apiMarkets: apiPool.markets.slice(5, 8), diff --git a/apps/evm/src/components/Apy/index.tsx b/apps/evm/src/components/Apy/index.tsx index a3089a3ad1..c27f77d85d 100644 --- a/apps/evm/src/components/Apy/index.tsx +++ b/apps/evm/src/components/Apy/index.tsx @@ -1,8 +1,7 @@ import { cn } from '@venusprotocol/ui'; import type BigNumber from 'bignumber.js'; -import useFormatPercentageToReadableValue from 'hooks/useFormatPercentageToReadableValue'; import type { Asset, PrimeDistribution, PrimeSimulationDistribution } from 'types'; -import { getCombinedDistributionApys } from 'utilities'; +import { formatPercentageToReadableValue, getCombinedDistributionApys } from 'utilities'; import { BoostTooltip } from './BoostTooltip'; import { PrimeBadge } from './PrimeBadge'; @@ -29,9 +28,7 @@ export const Apy: React.FC = ({ asset, type, className }) => { const isApyBoosted = !boostedApyPercentage.isEqualTo(baseApyPercentage) || pointDistributions.length > 0; - const readableApy = useFormatPercentageToReadableValue({ - value: boostedApyPercentage, - }); + const readableApy = formatPercentageToReadableValue(boostedApyPercentage); let primeDistribution: PrimeDistribution | undefined; let primeSimulationDistribution: PrimeSimulationDistribution | undefined; @@ -49,6 +46,7 @@ export const Apy: React.FC = ({ asset, type, className }) => { }); const isPrimeAsset = !!(primeDistribution || primeSimulationDistribution); + const shouldBeGreyedOut = type === 'borrow' && !asset.isBorrowable; let simulatedApyPercentage: BigNumber | undefined; const isApyBoostedByPrime = primeDistribution && !primeDistribution.apyPercentage.isEqualTo(0); @@ -65,7 +63,9 @@ export const Apy: React.FC = ({ asset, type, className }) => { } return ( -
+
{isApyBoostedByPrime && } {isApyBoosted ? ( @@ -82,7 +82,7 @@ export const Apy: React.FC = ({ asset, type, className }) => {

{readableApy}

) : ( -

{readableApy}

+

{readableApy}

)} {isPrimeAsset && !isApyBoostedByPrime && ( diff --git a/apps/evm/src/components/EModeBanner/index.tsx b/apps/evm/src/components/EModeBanner/index.tsx index fe6613ba44..781a262c6d 100644 --- a/apps/evm/src/components/EModeBanner/index.tsx +++ b/apps/evm/src/components/EModeBanner/index.tsx @@ -10,15 +10,12 @@ import illustrationSrc from './illustration.svg'; export interface EModeBannerProps { poolComptrollerContractAddress: Address; - enabledEModeGroup?: { - name: string; - description: string; - }; + enabledEModeGroupName?: string; className?: string; } export const EModeBanner: React.FC = ({ - enabledEModeGroup, + enabledEModeGroupName, poolComptrollerContractAddress, className, }) => { @@ -28,21 +25,19 @@ export const EModeBanner: React.FC = ({
- {enabledEModeGroup ? ( + {enabledEModeGroupName ? (
-

{enabledEModeGroup.name}

- -

{enabledEModeGroup.description}

+

{enabledEModeGroupName}

diff --git a/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap b/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap index c8a5b47201..6600a0b0bd 100644 --- a/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap @@ -63,6 +63,7 @@ exports[`useGetProfitableImports > returns profitable importable positions 1`] = "supply", ], "exchangeRateVTokens": "1", + "isBorrowable": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "1702951959", @@ -202,6 +203,7 @@ exports[`useGetProfitableImports > returns profitable importable positions 1`] = "swapAndSupply", ], "exchangeRateVTokens": "0.981982", + "isBorrowable": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "5534102886", diff --git a/apps/evm/src/libs/translations/translations/en.json b/apps/evm/src/libs/translations/translations/en.json index ef0b09ec4b..f1c3283243 100644 --- a/apps/evm/src/libs/translations/translations/en.json +++ b/apps/evm/src/libs/translations/translations/en.json @@ -746,6 +746,10 @@ }, "table": { "card": { + "header": { + "borrowable": "Borrowable", + "notBorrowable": "Not borrowable" + }, "rows": { "liquidationPenalty": "Liquidation penalty", "liquidationThreshold": "Liquidation threshold", @@ -755,9 +759,9 @@ }, "columns": { "asset": "Asset", + "isBorrowable": "Borrowable", "liquidationPenalty": "Liquidation penalty", "liquidationThreshold": "Liquidation threshold", - "liquidity": "Liquidity", "maxLtv": "Max LTV", "penalty": "Penalty", "threshold": "Threshold" diff --git a/apps/evm/src/pages/Pool/Assets/index.tsx b/apps/evm/src/pages/Pool/Assets/index.tsx index cfafb3b4e3..4df2b439d7 100644 --- a/apps/evm/src/pages/Pool/Assets/index.tsx +++ b/apps/evm/src/pages/Pool/Assets/index.tsx @@ -32,7 +32,7 @@ export const Assets: React.FC = ({ pool }) => { ) } diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/EModeGroupCard/Asset/index.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/EModeGroupCard/Asset/index.tsx index 3d8fa196f0..ac4d0f8976 100644 --- a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/EModeGroupCard/Asset/index.tsx +++ b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/EModeGroupCard/Asset/index.tsx @@ -1,6 +1,6 @@ import { cn } from '@venusprotocol/ui'; -import { LabeledInlineContent, LayeredValues, TokenIconWithSymbol } from 'components'; +import { Icon, LabeledInlineContent, LayeredValues, TokenIconWithSymbol } from 'components'; import { useTranslation } from 'libs/translations'; import type { EModeAssetSettings } from 'types'; import { @@ -49,7 +49,27 @@ export const Asset: React.FC = ({ eModeAssetSettings, className }) = return (
- +
+ + +
+ + + + {eModeAssetSettings.isBorrowable + ? t('pool.eMode.table.card.header.borrowable') + : t('pool.eMode.table.card.header.notBorrowable')} + +
+
{dataListItems.map(item => ( diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx index a9b2bf5ce8..cd9ff1f509 100644 --- a/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx +++ b/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx @@ -73,9 +73,8 @@ export const EMode: React.FC = ({ pool, searchValue, onSearchValueCh ); const nameMatches = searchMatches(eModeGroup.name); - const descriptionMatches = searchMatches(eModeGroup.description); - if (filteredEModeAssetSettings.length === 0 && !nameMatches && !descriptionMatches) { + if (filteredEModeAssetSettings.length === 0 && !nameMatches) { // Filter out E-mode group return acc; } diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx index a3eea943b6..9d7e27bfdf 100644 --- a/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx +++ b/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx @@ -1,13 +1,10 @@ -import { LayeredValues, type TableColumn, TokenIconWithSymbol } from 'components'; +import { cn } from '@venusprotocol/ui'; + +import { Icon, type TableColumn, TokenIconWithSymbol } from 'components'; import { useBreakpointUp } from 'hooks/responsive'; import { useTranslation } from 'libs/translations'; import type { EModeAssetSettings } from 'types'; -import { - compareNumbers, - formatCentsToReadableValue, - formatPercentageToReadableValue, - formatTokensToReadableValue, -} from 'utilities'; +import { compareBooleans, compareNumbers, formatPercentageToReadableValue } from 'utilities'; export const useGetColumns = () => { const { t } = useTranslation(); @@ -22,24 +19,6 @@ export const useGetColumns = () => { selectOptionLabel: t('pool.eMode.table.columns.asset'), renderCell: ({ vToken }) => , }, - { - key: 'liquidity', - label: t('pool.eMode.table.columns.liquidity'), - selectOptionLabel: t('pool.eMode.table.columns.liquidity'), - renderCell: ({ liquidityCents, liquidityTokens, vToken }) => ( - - ), - sortRows: (rowA, rowB, direction) => - compareNumbers(rowA.liquidityCents, rowB.liquidityCents, direction), - }, { key: 'maxLtv', label: t('pool.eMode.table.columns.maxLtv'), @@ -78,6 +57,19 @@ export const useGetColumns = () => { direction, ), }, + { + key: 'isBorrowable', + label: t('pool.eMode.table.columns.isBorrowable'), + selectOptionLabel: t('pool.eMode.table.columns.isBorrowable'), + renderCell: ({ isBorrowable }) => ( + + ), + sortRows: (rowA, rowB, direction) => + compareBooleans(rowA.isBorrowable, rowB.isBorrowable, direction), + }, ]; return columns; diff --git a/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap b/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap new file mode 100644 index 0000000000..c871a66db3 --- /dev/null +++ b/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Pool - Feature flag enabled: E-mode > Assets tab > renders correctly when pool has E-mode groups 1`] = `"AssetsE-modeNewTotal supply$20.99TTotal borrow$8.58TAvailable liquidity$12.4TAssets4StablecoinsManage E-modePaused assetsAssetTotal supplySupply APY sorted descendingTotal borrowBorrow APY LiquidityUSDT> 100T USDT$10.98T4.02%5.77%232.51M USDT$31.58M-5.50%-6.51%10 USDT$55.34MBUSD> 100T BUSD$10.54B3.56%5.32%142.66M BUSD$839.1M-5.82%10 BUSD$36.54MXVS> 100T XVS$2.78M0.17%1.85M XVS$709.25K-6.48%10 XVS$80.36MSort bySupply APY / LTVUSDTTotal supply> 100T USDT$10.98TSupply APY 4.02%5.77%Total borrow232.51M USDT$31.58MBorrow APY -5.50%-6.51%Liquidity10 USDT$55.34MBUSDTotal supply> 100T BUSD$10.54BSupply APY 3.56%5.32%Total borrow142.66M BUSD$839.1MBorrow APY -5.82%Liquidity10 BUSD$36.54MXVSTotal supply> 100T XVS$2.78MSupply APY 0.17%Total borrow1.85M XVS$709.25KBorrow APY -6.48%Liquidity10 XVS$80.36M"`; + +exports[`Pool - Feature flag enabled: E-mode > E-mode tab > filters assets correctly when using search 1`] = `"AssetsE-modeEnabling E-Mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. Learn moreSort by:Max LTVStablecoinsEnabledStablecoinsEnabledAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableSort byMax LTVDeFiEnableBUSDBorrowableLiquidity10 BUSD$36.54MMax LTV90%Liquidation threshold92%Liquidation penalty30%DeFiEnableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableBUSD90%92%30%Sort byMax LTVBUSDMax LTV90%Liquidation threshold92%Liquidation penalty30%Borrowable"`; + +exports[`Pool - Feature flag enabled: E-mode > E-mode tab > renders correctly 1`] = `"AssetsE-modeEnabling E-Mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. Learn moreSort by:Max LTVStablecoinsEnabledUSDCNot borrowableLiquidity10 USDC$17.02MMax LTV90%Liquidation threshold92%Liquidation penalty30%USDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%XVSBorrowableLiquidity10 XVS$80.36MMax LTV60%Liquidation threshold62%Liquidation penalty0%StablecoinsEnabledAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableUSDC90%92%30%USDT90%92%30%XVS60%62%0%Sort byMax LTVUSDCMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableUSDTMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableXVSMax LTV60%Liquidation threshold62%Liquidation penalty0%BorrowableDeFiEnableUSDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%BUSDBorrowableLiquidity10 BUSD$36.54MMax LTV90%Liquidation threshold92%Liquidation penalty30%DeFiEnableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableUSDT90%92%30%BUSD90%92%30%Sort byMax LTVUSDTMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableBUSDMax LTV90%Liquidation threshold92%Liquidation penalty30%Borrowable#ToTheMoonEnable#ToTheMoonEnableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableSort byMax LTV"`; diff --git a/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.spec.tsx.snap b/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.spec.tsx.snap new file mode 100644 index 0000000000..6e48f29b7c --- /dev/null +++ b/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.spec.tsx.snap @@ -0,0 +1,3 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Pool > renders correctly 1`] = `"Total supply$20.99TTotal borrow$8.58TAvailable liquidity$12.4TAssets4Paused assetsAssetTotal supplySupply APY sorted descendingTotal borrowBorrow APY LiquidityUSDT> 100T USDT$10.98T4.02%5.77%232.51M USDT$31.58M-5.50%-6.51%10 USDT$55.34MBUSD> 100T BUSD$10.54B3.56%5.32%142.66M BUSD$839.1M-5.82%10 BUSD$36.54MXVS> 100T XVS$2.78M0.17%1.85M XVS$709.25K-6.48%10 XVS$80.36MSort bySupply APY / LTVUSDTTotal supply> 100T USDT$10.98TSupply APY 4.02%5.77%Total borrow232.51M USDT$31.58MBorrow APY -5.50%-6.51%Liquidity10 USDT$55.34MBUSDTotal supply> 100T BUSD$10.54BSupply APY 3.56%5.32%Total borrow142.66M BUSD$839.1MBorrow APY -5.82%Liquidity10 BUSD$36.54MXVSTotal supply> 100T XVS$2.78MSupply APY 0.17%Total borrow1.85M XVS$709.25KBorrow APY -6.48%Liquidity10 XVS$80.36M"`; diff --git a/apps/evm/src/pages/Pool/__tests__/index.eMode.spec.tsx b/apps/evm/src/pages/Pool/__tests__/index.eMode.spec.tsx new file mode 100644 index 0000000000..d34e62abaf --- /dev/null +++ b/apps/evm/src/pages/Pool/__tests__/index.eMode.spec.tsx @@ -0,0 +1,82 @@ +import { renderComponent } from 'testUtils/render'; +import type { Mock } from 'vitest'; + +import { fireEvent, waitFor } from '@testing-library/react'; +import { eModeGroups } from '__mocks__/models/eModeGroup'; +import { poolData } from '__mocks__/models/pools'; +import { useGetPool } from 'clients/api'; +import { routes } from 'constants/routing'; +import { type UseIsFeatureEnabledInput, useIsFeatureEnabled } from 'hooks/useIsFeatureEnabled'; +import { en } from 'libs/translations'; +import type { Pool } from 'types'; +import PoolPage from '..'; + +const customFakePool: Pool = { + ...poolData[0], + eModeGroups, + userEModeGroup: eModeGroups[0], +}; + +describe('Pool - Feature flag enabled: E-mode', () => { + beforeEach(() => { + (useIsFeatureEnabled as Mock).mockImplementation( + ({ name }: UseIsFeatureEnabledInput) => name === 'eMode', + ); + + (useGetPool as Mock).mockImplementation(() => ({ + isLoading: false, + data: { + pool: customFakePool, + }, + })); + }); + + describe('Assets tab', () => { + it('renders correctly when pool has E-mode groups', async () => { + const { container } = renderComponent(); + + await waitFor(() => expect(container.textContent).not.toEqual('')); + + expect(container.textContent).toMatchSnapshot(); + }); + }); + + describe('E-mode tab', () => { + it('renders correctly', async () => { + const { container } = renderComponent(, { + routerInitialEntries: [ + `${routes.pool.path.replace( + ':poolComptrollerAddress', + customFakePool.comptrollerAddress, + )}?tab=e-mode`, + ], + routePath: routes.pool.path, + }); + + await waitFor(() => expect(container.textContent).not.toEqual('')); + + expect(container.textContent).toMatchSnapshot(); + }); + + it('filters assets correctly when using search', async () => { + const { container, queryAllByPlaceholderText } = renderComponent(, { + routerInitialEntries: [ + `${routes.pool.path.replace( + ':poolComptrollerAddress', + customFakePool.comptrollerAddress, + )}?tab=e-mode`, + ], + routePath: routes.pool.path, + }); + + await waitFor(() => expect(container.textContent).not.toEqual('')); + + const tokenTextFieldInput = queryAllByPlaceholderText( + en.pool.eMode.search.placeholder, + )[0] as HTMLInputElement; + fireEvent.change(tokenTextFieldInput, { target: { value: 'b' } }); + + expect(container.textContent).toMatchSnapshot(); + }); + }); +}); diff --git a/apps/evm/src/pages/Pool/__tests__/index.spec.tsx b/apps/evm/src/pages/Pool/__tests__/index.spec.tsx index 2cf6a92f02..da078e1111 100644 --- a/apps/evm/src/pages/Pool/__tests__/index.spec.tsx +++ b/apps/evm/src/pages/Pool/__tests__/index.spec.tsx @@ -1,9 +1,33 @@ import { renderComponent } from 'testUtils/render'; +import type { Mock } from 'vitest'; -import Pool from '..'; +import { waitFor } from '@testing-library/react'; +import { poolData } from '__mocks__/models/pools'; +import { useGetPool } from 'clients/api'; +import type { Pool } from 'types'; +import PoolPage from '..'; + +const customFakePool: Pool = { + ...poolData[0], + eModeGroups: [], + userEModeGroup: undefined, +}; describe('Pool', () => { - it('renders without crashing', async () => { - renderComponent(); + beforeEach(() => { + (useGetPool as Mock).mockImplementation(() => ({ + isLoading: false, + data: { + pool: customFakePool, + }, + })); + }); + + it('renders correctly', async () => { + const { container } = renderComponent(); + + await waitFor(() => expect(container.textContent).not.toEqual('')); + + expect(container.textContent).toMatchSnapshot(); }); }); diff --git a/apps/evm/src/types/index.ts b/apps/evm/src/types/index.ts index c44b93046c..5f78aa5faf 100644 --- a/apps/evm/src/types/index.ts +++ b/apps/evm/src/types/index.ts @@ -174,7 +174,6 @@ export interface EModeAssetSettings { export interface EModeGroup { id: number; name: string; - description: string; assetSettings: EModeAssetSettings[]; } From bab128ee55008305b533c687f5b28c1368e46004 Mon Sep 17 00:00:00 2001 From: therealemjy Date: Thu, 11 Sep 2025 09:35:12 +0200 Subject: [PATCH 3/4] feat: add logic to E-mode tab --- apps/evm/src/__mocks__/models/asset.ts | 4 + .../__snapshots__/index.spec.tsx.snap | 1 + .../__snapshots__/index.spec.tsx.snap | 4 + .../__snapshots__/index.eMode.spec.ts.snap | 123 ++++------ .../__snapshots__/index.prime.spec.ts.snap | 42 ++++ .../__snapshots__/index.spec.ts.snap | 42 ++++ .../index.tsx} | 9 +- .../getPools/formatOutput/index.ts | 12 +- apps/evm/src/components/InfoIcon/index.tsx | 2 +- apps/evm/src/components/Tooltip/index.tsx | 2 +- .../__snapshots__/index.spec.tsx.snap | 2 + .../libs/translations/translations/en.json | 13 +- apps/evm/src/pages/Pool/Assets/index.tsx | 62 +++-- .../getHypotheticalAssetValues/index.ts | 41 ++++ .../Tabs/EMode/EModeGroup/Header/index.tsx | 156 ++++++++---- .../__snapshots__/index.spec.tsx.snap | 7 + .../EMode/EModeGroup/__tests__/index.spec.tsx | 222 ++++++++++++++++++ apps/evm/src/pages/Pool/Tabs/EMode/index.tsx | 6 +- .../Pool/Tabs/EMode/useGetColumns/index.tsx | 6 +- .../__snapshots__/index.eMode.spec.tsx.snap | 4 +- .../src/pages/Vai/AccountVaiData/index.tsx | 1 + apps/evm/src/types/index.ts | 1 + 22 files changed, 589 insertions(+), 173 deletions(-) rename apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/{generateFakeEModeGroup.tsx => generateFakeEModeGroup/index.tsx} (87%) create mode 100644 apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/getHypotheticalAssetValues/index.ts create mode 100644 apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/__snapshots__/index.spec.tsx.snap create mode 100644 apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/index.spec.tsx diff --git a/apps/evm/src/__mocks__/models/asset.ts b/apps/evm/src/__mocks__/models/asset.ts index f84143d2a2..7ef5d9bb08 100644 --- a/apps/evm/src/__mocks__/models/asset.ts +++ b/apps/evm/src/__mocks__/models/asset.ts @@ -24,6 +24,7 @@ export const assetData: Asset[] = [ supplierCount: 100, borrowerCount: 10, isBorrowable: true, + isBorrowableByUser: true, exchangeRateVTokens: new BigNumber(49.589181233), userWalletBalanceTokens: new BigNumber('100'), userWalletBalanceCents: new BigNumber('12786'), @@ -94,6 +95,7 @@ export const assetData: Asset[] = [ supplierCount: 100, borrowerCount: 10, isBorrowable: false, + isBorrowableByUser: false, exchangeRateVTokens: new BigNumber(1), userWalletBalanceTokens: new BigNumber('0'), userWalletBalanceCents: new BigNumber('0'), @@ -182,6 +184,7 @@ export const assetData: Asset[] = [ supplierCount: 100, borrowerCount: 10, isBorrowable: true, + isBorrowableByUser: true, exchangeRateVTokens: new BigNumber(0.981982), userWalletBalanceTokens: new BigNumber('900'), userWalletBalanceCents: new BigNumber('90000'), @@ -266,6 +269,7 @@ export const assetData: Asset[] = [ supplierCount: 100, borrowerCount: 10, isBorrowable: true, + isBorrowableByUser: true, exchangeRateVTokens: new BigNumber(1.000003), userWalletBalanceTokens: new BigNumber('110'), userWalletBalanceCents: new BigNumber('11000'), diff --git a/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap b/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap index 2dd218b1f7..c79d574860 100644 --- a/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/clients/api/queries/useGetAsset/__snapshots__/index.spec.tsx.snap @@ -37,6 +37,7 @@ exports[`useGetAsset > returns the correct asset 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "49.589181233", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 50, "liquidityCents": "8036465875", diff --git a/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap b/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap index 2523c573ae..e0a7e05054 100644 --- a/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/clients/api/queries/useGetPool/__snapshots__/index.spec.tsx.snap @@ -39,6 +39,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "49.589181233", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 50, "liquidityCents": "8036465875", @@ -151,6 +152,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` ], "exchangeRateVTokens": "1", "isBorrowable": false, + "isBorrowableByUser": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "1702951959", @@ -278,6 +280,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` ], "exchangeRateVTokens": "0.981982", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "5534102886", @@ -397,6 +400,7 @@ exports[`useGetPool > returns the correct asset 1`] = ` ], "exchangeRateVTokens": "1.000003", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "3654492935", diff --git a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap index 4796bc56f6..e52da204a6 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap +++ b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.eMode.spec.ts.snap @@ -23,6 +23,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po ], "exchangeRateVTokens": "49.19405324154271215086", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -94,6 +95,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -180,6 +182,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -252,6 +255,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -323,6 +327,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -408,6 +413,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -492,7 +498,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 0, @@ -513,7 +519,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 555.6233762724731, @@ -539,23 +545,22 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po { "assetSettings": [ { - "collateralFactor": 0.9, + "collateralFactor": 0, "isBorrowable": true, - "liquidationPenaltyPercentage": 38.000000000000014, - "liquidationThresholdPercentage": 100.00000000000001, - "liquidityCents": 555.6233762724731, - "liquidityTokens": "5.556233762724731858", + "liquidationPenaltyPercentage": 0, + "liquidationThresholdPercentage": 0, + "liquidityCents": 225965707.47611484, + "liquidityTokens": "2259657.074761148481496107", "vToken": { - "address": "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c", - "asset": "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_10784_8738)'%3e%3ccircle%20cx='12'%20cy='12'%20r='12'%20fill='%23181D27'/%3e%3cmask%20id='mask0_10784_8738'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3ccircle%20cx='12'%20cy='12'%20r='11.5'%20fill='%23181D27'%20stroke='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_10784_8738)'%3e%3cpath%20opacity='0.8'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.9998%2027.0794L0.36002%203.36864L3.38965%201.88136L11.9998%2019.4206L20.61%201.88137L23.6397%203.36864L11.9998%2027.0794Z'%20fill='white'/%3e%3c/g%3e%3ccircle%20opacity='0.8'%20cx='12'%20cy='12'%20r='10.5'%20fill='url(%23paint0_linear_10784_8738)'/%3e%3ccircle%20cx='12'%20cy='12'%20r='9'%20fill='%23181D27'/%3e%3cpath%20d='M9.81519%2011.1023L11.9999%208.91767L14.1858%2011.1035L15.4571%209.83225L11.9999%206.375L8.54395%209.83109L9.81519%2011.1023Z'%20fill='white'/%3e%3cpath%20d='M8.9177%2011.9998L7.64648%2010.7286L6.3752%2011.9999L7.64642%2013.2711L8.9177%2011.9998Z'%20fill='white'/%3e%3cpath%20d='M9.8151%2012.8976L11.9999%2015.0823L14.1857%2012.8965L15.4576%2014.1671L15.457%2014.1678L11.9999%2017.6249L8.54377%2014.1689L8.54199%2014.1672L9.8151%2012.8976Z'%20fill='white'/%3e%3cpath%20d='M16.3537%2013.2717L17.625%2012.0004L16.3538%2010.7292L15.0825%2012.0005L16.3537%2013.2717Z'%20fill='white'/%3e%3cpath%20d='M13.2891%2011.9994H13.2896L11.9996%2010.7094L11.0463%2011.6627H11.0462L10.9367%2011.7722L10.7108%2011.9982L10.709%2012L10.7108%2012.0019L11.9996%2013.2907L13.2896%2012.0007L13.2902%2012L13.2891%2011.9994Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_10784_8738'%20x1='22.2313'%20y1='18.1183'%20x2='-3.53296'%20y2='2.62136'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%235433FF'/%3e%3cstop%20offset='0.5'%20stop-color='%2320BDFF'/%3e%3cstop%20offset='1'%20stop-color='%235CFFA2'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_10784_8738'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", + "address": "0x6d6F697e34145Bb95c54E77482d97cc261Dc237E", + "asset": "/src/libs/tokens/img/vTokens/vXvsCore.svg", "decimals": 8, - "symbol": "vBNB", + "symbol": "vXVS", "underlyingToken": { - "address": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", - "asset": "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cg%20clip-path='url(%23A)'%3e%3cg%20clip-path='url(%23B)'%3e%3cpath%20fill-rule='evenodd'%20d='M12%200a12%2012%200%201%201%200%2024%2012%2012%200%201%201%200-24z'%20fill='%23f0b90b'/%3e%3cg%20fill='%23fff'%3e%3cpath%20d='M6.595%2012l.009%203.173L9.3%2016.76v1.858l-4.274-2.507v-5.039L6.595%2012zm0-3.173v1.849l-1.57-.929V7.898l1.57-.929%201.578.929-1.578.929zm3.831-.929l1.57-.929%201.578.929-1.578.929-1.57-.929zM7.73%2014.515v-1.858l1.57.929v1.849l-1.57-.92zm2.696%202.91l1.57.929%201.578-.929v1.849l-1.578.929-1.57-.929v-1.849zm5.4-9.527l1.57-.929%201.578.929v1.849l-1.578.929V8.827l-1.57-.929zm1.57%207.275L17.405%2012l1.57-.929v5.038l-4.274%202.507v-1.858l2.695-1.586zm-1.126-.658l-1.57.92v-1.849l1.57-.929v1.858zm0-5.03l.009%201.858-2.704%201.587v3.181l-1.57.92-1.57-.92V12.93l-2.704-1.587V9.485l1.577-.929%202.687%201.594%202.704-1.594%201.578.929h-.007zM7.73%206.313l4.266-2.515%204.274%202.515-1.57.929-2.704-1.594L9.3%207.241l-1.57-.929z'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='A'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='B'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", + "address": "0xB9e0E753630434d7863528cc73CB7AC638a7c8ff", + "asset": "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cg%20clip-path='url(%23B)'%3e%3ccircle%20cx='12'%20cy='12'%20r='12'%20fill='%231f2028'/%3e%3cpath%20d='M18.957%209.442l-5.27%209.128c-.159.275-.388.504-.664.663s-.588.243-.906.243-.631-.084-.906-.243-.505-.387-.664-.663l-.924-1.599c-.003-.019%200-.023.004-.026.019-.003.023%200%20.026.004a1.52%201.52%200%200%200%201.267.425%201.52%201.52%200%200%200%20.642-.241c.193-.128.354-.299.47-.499l4.412-7.649a1.52%201.52%200%200%200%20.086-1.341%201.52%201.52%200%200%200-1.012-.884c-.017-.009-.019-.014-.019-.019.009-.017.014-.019.019-.019h1.87c.318%200%20.631.084.906.244s.504.388.663.664.243.588.242.907-.084.631-.243.907zm-6.239-2.721h-1.827c-.012.01-.013.014-.013.018.006.014.009.017.013.018.123.048.234.121.326.216s.163.208.207.332.061.257.049.388-.051.259-.117.373l-2.663%204.606a.92.92%200%200%201-.648.441.92.92%200%200%201-.752-.22c-.017-.008-.022-.007-.026-.004-.008.017-.007.022-.004.026l.935%201.623c.105.182.256.333.438.439s.389.161.599.161.417-.055.599-.161.333-.257.438-.439l3.484-6.022c.105-.182.16-.389.16-.599s-.055-.417-.161-.599-.257-.333-.439-.438-.389-.16-.599-.16zm-6.342%200c-.312%200-.617.092-.876.266s-.461.419-.581.708-.151.605-.09.911.211.587.431.807.501.371.807.431.623.03.911-.09.534-.321.708-.581.266-.564.266-.876c0-.207-.04-.412-.12-.604s-.195-.365-.342-.512-.32-.263-.512-.342-.396-.12-.604-.12z'%20fill='url(%23A)'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='A'%20x1='19.016'%20y1='16.814'%20x2='2.55'%20y2='5.633'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%235433ff'/%3e%3cstop%20offset='.5'%20stop-color='%2320bdff'/%3e%3cstop%20offset='1'%20stop-color='%235cffa2'/%3e%3c/linearGradient%3e%3cclipPath%20id='B'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", "decimals": 18, - "isNative": true, - "symbol": "BNB", + "symbol": "XVS", }, }, }, @@ -597,7 +602,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 0, @@ -618,7 +623,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 555.6233762724731, @@ -660,6 +665,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -717,7 +723,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 264929173.1707, @@ -740,28 +746,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "name": "Stablecoins", }, { - "assetSettings": [ - { - "collateralFactor": 0.9, - "isBorrowable": true, - "liquidationPenaltyPercentage": 38.000000000000014, - "liquidationThresholdPercentage": 100.00000000000001, - "liquidityCents": 264929173.1707, - "liquidityTokens": "2649291.731707", - "vToken": { - "address": "0x80CC30811e362aC9aB857C3d7875CbcCc0b65750", - "asset": "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_12373_163)'%3e%3ccircle%20cx='12'%20cy='12'%20r='12'%20fill='%23181D27'/%3e%3cmask%20id='mask0_12373_163'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3ccircle%20cx='12'%20cy='12'%20r='11.5'%20fill='%23181D27'%20stroke='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_12373_163)'%3e%3cpath%20opacity='0.8'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.9998%2027.0793L0.36002%203.36861L3.38965%201.88134L11.9998%2019.4206L20.61%201.88134L23.6397%203.36861L11.9998%2027.0793Z'%20fill='white'/%3e%3c/g%3e%3ccircle%20opacity='0.8'%20cx='12'%20cy='12'%20r='10.5'%20fill='%235CFFA2'/%3e%3ccircle%20cx='12'%20cy='12'%20r='9'%20fill='%23181D27'/%3e%3cpath%20d='M15.807%207.875H8.18896V9.71415H11.0784V12.4174H12.9176V9.71415H15.807V7.875Z'%20fill='white'/%3e%3cpath%20d='M12.0151%2012.7053C9.62485%2012.7053%207.68699%2012.327%207.68699%2011.8603C7.68699%2011.3937%209.62477%2011.0153%2012.0151%2011.0153C14.4054%2011.0153%2016.3431%2011.3937%2016.3431%2011.8603C16.3431%2012.327%2014.4054%2012.7053%2012.0151%2012.7053ZM16.8749%2012.0012C16.8749%2011.3994%2014.6991%2010.9116%2012.0151%2010.9116C9.3312%2010.9116%207.15527%2011.3994%207.15527%2012.0012C7.15527%2012.5311%208.84245%2012.9727%2011.0782%2013.0705V16.9511H12.9171V13.072C15.1701%2012.9772%2016.8749%2012.5339%2016.8749%2012.0012Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_12373_163'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", - "decimals": 8, - "symbol": "vUSDT", - "underlyingToken": { - "address": "0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c", - "asset": "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cg%20clip-path='url(%23A)'%3e%3cpath%20d='M24%2012c0%206.628-5.372%2012-12%2012S0%2018.628%200%2012%205.373%200%2012%200s12%205.373%2012%2012z'%20fill='%231ba27a'/%3e%3cg%20fill='%23fff'%3e%3cpath%20d='M17.629%206.051H6.267v2.743h4.31v4.032h2.743V8.794h4.31V6.051z'/%3e%3cpath%20d='M11.973%2013.256c-3.565%200-6.456-.564-6.456-1.26s2.89-1.26%206.456-1.26%206.455.564%206.455%201.26-2.89%201.26-6.455%201.26zm7.249-1.05c0-.898-3.245-1.625-7.249-1.625s-7.249.727-7.249%201.625c0%20.79%202.517%201.449%205.851%201.595v5.788h2.743v-5.786c3.36-.141%205.903-.803%205.903-1.597z'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='A'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", - "decimals": 6, - "symbol": "USDT", - }, - }, - }, - ], + "assetSettings": [], "id": 1, "name": "DeFi", }, @@ -779,7 +764,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 264929173.1707, @@ -820,6 +805,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -862,7 +848,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 10116602.3761, @@ -903,7 +889,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 10116602.3761, @@ -944,6 +930,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -1008,6 +995,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -1050,7 +1038,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1103100000, @@ -1070,7 +1058,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.55, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": -0.4999999999999929, "liquidationThresholdPercentage": 61.50000000000001, "liquidityCents": 0.0705300034659891, @@ -1111,7 +1099,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1103100000, @@ -1131,7 +1119,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.55, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": -0.4999999999999929, "liquidationThresholdPercentage": 61.50000000000001, "liquidityCents": 0.0705300034659891, @@ -1172,6 +1160,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -1214,7 +1203,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.85, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 32.500000000000014, "liquidationThresholdPercentage": 94.50000000000001, "liquidityCents": 600600, @@ -1255,7 +1244,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.85, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 32.500000000000014, "liquidationThresholdPercentage": 94.50000000000001, "liquidityCents": 600600, @@ -1310,6 +1299,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -1373,6 +1363,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -1430,7 +1421,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.75, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 21.5, "liquidationThresholdPercentage": 83.5, "liquidityCents": 3256964.033967793, @@ -1450,7 +1441,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 99817453.518, @@ -1491,7 +1482,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.75, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 21.5, "liquidationThresholdPercentage": 83.5, "liquidityCents": 3256964.033967793, @@ -1511,7 +1502,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po }, { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 99817453.518, @@ -1552,6 +1543,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -1594,7 +1586,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1000000, @@ -1617,28 +1609,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "name": "Stablecoins", }, { - "assetSettings": [ - { - "collateralFactor": 0.9, - "isBorrowable": true, - "liquidationPenaltyPercentage": 38.000000000000014, - "liquidationThresholdPercentage": 100.00000000000001, - "liquidityCents": 1000000, - "liquidityTokens": "10000", - "vToken": { - "address": "0x712774CBFFCBD60e9825871CcEFF2F917442b2c3", - "asset": "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_12379_477)'%3e%3ccircle%20cx='12'%20cy='12'%20r='12'%20fill='%23181D27'/%3e%3cmask%20id='mask0_12379_477'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%3e%3ccircle%20cx='12'%20cy='12'%20r='11.5'%20fill='%23181D27'%20stroke='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_12379_477)'%3e%3cpath%20opacity='0.8'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.9998%2027.0793L0.36002%203.36861L3.38965%201.88134L11.9998%2019.4206L20.61%201.88134L23.6397%203.36861L11.9998%2027.0793Z'%20fill='white'/%3e%3c/g%3e%3ccircle%20opacity='0.8'%20cx='12'%20cy='12'%20r='10.5'%20fill='%23AAB3CA'/%3e%3ccircle%20cx='12'%20cy='12'%20r='9'%20fill='%23181D27'/%3e%3cpath%20d='M15.807%207.875H8.18896V9.71415H11.0784V12.4174H12.9176V9.71415H15.807V7.875Z'%20fill='white'/%3e%3cpath%20d='M12.0151%2012.7053C9.62485%2012.7053%207.68699%2012.327%207.68699%2011.8603C7.68699%2011.3937%209.62477%2011.0153%2012.0151%2011.0153C14.4054%2011.0153%2016.3431%2011.3937%2016.3431%2011.8603C16.3431%2012.327%2014.4054%2012.7053%2012.0151%2012.7053ZM16.8749%2012.0012C16.8749%2011.3994%2014.6991%2010.9116%2012.0151%2010.9116C9.3312%2010.9116%207.15527%2011.3994%207.15527%2012.0012C7.15527%2012.5311%208.84245%2012.9727%2011.0782%2013.0705V16.9511H12.9171V13.072C15.1701%2012.9772%2016.8749%2012.5339%2016.8749%2012.0012Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_12379_477'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", - "decimals": 8, - "symbol": "vUSDT", - "underlyingToken": { - "address": "0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c", - "asset": "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cg%20clip-path='url(%23A)'%3e%3cpath%20d='M24%2012c0%206.628-5.372%2012-12%2012S0%2018.628%200%2012%205.373%200%2012%200s12%205.373%2012%2012z'%20fill='%231ba27a'/%3e%3cg%20fill='%23fff'%3e%3cpath%20d='M17.629%206.051H6.267v2.743h4.31v4.032h2.743V8.794h4.31V6.051z'/%3e%3cpath%20d='M11.973%2013.256c-3.565%200-6.456-.564-6.456-1.26s2.89-1.26%206.456-1.26%206.455.564%206.455%201.26-2.89%201.26-6.455%201.26zm7.249-1.05c0-.898-3.245-1.625-7.249-1.625s-7.249.727-7.249%201.625c0%20.79%202.517%201.449%205.851%201.595v5.788h2.743v-5.786c3.36-.141%205.903-.803%205.903-1.597z'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='A'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", - "decimals": 6, - "symbol": "USDT", - }, - }, - }, - ], + "assetSettings": [], "id": 1, "name": "DeFi", }, @@ -1656,7 +1627,7 @@ exports[`useGetPools > fetches and formats E-mode groups associated with each po "assetSettings": [ { "collateralFactor": 0.9, - "isBorrowable": true, + "isBorrowable": false, "liquidationPenaltyPercentage": 38.000000000000014, "liquidationThresholdPercentage": 100.00000000000001, "liquidityCents": 1000000, diff --git a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap index d184f8b937..638b7f0822 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap +++ b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.prime.spec.ts.snap @@ -40,6 +40,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 ], "exchangeRateVTokens": "49.19405324154271215086", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -128,6 +129,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -214,6 +216,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -286,6 +289,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -373,6 +377,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -490,6 +495,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -590,6 +596,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -667,6 +674,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -746,6 +754,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -827,6 +836,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -889,6 +899,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -965,6 +976,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -1045,6 +1057,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -1156,6 +1169,7 @@ exports[`useGetPools > does not fetch Prime distributions if user is not Prime 1 "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -1274,6 +1288,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib ], "exchangeRateVTokens": "49.19405324154271215086", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -1373,6 +1388,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -1459,6 +1475,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -1531,6 +1548,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -1629,6 +1647,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -1768,6 +1787,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -1879,6 +1899,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -1956,6 +1977,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -2046,6 +2068,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -2138,6 +2161,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -2200,6 +2224,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -2276,6 +2301,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -2367,6 +2393,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -2500,6 +2527,7 @@ exports[`useGetPools > fetches and formats Prime distributions and Prime distrib "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -2613,6 +2641,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` ], "exchangeRateVTokens": "49.19405324154271215086", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -2696,6 +2725,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -2782,6 +2812,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -2854,6 +2885,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -2936,6 +2968,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -3043,6 +3076,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -3138,6 +3172,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -3215,6 +3250,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -3289,6 +3325,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -3365,6 +3402,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -3427,6 +3465,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -3503,6 +3542,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -3578,6 +3618,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -3679,6 +3720,7 @@ exports[`useGetPools > filters out Prime simulations that are 0 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", diff --git a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap index 4265efe23f..4bedff715a 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap +++ b/apps/evm/src/clients/api/queries/useGetPools/__tests__/__snapshots__/index.spec.ts.snap @@ -23,6 +23,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` ], "exchangeRateVTokens": "49.19405324154271215086", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -94,6 +95,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -180,6 +182,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -252,6 +255,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -323,6 +327,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -408,6 +413,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -492,6 +498,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -569,6 +576,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -631,6 +639,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -695,6 +704,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -757,6 +767,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -833,6 +844,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -896,6 +908,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -973,6 +986,7 @@ exports[`useGetPools > returns pools in the correct format 1`] = ` "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -1046,6 +1060,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct ], "exchangeRateVTokens": "49.19405324154271215086", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -1117,6 +1132,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -1203,6 +1219,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -1275,6 +1292,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -1346,6 +1364,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -1431,6 +1450,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -1515,6 +1535,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -1592,6 +1613,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -1654,6 +1676,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -1718,6 +1741,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -1780,6 +1804,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -1856,6 +1881,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -1919,6 +1945,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -1996,6 +2023,7 @@ exports[`useGetPools > returns pools with time based reward rates in the correct "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", @@ -2069,6 +2097,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = ], "exchangeRateVTokens": "49.19405324154271215086", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 0, "liquidityCents": "9.998358808049033258268439270234862259568416992e+22", @@ -2140,6 +2169,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "37.63966306652044917955", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "0", @@ -2226,6 +2256,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "5.63429988023545433776", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "367322.427136472011309675565022", @@ -2298,6 +2329,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "47.36910235297224095005", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 66, "liquidityCents": "1332106415.658306127885385733550383", @@ -2369,6 +2401,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "49.8066352191466231613", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1.000003658230657184839939048025550587141377317e+36", @@ -2454,6 +2487,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "47.12928141003911013496", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 89.10000000000001, "liquidityCents": "1.01017679492420109825145006688858448e+23", @@ -2538,6 +2572,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "0.99999847176819609601", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "264910628.128578051", @@ -2615,6 +2650,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "0.997398625122774492", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "10115894.213933673", @@ -2677,6 +2713,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "0.999999999999545", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "1103022783", @@ -2741,6 +2778,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "0.856077892298015039", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 49.50000000000001, "liquidityCents": "46.627361564366928016606869", @@ -2803,6 +2841,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 82.50000000000001, "liquidityCents": "600557.958", @@ -2879,6 +2918,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "0.9930076443898276885", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 71.5, "liquidityCents": "3256964.0339677929523638", @@ -2942,6 +2982,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "0.99998934225265418908", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": true, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "99810466.29625374", @@ -3019,6 +3060,7 @@ exports[`useGetPools > returns pools with user data in the correct format 1`] = "disabledTokenActions": [], "exchangeRateVTokens": "1", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 88.00000000000001, "liquidityCents": "999930", diff --git a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup/index.tsx similarity index 87% rename from apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx rename to apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup/index.tsx index 6e1b041c17..85d2431072 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup.tsx +++ b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/generateFakeEModeGroup/index.tsx @@ -66,14 +66,11 @@ export const generateFakeEModeGroup = ({ : convertFactorFromSmartContract({ factor: new BigNumber(market.collateralFactorMantissa), }) + 0.1, - liquidationThresholdPercentage: liquidationThresholdPercentage + 12, - liquidationPenaltyPercentage: liquidationThresholdPercentage - 50, + liquidationThresholdPercentage: i > 3 ? 0 : liquidationThresholdPercentage + 12, + liquidationPenaltyPercentage: i > 3 ? 0 : liquidationThresholdPercentage - 50, liquidityCents: liquidityTokens.multipliedBy(100).toNumber(), liquidityTokens, - isBorrowable: - underlyingToken.symbol !== 'XVS' && - underlyingToken.symbol !== 'BTCB' && - underlyingToken.symbol !== 'BUSD', + isBorrowable: i > 3, }; return [...acc, assetSettings]; diff --git a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts index cfdb833f18..36d6cff90c 100644 --- a/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts +++ b/apps/evm/src/clients/api/queries/useGetPools/getPools/formatOutput/index.ts @@ -80,7 +80,7 @@ export const formatOutput = ({ name: 'DeFi', tokens, chainId, - apiMarkets: apiPool.markets.slice(2, 8), + apiMarkets: apiPool.markets.slice(5, 12), }), generateFakeEModeGroup({ id: 2, @@ -153,6 +153,8 @@ export const formatOutput = ({ factor: new BigNumber(market.collateralFactorMantissa), }); + const isBorrowable = true; // TODO: fetch from API + let userCollateralFactor = collateralFactor; let isCollateralOfUser = !!userCollateralVTokenAddresses.some(address => areAddressesEqual(address, vToken.address), @@ -163,6 +165,7 @@ export const formatOutput = ({ ); let userLiquidationThresholdPercentage = liquidationThresholdPercentage; + let isBorrowableByUser = isBorrowable; if (userEModeGroup) { const eModeAssetSettings = userEModeGroup.assetSettings.find(settings => @@ -175,6 +178,10 @@ export const formatOutput = ({ // If user has enabled an E-mode group and that asset is not in it, then it doesn't count as a user collateral 0; + // If user has enabled an E-mode group and that asset is not in it, or is not borrowable in + // it, then it can't be borrowed by the user + isBorrowableByUser = eModeAssetSettings?.isBorrowable || false; + userLiquidationThresholdPercentage = eModeAssetSettings?.liquidationThresholdPercentage ?? liquidationThresholdPercentage; @@ -322,7 +329,8 @@ export const formatOutput = ({ userWalletBalanceCents, userCollateralFactor, userLiquidationThresholdPercentage, - isBorrowable: true, // TODO: get from API + isBorrowable, // TODO: get from API + isBorrowableByUser, // This will be calculated after all assets have been formatted userPercentOfLimit: 0, isCollateralOfUser, diff --git a/apps/evm/src/components/InfoIcon/index.tsx b/apps/evm/src/components/InfoIcon/index.tsx index 1b4c4e2678..b18dfecf0d 100644 --- a/apps/evm/src/components/InfoIcon/index.tsx +++ b/apps/evm/src/components/InfoIcon/index.tsx @@ -5,7 +5,7 @@ import { Icon, type IconName } from '../Icon'; import { Tooltip } from '../Tooltip'; export interface InfoIconProps { - tooltip: string | React.ReactElement; + tooltip: string | React.ReactNode; iconName?: IconName; iconClassName?: string; className?: string; diff --git a/apps/evm/src/components/Tooltip/index.tsx b/apps/evm/src/components/Tooltip/index.tsx index 962337cd27..fbd8031020 100644 --- a/apps/evm/src/components/Tooltip/index.tsx +++ b/apps/evm/src/components/Tooltip/index.tsx @@ -13,7 +13,7 @@ import { TooltipContent } from './TooltipContent'; export interface TooltipProps extends TooltipPrimitiveProps { className?: string; - content: string | React.ReactElement; + content: string | React.ReactNode; } export const Tooltip = ({ className, content, children, ...props }: TooltipProps) => { diff --git a/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap b/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap index 6600a0b0bd..754c682e38 100644 --- a/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/hooks/useGetProfitableImports/__tests__/__snapshots__/index.spec.tsx.snap @@ -64,6 +64,7 @@ exports[`useGetProfitableImports > returns profitable importable positions 1`] = ], "exchangeRateVTokens": "1", "isBorrowable": false, + "isBorrowableByUser": false, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "1702951959", @@ -204,6 +205,7 @@ exports[`useGetProfitableImports > returns profitable importable positions 1`] = ], "exchangeRateVTokens": "0.981982", "isBorrowable": true, + "isBorrowableByUser": true, "isCollateralOfUser": false, "liquidationThresholdPercentage": 80, "liquidityCents": "5534102886", diff --git a/apps/evm/src/libs/translations/translations/en.json b/apps/evm/src/libs/translations/translations/en.json index f1c3283243..b57d3b5b97 100644 --- a/apps/evm/src/libs/translations/translations/en.json +++ b/apps/evm/src/libs/translations/translations/en.json @@ -727,16 +727,25 @@ "pool": { "eMode": { "group": { + "cannotDisable": { + "tooltip": { + "blockingPositions": "You can't disable this e-mode group because you have borrow positions with assets that can't be borrowed from the pool. Show my positions", + "notEnoughCollateral": "You can't disable this e-mode group because your total collateral value would not cover your total borrow balance" + } + }, "cannotEnable": { "modal": { "description": "You will need to close the following borrow positions in order to enable the {{ eModeGroupName }} E-mode group:", "repayButtonLabel": "Repay", "title": "Your positions" }, - "tooltip": "You can't enable this E-mode group because you have borrow positions with assets that don't belong in that group. Show my positions" + "tooltip": { + "blockingPositions": "You can't enable this e-mode group because you have borrow positions with assets that don't belong in that group. Show my positions", + "notEnoughCollateral": "You can't enable this e-mode group because your total collateral value would not cover your total borrow balance" + } }, + "disableButtonLabel": "Disable", "enableButtonLabel": "Enable", - "enabledButtonLabel": "Enabled", "healthFactor": "Health factor:", "switchButtonLabel": "Switch" }, diff --git a/apps/evm/src/pages/Pool/Assets/index.tsx b/apps/evm/src/pages/Pool/Assets/index.tsx index 4df2b439d7..5e9e497489 100644 --- a/apps/evm/src/pages/Pool/Assets/index.tsx +++ b/apps/evm/src/pages/Pool/Assets/index.tsx @@ -7,36 +7,34 @@ export interface AssetsProps { pool: Pool; } -export const Assets: React.FC = ({ pool }) => { - return ( -
- +export const Assets: React.FC = ({ pool }) => ( +
+ - 0 && ( - - ) - } - /> -
- ); -}; + 0 && ( + + ) + } + /> +
+); diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/getHypotheticalAssetValues/index.ts b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/getHypotheticalAssetValues/index.ts new file mode 100644 index 0000000000..d8db82bc9a --- /dev/null +++ b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/getHypotheticalAssetValues/index.ts @@ -0,0 +1,41 @@ +export const getHypotheticalAssetValues = ({ + userSupplyBalanceCents, + userBorrowBalanceCents, + isBorrowable, + isCollateralOfUser, + collateralFactor, + liquidationThresholdPercentage, +}: { + userSupplyBalanceCents: number; + userBorrowBalanceCents: number; + isBorrowable: boolean; + isCollateralOfUser: boolean; + collateralFactor: number; + liquidationThresholdPercentage: number; +}) => { + let isBlocking = false; + let liquidationThresholdCents = 0; + let borrowLimitCents = 0; + let borrowBalanceCents = 0; + + if (!isBorrowable && userBorrowBalanceCents > 0) { + isBlocking = true; + } + + if (isBorrowable) { + borrowBalanceCents += userBorrowBalanceCents; + } + + if (!!collateralFactor && !!liquidationThresholdPercentage && isCollateralOfUser) { + borrowLimitCents += userSupplyBalanceCents * collateralFactor; + + liquidationThresholdCents += (userSupplyBalanceCents * liquidationThresholdPercentage) / 100; + } + + return { + isBlocking, + liquidationThresholdCents, + borrowLimitCents, + borrowBalanceCents, + }; +}; diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx index 0223a1c3b0..47f9fe7007 100644 --- a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx +++ b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/Header/index.tsx @@ -3,10 +3,11 @@ import { cn } from '@venusprotocol/ui'; import { Button, Icon, InfoIcon } from 'components'; import { useTranslation } from 'libs/translations'; import { useState } from 'react'; -import type { EModeGroup, Pool } from 'types'; -import { calculateHealthFactor } from 'utilities'; +import type { Asset, EModeGroup, Pool } from 'types'; +import { areTokensEqual, calculateHealthFactor } from 'utilities'; import { BlockingPositionModal } from './BlockingPositionModal'; import { HealthFactorUpdate } from './HealthFactorUpdate'; +import { getHypotheticalAssetValues } from './getHypotheticalAssetValues'; export interface HeaderProps { pool: Pool; @@ -24,6 +25,9 @@ export const Header: React.FC = ({ eModeGroup, pool, className }) = // TODO: wire up const enableEModeGroup = () => {}; + // TODO: wire up + const disableEModeGroup = () => {}; + const poolUserHealthFactor = pool.userLiquidationThresholdCents && pool.userBorrowBalanceCents && @@ -34,77 +38,135 @@ export const Header: React.FC = ({ eModeGroup, pool, className }) = const isEModeGroupEnabled = pool.userEModeGroup && pool.userEModeGroup.id === eModeGroup.id; - // TODO: pass actual blocking assets - const blockingAssets = pool.assets.slice(0, 3); - - const isUserEligible = blockingAssets.length === 0; - - // TODO: calculate - const hypotheticalPoolUserHealthFactor = 8.4; + // These values are used to determine if a user can enable the E-mode group if it's not enabled + // already, or disable it if it's enabled + const userBlockingAssets: Asset[] = []; + let hypotheticalUserLiquidationThresholdCents = 0; + let hypotheticalUserBorrowLimitCents = 0; + let hypotheticalUserBorrowBalanceCents = 0; + + pool.assets.forEach(asset => { + const assetSettings = eModeGroup.assetSettings.find(settings => + areTokensEqual(settings.vToken, asset.vToken), + ); + + const { isBlocking, liquidationThresholdCents, borrowLimitCents, borrowBalanceCents } = + getHypotheticalAssetValues({ + userSupplyBalanceCents: asset.userSupplyBalanceCents.toNumber(), + userBorrowBalanceCents: asset.userBorrowBalanceCents.toNumber(), + isCollateralOfUser: asset.isCollateralOfUser, + isBorrowable: isEModeGroupEnabled ? asset.isBorrowable : !!assetSettings?.isBorrowable, + collateralFactor: isEModeGroupEnabled + ? asset.collateralFactor + : assetSettings?.collateralFactor ?? 0, + liquidationThresholdPercentage: isEModeGroupEnabled + ? asset.liquidationThresholdPercentage + : assetSettings?.liquidationThresholdPercentage ?? 0, + }); + + if (isBlocking) { + userBlockingAssets.push(asset); + } + + hypotheticalUserLiquidationThresholdCents += liquidationThresholdCents; + hypotheticalUserBorrowLimitCents += borrowLimitCents; + hypotheticalUserBorrowBalanceCents += borrowBalanceCents; + }); + + const userHasBlockingPositions = userBlockingAssets.length > 0; + const userHasEnoughCollateral = + hypotheticalUserBorrowLimitCents >= hypotheticalUserBorrowBalanceCents; + const isButtonEnabled = !userHasBlockingPositions && userHasEnoughCollateral; + + const hypotheticalUserHealthFactor = calculateHealthFactor({ + liquidationThresholdCents: hypotheticalUserLiquidationThresholdCents, + borrowBalanceCents: hypotheticalUserBorrowBalanceCents, + }); + + const shouldDisplayHealthFactor = + isButtonEnabled && !!pool.userBorrowBalanceCents?.isGreaterThan(0); let buttonLabel = t('pool.eMode.group.enableButtonLabel'); if (isEModeGroupEnabled) { - buttonLabel = t('pool.eMode.group.enabledButtonLabel'); - } else if (pool.userEModeGroup && !isEModeGroupEnabled && isUserEligible) { + buttonLabel = t('pool.eMode.group.disableButtonLabel'); + } else if (pool.userEModeGroup) { buttonLabel = t('pool.eMode.group.switchButtonLabel'); } + let disabledTooltip: string | React.ReactNode | undefined; + + if (!isButtonEnabled && !userHasEnoughCollateral) { + disabledTooltip = isEModeGroupEnabled + ? t('pool.eMode.group.cannotDisable.tooltip.notEnoughCollateral') + : t('pool.eMode.group.cannotEnable.tooltip.notEnoughCollateral'); + } else if (!isButtonEnabled && userHasBlockingPositions) { + disabledTooltip = ( + + ), + }} + /> + ); + } + return ( <>
-

{eModeGroup.name}

+
+

{eModeGroup.name}

+ + {isEModeGroupEnabled && } +
- {!!poolUserHealthFactor && !isEModeGroupEnabled && isUserEligible && ( - - )} + {shouldDisplayHealthFactor && + !!poolUserHealthFactor && + !isEModeGroupEnabled && + isButtonEnabled && ( + + )}
- {!!poolUserHealthFactor && !isEModeGroupEnabled && isUserEligible && ( + {!!poolUserHealthFactor && !isEModeGroupEnabled && isButtonEnabled && ( )}
@@ -112,7 +174,7 @@ export const Header: React.FC = ({ eModeGroup, pool, className }) = {isBlockingPositionModalOpen && ( diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/__snapshots__/index.spec.tsx.snap b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/__snapshots__/index.spec.tsx.snap new file mode 100644 index 0000000000..31616cf80e --- /dev/null +++ b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/__snapshots__/index.spec.tsx.snap @@ -0,0 +1,7 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`EModeGroup > lets user disable E-mode group when they meet the criteria 1`] = `"StablecoinsDisableXVSBorrowableLiquidity10 XVS$80.36MMax LTV60%Liquidation threshold62%Liquidation penalty0%USDCNot borrowableLiquidity10 USDC$17.02MMax LTV90%Liquidation threshold92%Liquidation penalty30%USDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%StablecoinsDisableFake labelvXVSvUSDCvUSDTvXVSvUSDCvUSDT"`; + +exports[`EModeGroup > lets user enable E-mode group when they meet the criteria 1`] = `"StablecoinsHealth factor:15.62> 100EnableHealth factor:15.62> 100XVSBorrowableLiquidity10 XVS$80.36MMax LTV60%Liquidation threshold62%Liquidation penalty0%USDCNot borrowableLiquidity10 USDC$17.02MMax LTV90%Liquidation threshold92%Liquidation penalty30%USDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%StablecoinsHealth factor:15.62> 100EnableHealth factor:15.62> 100Fake labelvXVSvUSDCvUSDTvXVSvUSDCvUSDT"`; + +exports[`EModeGroup > lets user switch E-mode group when they meet the criteria 1`] = `"DeFiHealth factor:15.6292SwitchHealth factor:15.6292USDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%BUSDBorrowableLiquidity10 BUSD$36.54MMax LTV90%Liquidation threshold92%Liquidation penalty30%DeFiHealth factor:15.6292SwitchHealth factor:15.6292Fake labelvUSDTvBUSDvUSDTvBUSD"`; diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/index.spec.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/index.spec.tsx new file mode 100644 index 0000000000..63b4142fec --- /dev/null +++ b/apps/evm/src/pages/Pool/Tabs/EMode/EModeGroup/__tests__/index.spec.tsx @@ -0,0 +1,222 @@ +import BigNumber from 'bignumber.js'; + +import { poolData } from '__mocks__/models/pools'; +import type { Order, TableColumn } from 'components'; +import { en } from 'libs/translations'; +import { renderComponent } from 'testUtils/render'; +import type { EModeAssetSettings, Pool } from 'types'; +import { areTokensEqual } from 'utilities'; +import { EModeGroup, type EModeGroupProps } from '..'; + +const fakeColumns: TableColumn[] = [ + { + key: 'fake-key', + label: 'Fake label', + selectOptionLabel: 'Fake select option label', + renderCell: ({ vToken }) => vToken.symbol, + }, +]; + +const fakeOrder: Order = { + orderBy: fakeColumns[0], + orderDirection: 'desc', +}; + +const fakePool = poolData[0]; + +const baseProps: EModeGroupProps = { + pool: fakePool, + eModeGroup: fakePool.eModeGroups[0], + columns: fakeColumns, + initialOrder: fakeOrder, + mobileOrder: fakeOrder, +}; + +describe('EModeGroup', () => { + it('lets user enable E-mode group when they meet the criteria', async () => { + const fakeEModeGroup = baseProps.eModeGroup; + + const customFakePool: Pool = { + ...baseProps.pool, + userEModeGroup: undefined, + assets: fakePool.assets.map(asset => ({ + ...asset, + userBorrowBalanceCents: new BigNumber(0), + userSupplyBalanceCents: new BigNumber(10000), + isCollateralOfUser: true, + })), + }; + + const { queryAllByText, container } = renderComponent( + , + ); + + expect(container.textContent).toMatchSnapshot(); + + expect( + queryAllByText(en.pool.eMode.group.enableButtonLabel)[0].closest('button'), + ).toBeEnabled(); + + // TODO: check clicking on button calls correct function + }); + + it('lets user disable E-mode group when they meet the criteria', async () => { + const fakeEModeGroup = baseProps.eModeGroup; + + const customFakePool: Pool = { + ...baseProps.pool, + userEModeGroup: fakeEModeGroup, + assets: fakePool.assets.map(asset => ({ + ...asset, + userBorrowBalanceCents: new BigNumber( + fakeEModeGroup.assetSettings.find( + settings => settings.isBorrowable && areTokensEqual(settings.vToken, asset.vToken), + ) + ? 100 + : 0, + ), + userSupplyBalanceCents: new BigNumber(10000), + })), + }; + + const { queryAllByText, container } = renderComponent( + , + ); + + expect(container.textContent).toMatchSnapshot(); + + expect( + queryAllByText(en.pool.eMode.group.disableButtonLabel)[0].closest('button'), + ).toBeEnabled(); + + // TODO: check clicking on button calls correct function + }); + + it('lets user switch E-mode group when they meet the criteria', async () => { + const fakeEModeGroup = fakePool.eModeGroups[1]; + + const customFakePool: Pool = { + ...baseProps.pool, + userEModeGroup: fakePool.eModeGroups[0], + assets: fakePool.assets.map(asset => { + const assetSettings = fakeEModeGroup.assetSettings.find(settings => + areTokensEqual(settings.vToken, asset.vToken), + ); + + return { + ...asset, + userBorrowBalanceCents: new BigNumber(assetSettings?.isBorrowable ? 100 : 0), + userSupplyBalanceCents: new BigNumber(assetSettings ? 10000 : 0), + isCollateralOfUser: true, + }; + }), + }; + + const { queryAllByText, container } = renderComponent( + , + ); + + expect(container.textContent).toMatchSnapshot(); + + expect( + queryAllByText(en.pool.eMode.group.switchButtonLabel)[0].closest('button'), + ).toBeEnabled(); + + // TODO: check clicking on button calls correct function + }); + + describe.each([ + ['enable', undefined, fakePool.eModeGroups[0], en.pool.eMode.group.enableButtonLabel], + [ + 'switch', + fakePool.eModeGroups[0], + fakePool.eModeGroups[1], + en.pool.eMode.group.switchButtonLabel, + ], + ])('error states', (action, userEModeGroup, eModeGroup, buttonLabel) => { + it(`does not let user ${action} E-mode group if they have blocking borrow positions`, async () => { + const customFakePool: Pool = { + ...baseProps.pool, + userEModeGroup, + assets: fakePool.assets.map(asset => ({ + ...asset, + userBorrowBalanceCents: new BigNumber(100), + userSupplyBalanceCents: new BigNumber(10000), + })), + }; + + const { queryAllByText } = renderComponent( + , + ); + + expect(queryAllByText(buttonLabel)[0].closest('button')).toBeDisabled(); + }); + + it(`does not let user ${action} E-mode group if their collateral value would not cover their borrow balance`, async () => { + const customFakePool: Pool = { + ...baseProps.pool, + userEModeGroup, + assets: fakePool.assets.map(asset => ({ + ...asset, + collateralFactor: 0, + userCollateralFactor: 0.9, + userBorrowBalanceCents: new BigNumber(100), + userSupplyBalanceCents: new BigNumber(10000), + })), + }; + + const { queryAllByText } = renderComponent( + , + ); + + expect(queryAllByText(buttonLabel)[0].closest('button')).toBeDisabled(); + }); + }); + + it('does not let user disable E-mode group if they have blocking borrow positions', async () => { + const fakeEModeGroup = fakePool.eModeGroups[0]; + + const customFakePool: Pool = { + ...baseProps.pool, + userEModeGroup: fakeEModeGroup, + assets: fakePool.assets.map(asset => ({ + ...asset, + isCollateralOfUser: true, + userBorrowBalanceCents: new BigNumber(100), + userSupplyBalanceCents: new BigNumber(10000), + })), + }; + + const { queryAllByText } = renderComponent( + , + ); + + expect( + queryAllByText(en.pool.eMode.group.disableButtonLabel)[0].closest('button'), + ).toBeDisabled(); + }); + + it('does not let user disable E-mode group if their collateral value would not cover their borrow balance', async () => { + const fakeEModeGroup = fakePool.eModeGroups[0]; + + const customFakePool: Pool = { + ...baseProps.pool, + userEModeGroup: fakeEModeGroup, + assets: fakePool.assets.map(asset => ({ + ...asset, + collateralFactor: 0, + userCollateralFactor: 0.9, + userBorrowBalanceCents: new BigNumber(asset.isBorrowable ? 100 : 0), + userSupplyBalanceCents: new BigNumber(10000), + })), + }; + + const { queryAllByText } = renderComponent( + , + ); + + expect( + queryAllByText(en.pool.eMode.group.disableButtonLabel)[0].closest('button'), + ).toBeDisabled(); + }); +}); diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx index cd9ff1f509..e68af249bd 100644 --- a/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx +++ b/apps/evm/src/pages/Pool/Tabs/EMode/index.tsx @@ -22,9 +22,6 @@ export interface EModeProps { } export const EMode: React.FC = ({ pool, searchValue, onSearchValueChange }) => { - const handleSearchInputChange: InputHTMLAttributes['onChange'] = changeEvent => - onSearchValueChange(changeEvent.currentTarget.value); - const { t, Trans } = useTranslation(); const columns = useGetColumns(); @@ -63,6 +60,9 @@ export const EMode: React.FC = ({ pool, searchValue, onSearchValueCh } }; + const handleSearchInputChange: InputHTMLAttributes['onChange'] = changeEvent => + onSearchValueChange(changeEvent.currentTarget.value); + // Handle search const filteredEModeGroups = pool.eModeGroups.reduce((acc, eModeGroup) => { const searchMatches = (value: string) => diff --git a/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx b/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx index 9d7e27bfdf..96b396db8c 100644 --- a/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx +++ b/apps/evm/src/pages/Pool/Tabs/EMode/useGetColumns/index.tsx @@ -26,6 +26,7 @@ export const useGetColumns = () => { renderCell: ({ collateralFactor }) => formatPercentageToReadableValue(collateralFactor * 100), sortRows: (rowA, rowB, direction) => compareNumbers(rowA.collateralFactor, rowB.collateralFactor, direction), + align: 'right', }, { key: 'liquidationThreshold', @@ -41,6 +42,7 @@ export const useGetColumns = () => { rowB.liquidationThresholdPercentage, direction, ), + align: 'right', }, { key: 'liquidationPenalty', @@ -56,6 +58,7 @@ export const useGetColumns = () => { rowB.liquidationPenaltyPercentage, direction, ), + align: 'right', }, { key: 'isBorrowable', @@ -64,11 +67,12 @@ export const useGetColumns = () => { renderCell: ({ isBorrowable }) => ( ), sortRows: (rowA, rowB, direction) => compareBooleans(rowA.isBorrowable, rowB.isBorrowable, direction), + align: 'right', }, ]; diff --git a/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap b/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap index c871a66db3..fc2c16b0ba 100644 --- a/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap +++ b/apps/evm/src/pages/Pool/__tests__/__snapshots__/index.eMode.spec.tsx.snap @@ -2,6 +2,6 @@ exports[`Pool - Feature flag enabled: E-mode > Assets tab > renders correctly when pool has E-mode groups 1`] = `"AssetsE-modeNewTotal supply$20.99TTotal borrow$8.58TAvailable liquidity$12.4TAssets4StablecoinsManage E-modePaused assetsAssetTotal supplySupply APY sorted descendingTotal borrowBorrow APY LiquidityUSDT> 100T USDT$10.98T4.02%5.77%232.51M USDT$31.58M-5.50%-6.51%10 USDT$55.34MBUSD> 100T BUSD$10.54B3.56%5.32%142.66M BUSD$839.1M-5.82%10 BUSD$36.54MXVS> 100T XVS$2.78M0.17%1.85M XVS$709.25K-6.48%10 XVS$80.36MSort bySupply APY / LTVUSDTTotal supply> 100T USDT$10.98TSupply APY 4.02%5.77%Total borrow232.51M USDT$31.58MBorrow APY -5.50%-6.51%Liquidity10 USDT$55.34MBUSDTotal supply> 100T BUSD$10.54BSupply APY 3.56%5.32%Total borrow142.66M BUSD$839.1MBorrow APY -5.82%Liquidity10 BUSD$36.54MXVSTotal supply> 100T XVS$2.78MSupply APY 0.17%Total borrow1.85M XVS$709.25KBorrow APY -6.48%Liquidity10 XVS$80.36M"`; -exports[`Pool - Feature flag enabled: E-mode > E-mode tab > filters assets correctly when using search 1`] = `"AssetsE-modeEnabling E-Mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. Learn moreSort by:Max LTVStablecoinsEnabledStablecoinsEnabledAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableSort byMax LTVDeFiEnableBUSDBorrowableLiquidity10 BUSD$36.54MMax LTV90%Liquidation threshold92%Liquidation penalty30%DeFiEnableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableBUSD90%92%30%Sort byMax LTVBUSDMax LTV90%Liquidation threshold92%Liquidation penalty30%Borrowable"`; +exports[`Pool - Feature flag enabled: E-mode > E-mode tab > filters assets correctly when using search 1`] = `"AssetsE-modeEnabling E-Mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. Learn moreSort by:Max LTVStablecoinsDisableStablecoinsDisableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableSort byMax LTVDeFiSwitchBUSDBorrowableLiquidity10 BUSD$36.54MMax LTV90%Liquidation threshold92%Liquidation penalty30%DeFiSwitchAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableBUSD90%92%30%Sort byMax LTVBUSDMax LTV90%Liquidation threshold92%Liquidation penalty30%Borrowable"`; -exports[`Pool - Feature flag enabled: E-mode > E-mode tab > renders correctly 1`] = `"AssetsE-modeEnabling E-Mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. Learn moreSort by:Max LTVStablecoinsEnabledUSDCNot borrowableLiquidity10 USDC$17.02MMax LTV90%Liquidation threshold92%Liquidation penalty30%USDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%XVSBorrowableLiquidity10 XVS$80.36MMax LTV60%Liquidation threshold62%Liquidation penalty0%StablecoinsEnabledAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableUSDC90%92%30%USDT90%92%30%XVS60%62%0%Sort byMax LTVUSDCMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableUSDTMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableXVSMax LTV60%Liquidation threshold62%Liquidation penalty0%BorrowableDeFiEnableUSDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%BUSDBorrowableLiquidity10 BUSD$36.54MMax LTV90%Liquidation threshold92%Liquidation penalty30%DeFiEnableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableUSDT90%92%30%BUSD90%92%30%Sort byMax LTVUSDTMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableBUSDMax LTV90%Liquidation threshold92%Liquidation penalty30%Borrowable#ToTheMoonEnable#ToTheMoonEnableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableSort byMax LTV"`; +exports[`Pool - Feature flag enabled: E-mode > E-mode tab > renders correctly 1`] = `"AssetsE-modeEnabling E-Mode allows you to maximize your borrowing power, however, borrowing is restricted to assets within the selected group. Learn moreSort by:Max LTVStablecoinsDisableUSDCNot borrowableLiquidity10 USDC$17.02MMax LTV90%Liquidation threshold92%Liquidation penalty30%USDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%XVSBorrowableLiquidity10 XVS$80.36MMax LTV60%Liquidation threshold62%Liquidation penalty0%StablecoinsDisableAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableUSDC90%92%30%USDT90%92%30%XVS60%62%0%Sort byMax LTVUSDCMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableUSDTMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableXVSMax LTV60%Liquidation threshold62%Liquidation penalty0%BorrowableDeFiSwitchUSDTBorrowableLiquidity10 USDT$55.34MMax LTV90%Liquidation threshold92%Liquidation penalty30%BUSDBorrowableLiquidity10 BUSD$36.54MMax LTV90%Liquidation threshold92%Liquidation penalty30%DeFiSwitchAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableUSDT90%92%30%BUSD90%92%30%Sort byMax LTVUSDTMax LTV90%Liquidation threshold92%Liquidation penalty30%BorrowableBUSDMax LTV90%Liquidation threshold92%Liquidation penalty30%Borrowable#ToTheMoonSwitch#ToTheMoonSwitchAssetMax LTVsorted descendingLiquidation thresholdLiquidation penaltyBorrowableSort byMax LTV"`; diff --git a/apps/evm/src/pages/Vai/AccountVaiData/index.tsx b/apps/evm/src/pages/Vai/AccountVaiData/index.tsx index 002fa5d197..f724a1d0f5 100644 --- a/apps/evm/src/pages/Vai/AccountVaiData/index.tsx +++ b/apps/evm/src/pages/Vai/AccountVaiData/index.tsx @@ -95,6 +95,7 @@ export const AccountVaiData: React.FC = ({ amountTokens, ac borrowPointDistributions: [], disabledTokenActions: [], isCollateralOfUser: false, + isBorrowableByUser: true, isBorrowable: true, userCollateralFactor: 0, collateralFactor: 0, diff --git a/apps/evm/src/types/index.ts b/apps/evm/src/types/index.ts index 5f78aa5faf..e0b4fc6aa2 100644 --- a/apps/evm/src/types/index.ts +++ b/apps/evm/src/types/index.ts @@ -154,6 +154,7 @@ export interface Asset { userCollateralFactor: number; userLiquidationThresholdPercentage: number; userPercentOfLimit: number; + isBorrowableByUser: boolean; isCollateralOfUser: boolean; } From 2a857a1390ad58593b1dc284d3def9011ec4c31b Mon Sep 17 00:00:00 2001 From: therealemjy Date: Fri, 12 Sep 2025 08:36:55 +0200 Subject: [PATCH 4/4] chore: add changeset --- .changeset/thin-groups-dig.md | 5 +++++ apps/evm/src/components/Apy/index.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/thin-groups-dig.md diff --git a/.changeset/thin-groups-dig.md b/.changeset/thin-groups-dig.md new file mode 100644 index 0000000000..422e5410f2 --- /dev/null +++ b/.changeset/thin-groups-dig.md @@ -0,0 +1,5 @@ +--- +"@venusprotocol/evm": minor +--- + +add group logic to E-mode diff --git a/apps/evm/src/components/Apy/index.tsx b/apps/evm/src/components/Apy/index.tsx index c27f77d85d..3d1bb5a48a 100644 --- a/apps/evm/src/components/Apy/index.tsx +++ b/apps/evm/src/components/Apy/index.tsx @@ -46,7 +46,7 @@ export const Apy: React.FC = ({ asset, type, className }) => { }); const isPrimeAsset = !!(primeDistribution || primeSimulationDistribution); - const shouldBeGreyedOut = type === 'borrow' && !asset.isBorrowable; + const shouldBeGreyedOut = type === 'borrow' && !asset.isBorrowableByUser; let simulatedApyPercentage: BigNumber | undefined; const isApyBoostedByPrime = primeDistribution && !primeDistribution.apyPercentage.isEqualTo(0);