Skip to content

Commit

Permalink
Merge pull request #9 from OasisDEX/kk/untracked/fix-close
Browse files Browse the repository at this point in the history
chore: subtract one unit from swap amount
  • Loading branch information
halaprix authored Feb 19, 2024
2 parents 8fe4a0f + 361074b commit fd01cc3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 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.5.21-dma-v2-workers.18",
"version": "0.5.21-dma-v2-workers.19-test.0",
"typings": "lib/index.d.ts",
"types": "lib/index.d.ts",
"main": "lib/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/dma-library/src/operations/aave/multiply/v3/close.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ export const close: AaveV3CloseOperation = async ({

const withdrawCollateralFromAAVE = actions.aave.v3.aaveV3Withdraw(network, {
asset: collateral.address,
amount: collateralAmountToBeSwapped,
amount: collateralAmountToBeSwapped.minus(1),
to: proxy.address,
})

const swapCollateralTokensForDebtTokens = actions.common.swap(network, {
fromAsset: collateral.address,
toAsset: debt.address,
amount: collateralAmountToBeSwapped || ZERO,
amount: collateralAmountToBeSwapped.minus(1) || ZERO,
receiveAtLeast: swap.receiveAtLeast,
fee: swap.fee,
withData: swap.data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async function getAaveSwapDataToCloseToDebt(
addresses,
)

const swapAmountBeforeFees = dependencies.currentPosition.collateral.amount
const swapAmountBeforeFees = dependencies.currentPosition.collateral.amount.minus(1)
const fromToken = {
...collateralToken,
precision: collateralToken.precision || TYPICAL_PRECISION,
Expand Down

0 comments on commit fd01cc3

Please sign in to comment.