diff --git a/packages/addresses/package.json b/packages/addresses/package.json index 531c27bdc..3c995daea 100644 --- a/packages/addresses/package.json +++ b/packages/addresses/package.json @@ -1,6 +1,6 @@ { "name": "@oasisdex/addresses", - "version": "0.1.76", + "version": "0.1.77", "typings": "lib/index.d.ts", "types": "lib/index.d.ts", "main": "lib/index.js", diff --git a/packages/deploy-configurations/configs/mainnet.conf.ts b/packages/deploy-configurations/configs/mainnet.conf.ts index 2535e6d5b..7c6a882a3 100644 --- a/packages/deploy-configurations/configs/mainnet.conf.ts +++ b/packages/deploy-configurations/configs/mainnet.conf.ts @@ -773,6 +773,10 @@ export const config: SystemConfig = { name: 'SDAI', address: '0x83f20f44975d03b1b09e64809b757c47f942beea', }, + SWBTC: { + name: 'SWBTC', + address: '0x8db2350d78abc13f5673a411d4700bcf87864dde', + }, STETH: { name: 'STETH', address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', diff --git a/packages/deploy-configurations/configs/shared/common-defaults.ts b/packages/deploy-configurations/configs/shared/common-defaults.ts index e47f579a3..7d692b498 100644 --- a/packages/deploy-configurations/configs/shared/common-defaults.ts +++ b/packages/deploy-configurations/configs/shared/common-defaults.ts @@ -24,6 +24,10 @@ export const commonDefaults = { name: 'SUSD', address: ADDRESS_ZERO, }, + SWBTC: { + name: 'SWBTC', + address: ADDRESS_ZERO, + }, USDE: { name: 'USDE', address: ADDRESS_ZERO, diff --git a/packages/deploy-configurations/types/deployment-config/tokens.ts b/packages/deploy-configurations/types/deployment-config/tokens.ts index c8d2be2cb..6348ac858 100644 --- a/packages/deploy-configurations/types/deployment-config/tokens.ts +++ b/packages/deploy-configurations/types/deployment-config/tokens.ts @@ -55,6 +55,7 @@ export type Tokens = | 'STETH' | 'STYETH' | 'SUSD' + | 'SWBTC' | 'SUSDE' | 'USDE' | 'TBTC' diff --git a/packages/dma-library/package.json b/packages/dma-library/package.json index 44319a1b9..7a7f4e88f 100644 --- a/packages/dma-library/package.json +++ b/packages/dma-library/package.json @@ -1,6 +1,6 @@ { "name": "@oasisdex/dma-library", - "version": "0.6.62", + "version": "0.6.64", "typings": "lib/index.d.ts", "types": "lib/index.d.ts", "main": "lib/index.js", diff --git a/packages/dma-library/src/strategies/morphoblue/multiply/adjust.ts b/packages/dma-library/src/strategies/morphoblue/multiply/adjust.ts index c93b48038..6938e7b6b 100644 --- a/packages/dma-library/src/strategies/morphoblue/multiply/adjust.ts +++ b/packages/dma-library/src/strategies/morphoblue/multiply/adjust.ts @@ -236,6 +236,8 @@ async function buildOperation( }) const network = await getNetwork(dependencies.provider) + const isDai = + args.position.marketParams.loanToken.toLowerCase() === dependencies.addresses.DAI.toLowerCase() const morphoBlueMarket = { loanToken: args.position.marketParams.loanToken, @@ -302,7 +304,7 @@ async function buildOperation( address: args.position.marketParams.loanToken, }, amount: Domain.debtToCollateralSwapFlashloan(swapAmountBeforeFees), - provider: FlashloanProvider.Balancer, + provider: isDai ? FlashloanProvider.DssFlash : FlashloanProvider.Balancer, }, } @@ -327,7 +329,7 @@ async function buildOperation( address: args.position.marketParams.loanToken, }, amount: Domain.collateralToDebtSwapFlashloan(swapData.minToTokenAmount), - provider: FlashloanProvider.Balancer, + provider: isDai ? FlashloanProvider.DssFlash : FlashloanProvider.Balancer, }, } diff --git a/packages/dma-library/src/strategies/morphoblue/multiply/close.ts b/packages/dma-library/src/strategies/morphoblue/multiply/close.ts index b7864ef4d..974011dd4 100644 --- a/packages/dma-library/src/strategies/morphoblue/multiply/close.ts +++ b/packages/dma-library/src/strategies/morphoblue/multiply/close.ts @@ -224,6 +224,9 @@ async function buildOperation( ? swapData.fromTokenAmount.plus(preSwapFee) : lockedCollateralAmount + const isDai = + args.position.marketParams.loanToken.toLowerCase() === dependencies.addresses.DAI.toLowerCase() + const closeArgs = { collateral: { address: collateralToken.address, @@ -245,7 +248,7 @@ async function buildOperation( amount: Domain.debtToCollateralSwapFlashloan(amountToFlashloan), address: position.marketParams.loanToken, }, - provider: FlashloanProvider.Balancer, + provider: isDai ? FlashloanProvider.DssFlash : FlashloanProvider.Balancer, amount: Domain.debtToCollateralSwapFlashloan(amountToFlashloan), }, position: { diff --git a/packages/dma-library/src/strategies/morphoblue/multiply/open.ts b/packages/dma-library/src/strategies/morphoblue/multiply/open.ts index 07dae6f87..7ef036ef3 100644 --- a/packages/dma-library/src/strategies/morphoblue/multiply/open.ts +++ b/packages/dma-library/src/strategies/morphoblue/multiply/open.ts @@ -348,6 +348,8 @@ async function buildOperation( }) const network = await getNetwork(dependencies.provider) + const isDai = + position.marketParams.loanToken.toLowerCase() === dependencies.addresses.DAI.toLowerCase() const openMultiplyArgs: MorphoBlueOpenOperationArgs = { morphoBlueMarket: { @@ -385,7 +387,7 @@ async function buildOperation( address: position.marketParams.loanToken, }, amount: Domain.debtToCollateralSwapFlashloan(swapAmountBeforeFees), - provider: FlashloanProvider.Balancer, + provider: isDai ? FlashloanProvider.DssFlash : FlashloanProvider.Balancer, }, position: { type: positionType, diff --git a/packages/dma-library/src/utils/flashloan/resolve-provider.ts b/packages/dma-library/src/utils/flashloan/resolve-provider.ts index ca4de4b09..694bd3e27 100644 --- a/packages/dma-library/src/utils/flashloan/resolve-provider.ts +++ b/packages/dma-library/src/utils/flashloan/resolve-provider.ts @@ -25,7 +25,9 @@ export function resolveFlashloanProvider({ if (lendingProtocol === 'Spark' && debtToken !== 'DAI') { return FlashloanProvider.Balancer } - + if (lendingProtocol === 'MorphoBlue' && debtToken !== 'DAI') { + return FlashloanProvider.Balancer + } if ( lendingProtocol === 'AAVE_V3' && aaveIsolatedCollateralTokens.includes(collateralToken.toUpperCase()) diff --git a/packages/dma-library/src/utils/swap/fee-resolver.ts b/packages/dma-library/src/utils/swap/fee-resolver.ts index a27b93f8c..60cb5fe5d 100644 --- a/packages/dma-library/src/utils/swap/fee-resolver.ts +++ b/packages/dma-library/src/utils/swap/fee-resolver.ts @@ -69,7 +69,7 @@ export function isCorrelatedPosition(symbolA: string, symbolB: string) { 'BSDETH', 'RSETH', ], // ETH correlated assets - ['WBTC', 'TBTC'], // BTC correlated assets + ['WBTC', 'TBTC', 'SWBTC'], // BTC correlated assets ['USDC', 'DAI', 'GHO', 'SDAI', 'USDT', 'CDAI', 'AUSDC', 'PYUSD'], // USDC correlated assets // Add more arrays here to expand the matrix in the future ]