Skip to content

Commit

Permalink
fix: update getMorphoBluePosition to include stablecoin debt check (#495
Browse files Browse the repository at this point in the history
)

## Description
Adds `isStablecoin` check in `getMorphoBluePosition` instead of fixed
value of `false`.

## Changes
- self explanatory

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced a new utility function to dynamically evaluate stablecoin
debt classification.
- **Bug Fixes**
- Enhanced the accuracy of stablecoin debt determination by replacing
static values with real-time evaluations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
marcinciarka authored Sep 13, 2024
1 parent 67c09f3 commit c1b0a48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/triggers-calculations/src/get-morphoblue-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Address, ChainId, PoolId } from '@summerfi/serverless-shared'
import { PublicClient } from 'viem'
import { chainlinkPairOracleAbi, erc20Abi, morphoBlueAbi } from '@summerfi/abis'
import { Logger } from '@aws-lambda-powertools/logger'
import { calculateLtv, normalizeAmount } from './helpers'
import { calculateLtv, isStablecoin, normalizeAmount } from './helpers'
import { getPricesSubgraphClient, UsdcAndTokenPrice } from '@summerfi/prices-subgraph'
import { BigNumber } from 'bignumber.js'

Expand Down Expand Up @@ -252,7 +252,7 @@ export async function getMorphoBluePosition(
})

return {
hasStablecoinDebt: false,
hasStablecoinDebt: isStablecoin(debtPrice),
ltv,
collateral: collateralResult,
debt: debtResult,
Expand Down

0 comments on commit c1b0a48

Please sign in to comment.