diff --git a/features/omni-kit/protocols/aave-like/helpers/getAaveLikeParameters.ts b/features/omni-kit/protocols/aave-like/helpers/getAaveLikeParameters.ts index d29686d4d8..d9931ab043 100644 --- a/features/omni-kit/protocols/aave-like/helpers/getAaveLikeParameters.ts +++ b/features/omni-kit/protocols/aave-like/helpers/getAaveLikeParameters.ts @@ -38,7 +38,11 @@ import type { OmniFormState, OmniSupportedNetworkIds, } from 'features/omni-kit/types' -import { OmniBorrowFormAction, OmniMultiplyFormAction } from 'features/omni-kit/types' +import { + OmniBorrowFormAction, + OmniMultiplyFormAction, + OmniProductType, +} from 'features/omni-kit/types' import { zero } from 'helpers/zero' import type { AaveLikeLendingProtocol } from 'lendingProtocols' import { LendingProtocol } from 'lendingProtocols' @@ -132,11 +136,20 @@ export const getAaveLikeParameters = async ({ positionType: 'Borrow' as PositionType, } + // entry token different from collateral token applies only for multiply (if defined) + const resolvedEntryToken = + state.productType === OmniProductType.Multiply + ? { + symbol: entryToken.symbol as AaveLikeTokens, + precision: entryToken.precision, + } + : { + symbol: collateralToken as AaveLikeTokens, + precision: collateralPrecision, + } + const adjustMultiplyPayload = { - entryToken: { - symbol: entryToken.symbol as AaveLikeTokens, - precision: entryToken.precision, - }, + entryToken: resolvedEntryToken, position, slippage, debtToken: { diff --git a/features/omni-kit/protocols/aave-like/metadata/useAaveLikeMetadata.tsx b/features/omni-kit/protocols/aave-like/metadata/useAaveLikeMetadata.tsx index 4ab4eb35cf..dad11d88ce 100644 --- a/features/omni-kit/protocols/aave-like/metadata/useAaveLikeMetadata.tsx +++ b/features/omni-kit/protocols/aave-like/metadata/useAaveLikeMetadata.tsx @@ -4,6 +4,7 @@ import { AaveLiquidatedNotice } from 'features/notices/VaultsNoticesView' import { getAutomationMetadataValues } from 'features/omni-kit/automation/helpers' import { useOmniGeneralContext } from 'features/omni-kit/contexts' import { + getOmniBorrowDebtMax, getOmniBorrowishChangeVariant, getOmniBorrowPaybackMax, getOmniIsFormEmpty, @@ -48,6 +49,7 @@ export const useAaveLikeMetadata: GetOmniMetadata = (productContext) => { quoteAddress, quoteBalance, quoteToken, + quotePrecision, }, steps: { currentStep }, tx: { txDetails }, @@ -123,7 +125,11 @@ export const useAaveLikeMetadata: GetOmniMetadata = (productContext) => { afterBuyingPower: simulation?.buyingPower, shouldShowDynamicLtv: () => false, debtMin: zero, - debtMax: position.debtAvailable(), + debtMax: getOmniBorrowDebtMax({ + digits: quotePrecision, + position, + simulation, + }), changeVariant: getOmniBorrowishChangeVariant({ simulation, isOracless }), afterAvailableToBorrow: simulation && simulation.debtAvailable(), afterPositionDebt: resolvedSimulation?.debtAmount, diff --git a/features/omni-kit/protocols/aave/settings.ts b/features/omni-kit/protocols/aave/settings.ts index 17b8c2edd0..5ad8bf43da 100644 --- a/features/omni-kit/protocols/aave/settings.ts +++ b/features/omni-kit/protocols/aave/settings.ts @@ -106,6 +106,7 @@ export const settingsV3: OmniProtocolSettings = { }, }, entryTokens: { + // entry token different from collateral token applies only for multiply (if defined) [NetworkIds.MAINNET]: { 'WSTETH-ETH': 'ETH' }, }, availableAutomations: { diff --git a/features/omni-kit/views/OmniFormView.tsx b/features/omni-kit/views/OmniFormView.tsx index e28c11c215..602dc580e4 100644 --- a/features/omni-kit/views/OmniFormView.tsx +++ b/features/omni-kit/views/OmniFormView.tsx @@ -25,7 +25,7 @@ import { } from 'features/omni-kit/helpers' import { getOmniSidebarRaysBanner } from 'features/omni-kit/helpers/getOmniSidebarRaysBanner' import { useOmniProductTypeTransition, useOmniSidebarTitle } from 'features/omni-kit/hooks' -import { OmniSidebarStep } from 'features/omni-kit/types' +import { OmniProductType, OmniSidebarStep } from 'features/omni-kit/types' import { useConnection } from 'features/web3OnBoard/useConnection' import { getLocalAppConfig } from 'helpers/config' import { useModalContext } from 'helpers/modalHook' @@ -126,6 +126,10 @@ export function OmniFormView({ const genericSidebarTitle = useOmniSidebarTitle() + // entry token different from collateral token applies only for multiply (if defined) + const resolvedEntryToken = + state.productType === OmniProductType.Multiply ? entryToken.symbol : collateralToken + const flowState = useFlowState({ pairId, protocol, @@ -134,7 +138,7 @@ export function OmniFormView({ ...getOmniFlowStateConfig({ protocol, collateralToken, - entryToken: entryToken.symbol, + entryToken: resolvedEntryToken, fee: interestRate, isOpening, quoteToken, diff --git a/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/arbitrum-mainnet.ts b/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/arbitrum-mainnet.ts index 2adc6189d0..9b49076b8f 100644 --- a/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/arbitrum-mainnet.ts +++ b/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/arbitrum-mainnet.ts @@ -65,13 +65,13 @@ const aaveSeed: AaveProductHubItemSeed[] = [ collateral: 'wstETH', debt: 'ETH', strategyType: 'long', - types: ['borrow', 'earn'], + types: ['earn'], }, { collateral: 'rETH', debt: 'ETH', strategyType: 'long', - types: ['borrow', 'earn'], + types: ['earn'], }, { collateral: 'DAI', diff --git a/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/ethereum-mainnet.ts b/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/ethereum-mainnet.ts index f2f6c88fd4..05c3c9388d 100644 --- a/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/ethereum-mainnet.ts +++ b/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/ethereum-mainnet.ts @@ -21,16 +21,6 @@ export const aaveV3EthereumMainnetProductHubProducts: ProductHubItemWithoutAddre earnStrategyDescription: 'WSTETH/ETH Yield Loop', managementType: 'active', }, - { - product: [OmniProductType.Borrow], - primaryToken: 'WSTETH', - primaryTokenGroup: 'ETH', - secondaryToken: 'ETH', - depositToken: 'WSTETH', - label: 'WSTETH/ETH', - network: NetworkNames.ethereumMainnet, - protocol: LendingProtocol.AaveV3, - }, { product: [OmniProductType.Earn], primaryToken: 'RETH', @@ -44,16 +34,6 @@ export const aaveV3EthereumMainnetProductHubProducts: ProductHubItemWithoutAddre earnStrategyDescription: 'RETH/ETH Yield Loop', managementType: 'active', }, - { - product: [OmniProductType.Borrow], - primaryToken: 'RETH', - primaryTokenGroup: 'ETH', - secondaryToken: 'ETH', - depositToken: 'RETH', - label: 'RETH/ETH', - network: NetworkNames.ethereumMainnet, - protocol: LendingProtocol.AaveV3, - }, { product: [OmniProductType.Earn], primaryToken: 'CBETH', @@ -83,16 +63,6 @@ export const aaveV3EthereumMainnetProductHubProducts: ProductHubItemWithoutAddre liquidity: { ...productHubWeETHRewardsTooltip }, }, }, - { - product: [OmniProductType.Borrow], - primaryToken: 'CBETH', - primaryTokenGroup: 'ETH', - secondaryToken: 'ETH', - depositToken: 'CBETH', - label: 'CBETH/ETH', - network: NetworkNames.ethereumMainnet, - protocol: LendingProtocol.AaveV3, - }, { product: [OmniProductType.Multiply], primaryToken: 'ETH', @@ -386,16 +356,6 @@ export const aaveV3EthereumMainnetProductHubProducts: ProductHubItemWithoutAddre earnStrategyDescription: 'SDAI/USDC Yield Loop', managementType: 'active', }, - { - product: [OmniProductType.Borrow], - primaryToken: 'SDAI', - primaryTokenGroup: 'DAI', - secondaryToken: 'USDC', - depositToken: 'SDAI', - label: 'SDAI/USDC', - network: NetworkNames.ethereumMainnet, - protocol: LendingProtocol.AaveV3, - }, { product: [OmniProductType.Earn], primaryToken: 'SDAI', @@ -409,17 +369,6 @@ export const aaveV3EthereumMainnetProductHubProducts: ProductHubItemWithoutAddre earnStrategyDescription: 'SDAI/LUSD Yield Loop', managementType: 'active', }, - { - product: [OmniProductType.Borrow], - primaryToken: 'SDAI', - primaryTokenGroup: 'DAI', - secondaryToken: 'LUSD', - depositToken: 'SDAI', - label: 'SDAI/LUSD', - network: NetworkNames.ethereumMainnet, - protocol: LendingProtocol.AaveV3, - }, - { product: [OmniProductType.Earn], primaryToken: 'SDAI', @@ -433,16 +382,6 @@ export const aaveV3EthereumMainnetProductHubProducts: ProductHubItemWithoutAddre earnStrategyDescription: 'SDAI/FRAX Yield Loop', managementType: 'active', }, - { - product: [OmniProductType.Borrow], - primaryToken: 'SDAI', - primaryTokenGroup: 'DAI', - secondaryToken: 'FRAX', - depositToken: 'SDAI', - label: 'SDAI/FRAX', - network: NetworkNames.ethereumMainnet, - protocol: LendingProtocol.AaveV3, - }, { product: [OmniProductType.Earn], primaryToken: 'SDAI', diff --git a/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/optimims-mainnet.ts b/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/optimims-mainnet.ts index 0e33bc0fd6..b8431f5839 100644 --- a/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/optimims-mainnet.ts +++ b/handlers/product-hub/update-handlers/aaveV3/aave-v3-products/optimims-mainnet.ts @@ -65,7 +65,7 @@ const aaveSeed: AaveProductHubItemSeed[] = [ collateral: 'wstETH', debt: 'ETH', strategyType: 'long', - types: ['borrow', 'earn'], + types: ['earn'], }, { collateral: 'DAI', @@ -107,13 +107,13 @@ const aaveSeed: AaveProductHubItemSeed[] = [ collateral: 'USDC', debt: 'SUSD', strategyType: 'long', - types: ['borrow', 'multiply', 'earn'], + types: ['earn'], }, { collateral: 'USDC.E', debt: 'SUSD', strategyType: 'long', - types: ['borrow', 'multiply', 'earn'], + types: ['earn'], }, ] diff --git a/package.json b/package.json index 82a07415b9..81b274a0d0 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@metamask/eth-sig-util": "^5.0.2", "@oasisdex/addresses": "0.1.75", "@oasisdex/automation": "1.6.5-morpho.6", - "@oasisdex/dma-library": "0.6.60", + "@oasisdex/dma-library": "0.6.61", "@oasisdex/multiply": "^0.2.11", "@oasisdex/transactions": "0.1.4-alpha.0", "@oasisdex/utils": "^0.0.8", diff --git a/yarn.lock b/yarn.lock index dad6d6095f..420ede2206 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2514,10 +2514,10 @@ dependencies: ethers "^5.6.2" -"@oasisdex/dma-library@0.6.60": - version "0.6.60" - resolved "https://registry.yarnpkg.com/@oasisdex/dma-library/-/dma-library-0.6.60.tgz#db4ab89d2e695eabda30bf8865b5e94af95c44ee" - integrity sha512-xmlBXvV4v3gCGvPzoCHzjDkszkuEWvDrCUZCYiKbDFeJeYNrdAk2v6qlqL33MpQTwbqej2Y3lYUQrCy5Wc1D3A== +"@oasisdex/dma-library@0.6.61": + version "0.6.61" + resolved "https://registry.yarnpkg.com/@oasisdex/dma-library/-/dma-library-0.6.61.tgz#0a38413c253166c66735129934e7db576aec183c" + integrity sha512-k8ewPCNf2QG0u2zUs2GfQ4a/IAJkLQX3XvbGTrabKruvK4cjo2zPZYHZVDagT1FAdp6gqZwd3URiX4SCSu9r3w== dependencies: bignumber.js "9.0.1" ethers "^5.7.2"