Skip to content

Commit

Permalink
Merge pull request #709 from OasisDEX/kk/fix-fl-amount
Browse files Browse the repository at this point in the history
fix: fix FL amounts for aave ops
  • Loading branch information
halaprix authored Nov 8, 2024
2 parents c748312 + 0b54d56 commit ab3f190
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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.76",
"version": "0.6.77",
"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 @@ -4,7 +4,7 @@ import { AdjustRiskDownArgs } from '@dma-library/operations/aave/multiply/v3/adj
import { AdjustRiskUpArgs } from '@dma-library/operations/aave/multiply/v3/adjust-risk-up'
import { resolveAaveLikeMultiplyOperations } from '@dma-library/operations/aave-like/resolve-aavelike-operations'
import { getAaveTokenAddresses } from '@dma-library/strategies/aave/common'
import { IOperation, SwapData } from '@dma-library/types'
import { FlashloanProvider, IOperation, SwapData } from '@dma-library/types'
import { resolveFlashloanProvider } from '@dma-library/utils/flashloan/resolve-provider'
import { feeResolver } from '@dma-library/utils/swap'
import * as Domain from '@domain'
Expand Down Expand Up @@ -146,8 +146,8 @@ export async function buildAdjustFlashloan(
debtToken: args.debtToken.symbol,
collateralToken: args.collateralToken.symbol,
})

if (dependencies.protocolType === 'Spark') {
// We dont use the if Spark condition since on L2s non Maker FLS are used for multiply operations
if (flashloanProvider !== FlashloanProvider.DssFlash) {
// Need to add fees to the swap amount
const fromSwapAmountBeforeFees = swap.fromTokenAmount.plus(preSwapFee)
const receivedAmountAfterSwap = swap.minToTokenAmount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FEE_BASE, ONE, TYPICAL_PRECISION } from '@dma-common/constants'
import { amountFromWei, amountToWei } from '@dma-common/utils/common'
import { resolveAaveLikeMultiplyOperations } from '@dma-library/operations/aave-like/resolve-aavelike-operations'
import { SAFETY_MARGIN } from '@dma-library/strategies/aave-like/multiply/close/constants'
import { IOperation, SwapData } from '@dma-library/types'
import { FlashloanProvider, IOperation, SwapData } from '@dma-library/types'
import { resolveFlashloanProvider } from '@dma-library/utils/flashloan/resolve-provider'
import { feeResolver } from '@dma-library/utils/swap'
import * as Domain from '@domain'
Expand Down Expand Up @@ -105,8 +105,8 @@ export async function buildCloseFlashloan(
debtToken: args.debtToken.symbol,
collateralToken: args.collateralToken.symbol,
})

if (dependencies.protocolType === 'Spark') {
// We dont use the if Spark condition since on L2s non Maker FLS are used for multiply operations
if (flashloanProvider !== FlashloanProvider.DssFlash) {
// This covers off the situation where debt balances accrue interest
const amountToFlashloan = dependencies.currentPosition.debt.amount.times(
ONE.plus(SAFETY_MARGIN),
Expand Down

0 comments on commit ab3f190

Please sign in to comment.