Skip to content

Commit

Permalink
Eurc and liquidation price fix (#708)
Browse files Browse the repository at this point in the history
* Eurc and liquidation price fix

* common defaults on mainnet

* lint
  • Loading branch information
piekczyk authored Nov 5, 2024
1 parent 9a29165 commit c748312
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/addresses/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions packages/deploy-configurations/configs/base.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ export const config: SystemConfig = {
name: 'ETH',
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
},
EURC: {
name: 'EURC',
address: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
},
FRAX: {
name: 'FRAX',
address: '0x0000000000000000000000000000000000000000',
Expand Down
3 changes: 3 additions & 0 deletions packages/deploy-configurations/configs/mainnet.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -410,6 +412,7 @@ export const config: SystemConfig = {
},
},
common: {
...commonDefaults,
ARB: {
name: 'ARB',
address: '0x0000000000000000000000000000000000000000',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,8 @@ export const commonDefaults = {
name: 'CBBTC',
address: ADDRESS_ZERO,
},
EURC: {
name: 'EURC',
address: ADDRESS_ZERO,
},
} as const
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ export type Tokens =
| 'LBTC'
| 'WSUPEROETHB'
| 'CBBTC'
| 'EURC'
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.75",
"version": "0.6.76",
"typings": "lib/index.d.ts",
"types": "lib/index.d.ts",
"main": "lib/index.js",
Expand Down
6 changes: 1 addition & 5 deletions packages/dma-library/src/views/aave/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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({
Expand Down

0 comments on commit c748312

Please sign in to comment.