Skip to content

Commit

Permalink
Merge branch 'refs/heads/dev' into sp/untracked/maker-omni
Browse files Browse the repository at this point in the history
  • Loading branch information
piekczyk committed Aug 27, 2024
2 parents a5a29ff + 6c77b22 commit 73a497c
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/addresses/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions packages/deploy-configurations/configs/mainnet.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,10 @@ export const config: SystemConfig = {
name: 'SDAI',
address: '0x83f20f44975d03b1b09e64809b757c47f942beea',
},
SWBTC: {
name: 'SWBTC',
address: '0x8db2350d78abc13f5673a411d4700bcf87864dde',
},
STETH: {
name: 'STETH',
address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export const commonDefaults = {
name: 'SUSD',
address: ADDRESS_ZERO,
},
SWBTC: {
name: 'SWBTC',
address: ADDRESS_ZERO,
},
USDE: {
name: 'USDE',
address: ADDRESS_ZERO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type Tokens =
| 'STETH'
| 'STYETH'
| 'SUSD'
| 'SWBTC'
| 'SUSDE'
| 'USDE'
| 'TBTC'
Expand Down
2 changes: 1 addition & 1 deletion packages/dma-library/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
},
}

Expand All @@ -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,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion packages/dma-library/src/utils/flashloan/resolve-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion packages/dma-library/src/utils/swap/fee-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down

0 comments on commit 73a497c

Please sign in to comment.