Skip to content

Commit dbe4aac

Browse files
committed
fix redirect deposit wrapper
1 parent 15f2dca commit dbe4aac

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/swapService/strategies/strategyRedirectDepositWrapper.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,15 @@ export class StrategyRedirectDepositWrapper {
144144

145145
const swap = buildApiResponseSwap(swapParams.from, newMulticallItems)
146146

147-
let debtMax = swapParams.currentDebt - BigInt(innerSwap.amountOutMin)
148-
if (debtMax < 0n) debtMax = 0n
149-
debtMax = adjustForInterest(debtMax)
147+
let debtMax
148+
if (swapParams.swapperMode === SwapperMode.TARGET_DEBT) {
149+
debtMax = swapParams.targetDebt || 0n
150+
} else {
151+
debtMax =
152+
(swapParams.currentDebt || 0n) - BigInt(innerSwap.amountOutMin)
153+
if (debtMax < 0n) debtMax = 0n
154+
debtMax = adjustForInterest(debtMax)
155+
}
150156

151157
const verify = buildApiResponseVerifyDebtMax(
152158
swapParams.chainId,

0 commit comments

Comments
 (0)