From c7483129b39e4e63ff26b06994ed9a4d36bdcba3 Mon Sep 17 00:00:00 2001 From: piekczyk Date: Tue, 5 Nov 2024 10:44:59 +0100 Subject: [PATCH] Eurc and liquidation price fix (#708) * Eurc and liquidation price fix * common defaults on mainnet * lint --- packages/addresses/package.json | 2 +- packages/deploy-configurations/configs/base.conf.ts | 4 ++++ packages/deploy-configurations/configs/mainnet.conf.ts | 3 +++ .../deploy-configurations/configs/shared/common-defaults.ts | 4 ++++ .../deploy-configurations/types/deployment-config/tokens.ts | 1 + packages/dma-library/package.json | 2 +- packages/dma-library/src/views/aave/index.ts | 6 +----- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/addresses/package.json b/packages/addresses/package.json index db68ecff2..f8a59e996 100644 --- a/packages/addresses/package.json +++ b/packages/addresses/package.json @@ -1,6 +1,6 @@ { "name": "@oasisdex/addresses", - "version": "0.1.87", + "version": "0.1.88", "typings": "lib/index.d.ts", "types": "lib/index.d.ts", "main": "lib/index.js", diff --git a/packages/deploy-configurations/configs/base.conf.ts b/packages/deploy-configurations/configs/base.conf.ts index 0ffbf6b8f..823c5cdea 100644 --- a/packages/deploy-configurations/configs/base.conf.ts +++ b/packages/deploy-configurations/configs/base.conf.ts @@ -582,6 +582,10 @@ export const config: SystemConfig = { name: 'ETH', address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', }, + EURC: { + name: 'EURC', + address: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42', + }, FRAX: { name: 'FRAX', address: '0x0000000000000000000000000000000000000000', diff --git a/packages/deploy-configurations/configs/mainnet.conf.ts b/packages/deploy-configurations/configs/mainnet.conf.ts index ab6ec3974..d93385f6d 100644 --- a/packages/deploy-configurations/configs/mainnet.conf.ts +++ b/packages/deploy-configurations/configs/mainnet.conf.ts @@ -2,6 +2,8 @@ import { loadContractNames } from '@deploy-configurations/constants' import { SystemConfig } from '@deploy-configurations/types/deployment-config' import { Network } from '@deploy-configurations/types/network' +import { commonDefaults } from './shared/common-defaults' + const SERVICE_REGISTRY_NAMES = loadContractNames(Network.MAINNET) export const config: SystemConfig = { @@ -410,6 +412,7 @@ export const config: SystemConfig = { }, }, common: { + ...commonDefaults, ARB: { name: 'ARB', address: '0x0000000000000000000000000000000000000000', diff --git a/packages/deploy-configurations/configs/shared/common-defaults.ts b/packages/deploy-configurations/configs/shared/common-defaults.ts index 127e9ce9d..ea1595b04 100644 --- a/packages/deploy-configurations/configs/shared/common-defaults.ts +++ b/packages/deploy-configurations/configs/shared/common-defaults.ts @@ -240,4 +240,8 @@ export const commonDefaults = { name: 'CBBTC', address: ADDRESS_ZERO, }, + EURC: { + name: 'EURC', + address: ADDRESS_ZERO, + }, } as const diff --git a/packages/deploy-configurations/types/deployment-config/tokens.ts b/packages/deploy-configurations/types/deployment-config/tokens.ts index f28067fdb..1235ab0c0 100644 --- a/packages/deploy-configurations/types/deployment-config/tokens.ts +++ b/packages/deploy-configurations/types/deployment-config/tokens.ts @@ -122,3 +122,4 @@ export type Tokens = | 'LBTC' | 'WSUPEROETHB' | 'CBBTC' + | 'EURC' diff --git a/packages/dma-library/package.json b/packages/dma-library/package.json index fcbb743fd..00d6640ee 100644 --- a/packages/dma-library/package.json +++ b/packages/dma-library/package.json @@ -1,6 +1,6 @@ { "name": "@oasisdex/dma-library", - "version": "0.6.75", + "version": "0.6.76", "typings": "lib/index.d.ts", "types": "lib/index.d.ts", "main": "lib/index.js", diff --git a/packages/dma-library/src/views/aave/index.ts b/packages/dma-library/src/views/aave/index.ts index 538474e6c..e5112f007 100644 --- a/packages/dma-library/src/views/aave/index.ts +++ b/packages/dma-library/src/views/aave/index.ts @@ -347,7 +347,6 @@ 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, ) @@ -360,13 +359,10 @@ 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: maxLoanToValue, + liquidationThreshold: liquidationThreshold, } const { collateral, debt } = calculateViewValuesForPosition({