diff --git a/apps/main/src/lend/hooks/useBorrowPositionDetails.ts b/apps/main/src/lend/hooks/useBorrowPositionDetails.ts index fc8994aef2..da41a2c0ba 100644 --- a/apps/main/src/lend/hooks/useBorrowPositionDetails.ts +++ b/apps/main/src/lend/hooks/useBorrowPositionDetails.ts @@ -96,7 +96,7 @@ export const useBorrowPositionDetails = ({ }, borrowAPY: { rate: borrowApy == null ? null : Number(borrowApy), - averageRate: averageRate, + averageRate, averageRateLabel: averageMultiplierString, rebasingYield: rebasingYield ?? null, averageRebasingYield: averageRebasingYield ?? null, diff --git a/apps/main/src/llamalend/entities/llama-markets.ts b/apps/main/src/llamalend/entities/llama-markets.ts index 0c8cc44ab7..2916a06895 100644 --- a/apps/main/src/llamalend/entities/llama-markets.ts +++ b/apps/main/src/llamalend/entities/llama-markets.ts @@ -57,8 +57,8 @@ export type LlamaMarket = { lendTotalApyMaxBoosted: number | null // supply rate + rebasing yield + total extra incentives + max boosted yield borrowApy: number // base borrow APY % borrowTotalApy: number // borrow - yield from collateral - // extra lending incentives, like OP rewards (so non CRV) - incentives: ExtraIncentive[] + borrowFutureRate: number | null + incentives: ExtraIncentive[] // extra lending incentives, like OP rewards (so non CRV) } type: LlamaMarketType url: string @@ -159,6 +159,7 @@ const convertLendingVault = ( lendTotalApyMaxBoosted: lendApr + (borrowedToken?.rebasingYield ?? 0) + totalExtraRewardApr + (lendCrvAprBoosted ?? 0), borrowApy: apyBorrow, + borrowFutureRate: null, // not available for lend markets // as confusing as it may be, `borrow` is used in the table, but the total borrow is only in the tooltip borrowTotalApy: apyBorrow - (collateralToken?.rebasingYield ?? 0), incentives: extraRewardApr @@ -203,6 +204,7 @@ const convertMintMarket = ( stablecoinToken, llamma, rate, + futureRate, borrowed, borrowedUsd, borrowable, @@ -250,6 +252,7 @@ const convertMintMarket = ( totalCollateralUsd: collateralAmountUsd, rates: { borrowApy: rate * 100, + borrowFutureRate: futureRate * 100, lendApr: null, lendCrvAprBoosted: null, lendCrvAprUnboosted: null, diff --git a/apps/main/src/llamalend/features/market-details/index.tsx b/apps/main/src/llamalend/features/market-details/index.tsx index fef24b49a5..6d9b65faec 100644 --- a/apps/main/src/llamalend/features/market-details/index.tsx +++ b/apps/main/src/llamalend/features/market-details/index.tsx @@ -36,6 +36,7 @@ type BorrowToken = { } type BorrowAPY = { rate: number | undefined | null + futureRate?: number | null averageRate: number | undefined | null averageRateLabel: string rebasingYield: number | null @@ -155,6 +156,7 @@ export const MarketDetails = ({ {rate == null ? '—' : formatPercent(rate)} + {id === LlamaMarketColumnId.BorrowRate && market.rates.borrowFutureRate && ( + <> + t.palette.text.tertiary, + }} + /> + {formatPercent(market.rates.borrowFutureRate)} + + )} diff --git a/apps/main/src/llamalend/features/market-position-details/BorrowPositionDetails.tsx b/apps/main/src/llamalend/features/market-position-details/BorrowPositionDetails.tsx index 21a98de3dc..55bd417f48 100644 --- a/apps/main/src/llamalend/features/market-position-details/BorrowPositionDetails.tsx +++ b/apps/main/src/llamalend/features/market-position-details/BorrowPositionDetails.tsx @@ -22,6 +22,7 @@ export type Pnl = { export type Health = { value: number | undefined | null; loading: boolean } export type BorrowAPY = { rate: number | undefined | null + futureRate?: number | null averageRate: number | undefined | null averageRateLabel: string rebasingYield: number | null diff --git a/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipContent.tsx b/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipContent.tsx index a2a282e4d5..d9b15dbfce 100644 --- a/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipContent.tsx +++ b/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipContent.tsx @@ -14,6 +14,7 @@ import { RewardsTooltipItems } from './RewardTooltipItems' export type MarketBorrowRateTooltipContentProps = { marketType: LlamaMarketType borrowRate: number | null | undefined + borrowFutureRate?: number | null totalBorrowRate: number | null | undefined totalAverageBorrowRate: number | null | undefined averageRate: number | null | undefined @@ -32,6 +33,7 @@ const messages: Record = { export const MarketBorrowRateTooltipContent = ({ marketType, borrowRate, + borrowFutureRate, totalBorrowRate, totalAverageBorrowRate, averageRate, @@ -56,11 +58,17 @@ export const MarketBorrowRateTooltipContent = ({ + {borrowFutureRate && ( + + {formatPercent(borrowFutureRate)} + + )} + {extraRewards.length > 0 && ( diff --git a/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipWrapper.tsx b/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipWrapper.tsx index 97a2ee6c8e..3b0140ddf4 100644 --- a/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipWrapper.tsx +++ b/apps/main/src/llamalend/widgets/tooltips/MarketBorrowRateTooltipWrapper.tsx @@ -13,7 +13,7 @@ export const MarketBorrowRateTooltipWrapper = ({ market }: MarketBorrowRateToolt const { rewards, type: marketType, - rates: { borrowApy: borrowRate, borrowTotalApy }, + rates: { borrowApy: borrowRate, borrowTotalApy, borrowFutureRate }, assets: { collateral: { rebasingYield, symbol: collateralSymbol }, }, @@ -24,6 +24,7 @@ export const MarketBorrowRateTooltipWrapper = ({ market }: MarketBorrowRateToolt { )} - { - - } + diff --git a/apps/main/src/loan/hooks/useLoanPositionDetails.ts b/apps/main/src/loan/hooks/useLoanPositionDetails.ts index c8607ea21b..fa9e8c87ce 100644 --- a/apps/main/src/loan/hooks/useLoanPositionDetails.ts +++ b/apps/main/src/loan/hooks/useLoanPositionDetails.ts @@ -109,6 +109,7 @@ export const useLoanPositionDetails = ({ }, borrowAPY: { rate: loanDetails?.parameters?.rate ? Number(loanDetails?.parameters?.rate) : null, + futureRate: loanDetails?.parameters?.future_rate ? Number(loanDetails?.parameters?.future_rate) : null, rebasingYield: collateralRebasingYield ?? null, averageRate: averageRate, averageRebasingYield: averageRebasingYield ?? null, diff --git a/apps/main/src/loan/hooks/useMarketDetails.ts b/apps/main/src/loan/hooks/useMarketDetails.ts index ff9fbba892..eca27af95c 100644 --- a/apps/main/src/loan/hooks/useMarketDetails.ts +++ b/apps/main/src/loan/hooks/useMarketDetails.ts @@ -1,3 +1,4 @@ +import { last } from 'lodash' import { useMemo } from 'react' import type { MarketDetailsProps } from '@/llamalend/features/market-details' import { CRVUSD_ADDRESS } from '@/loan/constants' @@ -78,15 +79,15 @@ export const useMarketDetails = ({ chainId, llamma, llammaId }: UseMarketDetails }, borrowAPY: { rate: loanDetails?.parameters?.rate ? Number(loanDetails?.parameters?.rate) : null, + futureRate: loanDetails?.parameters?.future_rate ? Number(loanDetails?.parameters?.future_rate) : null, averageRate: averageRate, averageRateLabel: averageMultiplierString, - rebasingYield: crvUsdSnapshots?.[crvUsdSnapshots.length - 1]?.collateralToken.rebasingYield ?? null, + rebasingYield: last(crvUsdSnapshots)?.collateralToken.rebasingYield ?? null, averageRebasingYield: averageRebasingYield ?? null, totalAverageBorrowRate, extraRewards: campaigns, totalBorrowRate: loanDetails?.parameters?.rate - ? Number(loanDetails?.parameters?.rate) - - (crvUsdSnapshots?.[crvUsdSnapshots.length - 1]?.collateralToken.rebasingYield ?? 0) + ? Number(loanDetails?.parameters?.rate) - (last(crvUsdSnapshots)?.collateralToken.rebasingYield ?? 0) : null, loading: isSnapshotsLoading || (loanDetails?.loading ?? true), }, diff --git a/packages/prices-api/src/crvusd/models.ts b/packages/prices-api/src/crvusd/models.ts index b59ece12ad..cbde8d2e7e 100644 --- a/packages/prices-api/src/crvusd/models.ts +++ b/packages/prices-api/src/crvusd/models.ts @@ -6,6 +6,7 @@ export type Market = { factoryAddress: Address llamma: Address rate: number + futureRate: number borrowed: number borrowedUsd: number borrowable: number diff --git a/packages/prices-api/src/crvusd/parsers.ts b/packages/prices-api/src/crvusd/parsers.ts index ccbce8d77d..e6b5f4a6c5 100644 --- a/packages/prices-api/src/crvusd/parsers.ts +++ b/packages/prices-api/src/crvusd/parsers.ts @@ -9,6 +9,7 @@ export const parseMarket = (x: Responses.GetMarketsResponse['data'][number]): Mo factoryAddress: x.factory_address, llamma: x.llamma, rate: x.rate, + futureRate: x.future_rate, borrowed: x.total_debt, borrowedUsd: x.total_debt_usd, borrowable: x.borrowable, diff --git a/packages/prices-api/src/crvusd/responses.ts b/packages/prices-api/src/crvusd/responses.ts index 3dd7143e0b..d8be635a88 100644 --- a/packages/prices-api/src/crvusd/responses.ts +++ b/packages/prices-api/src/crvusd/responses.ts @@ -6,6 +6,7 @@ export type GetMarketsResponse = { factory_address: Address llamma: Address rate: number + future_rate: number total_debt: number total_debt_usd: number n_loans: number