From e0c71af75543f89becdd3ba145a5fa49a870af3d Mon Sep 17 00:00:00 2001 From: Marcin Ciarka Date: Wed, 3 Apr 2024 14:09:19 +0200 Subject: [PATCH] Fix omni aave/spark earn/borrow/multiply switching --- features/omni-kit/controllers/OmniProductController.tsx | 9 ++++----- features/omni-kit/observables/getDpmPositionData.ts | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/features/omni-kit/controllers/OmniProductController.tsx b/features/omni-kit/controllers/OmniProductController.tsx index 6d53603d8b..4db1db29f8 100644 --- a/features/omni-kit/controllers/OmniProductController.tsx +++ b/features/omni-kit/controllers/OmniProductController.tsx @@ -21,13 +21,12 @@ import { import type { GetOmniMetadata, OmniFormDefaults, - OmniProductType, OmniProtocolHookProps, OmniProtocolSettings, OmniSupportedNetworkIds, OmniSupportedProtocols, } from 'features/omni-kit/types' -import { OmniSidebarAutomationStep } from 'features/omni-kit/types' +import { OmniProductType, OmniSidebarAutomationStep } from 'features/omni-kit/types' import type { PositionHistoryEvent } from 'features/positionHistory/types' import { WithTermsOfService } from 'features/termsOfService/TermsOfService' import { WithWalletAssociatedRisk } from 'features/walletAssociatedRisk/WalletAssociatedRisk' @@ -161,9 +160,9 @@ export const OmniProductController = ({ const isYieldLoop = getOmniIsOmniYieldLoop({ collateralToken, pseudoProtocol, quoteToken }) // Flag to determine whether full yield-loop UI experience is available for given protocol & pair - const isYieldLoopWithData = !!settings.yieldLoopPairsWithData?.[networkId]?.includes( - `${collateralToken}-${quoteToken}`, - ) + const isYieldLoopWithData = + !!settings.yieldLoopPairsWithData?.[networkId]?.includes(`${collateralToken}-${quoteToken}`) && + dpmPositionData?.product === OmniProductType.Multiply return ( diff --git a/features/omni-kit/observables/getDpmPositionData.ts b/features/omni-kit/observables/getDpmPositionData.ts index b8d36b01f2..1c3fd425ac 100644 --- a/features/omni-kit/observables/getDpmPositionData.ts +++ b/features/omni-kit/observables/getDpmPositionData.ts @@ -44,7 +44,7 @@ const mapAaveYieldLoopToMultiply = ({ isCorrelatedPosition(collateralToken, quoteToken) && [LendingProtocol.SparkV3, LendingProtocol.AaveV3, LendingProtocol.AaveV2].includes(protocol) ) { - return 'Multiply' + return 'Multiply' as PositionType } return positionType