Deposit Cap and Utilization Fix (#654)

* fix: fixed the deposit cap and total supplied / utilization rate

* fix: fixed build

* fix: fixed build

* fix: avoid deposit cap usage over 100%

* refactor market data apy/ltv

* fix: fixed the withdraw from vaults modal

* tidy: refactor

---------

Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
This commit is contained in:
Linkie Link
2023-11-26 11:43:37 +01:00
committed by GitHub
co-authored by Bob van der Helm
parent e7ce4f600a
commit 85533cdea3
25 changed files with 151 additions and 124 deletions
@@ -1,11 +1,11 @@
import getMarket from 'api/markets/getMarket'
import getTotalActiveEmissionValue from 'api/incentives/getTotalActiveEmissionValue'
import getMarket from 'api/markets/getMarket'
import getUnderlyingLiquidityAmount from 'api/markets/getMarketUnderlyingLiquidityAmount'
import { BN } from 'utils/helpers'
import { SECONDS_IN_A_YEAR } from 'utils/constants'
import getPrice from 'api/prices/getPrice'
import { ASSETS } from 'constants/assets'
import { byDenom } from 'utils/array'
import { SECONDS_IN_A_YEAR } from 'utils/constants'
import { BN } from 'utils/helpers'
export default async function calculateAssetIncentivesApy(
denom: string,
@@ -29,7 +29,7 @@ export default async function calculateAssetIncentivesApy(
.shiftedBy(-assetDecimals)
.multipliedBy(assetPrice)
const marketReturns = BN(market.liquidityRate).multipliedBy(marketLiquidityValue)
const marketReturns = BN(market.apy.deposit).multipliedBy(marketLiquidityValue)
const annualEmission = totalActiveEmissionValue.multipliedBy(SECONDS_IN_A_YEAR)
const totalAnnualReturnsValue = annualEmission.plus(marketReturns)
+1 -1
View File
@@ -17,7 +17,7 @@ export default async function getMarketBorrowings(): Promise<BorrowAsset[]> {
return {
...asset,
borrowRate: market.borrowRate ?? 0,
borrowRate: market.apy.borrow ?? 0,
liquidity: {
amount: BN(amount),
value: BN(amount).multipliedBy(price),