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

Update Aave v3 liquidation price #707

Merged
merged 1 commit into from
Oct 30, 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.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
Loading