Skip to content

Commit

Permalink
Update Aave v3 liquidation price (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
piekczyk authored Oct 30, 2024
1 parent cef697c commit 39b8acf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 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.72",
"version": "0.6.74",
"typings": "lib/index.d.ts",
"types": "lib/index.d.ts",
"main": "lib/index.js",
Expand Down
6 changes: 5 additions & 1 deletion packages/dma-library/src/views/aave/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ export const getCurrentPositionAaveV3Omni: AaveV3GetCurrentPositionOmni = async
let maxLoanToValue = new BigNumber(reserveDataForCollateral.ltv.toString()).div(BASE)

if (eModeCategoryData !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
liquidationThreshold = new BigNumber(eModeCategoryData.liquidationThreshold.toString()).div(
BASE,
)
Expand All @@ -359,10 +360,13 @@ export const getCurrentPositionAaveV3Omni: AaveV3GetCurrentPositionOmni = async
)
const oracle = validatedCollateralPrice.div(validatedDebtPrice)

// W use liquidationThreshold in AaveLikePositionV2 class to calculate liquidationPrice (LP).
// Recently a new Aave version 3.2 was released and now maxLoanToValue should be used instead to calculate LP.
// Since Spark uses the same class but was not updated we make this custom overwrite here.
const category = {
dustLimit: new BigNumber(0),
maxLoanToValue: maxLoanToValue,
liquidationThreshold: liquidationThreshold,
liquidationThreshold: maxLoanToValue,
}

const { collateral, debt } = calculateViewValuesForPosition({
Expand Down

0 comments on commit 39b8acf

Please sign in to comment.