Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix FL amounts for aave ops #709

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading