Borrow Rate to APY (#632)

* fix: changed Borrow Rate to Borrow Rate APY

* fix: regarding feedback
This commit is contained in:
Linkie Link 2023-11-13 13:46:03 +01:00 committed by GitHub
parent abd05f3609
commit 28f27c3882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "mars-v2-frontend", "name": "mars-v2-frontend",
"version": "2.0.3", "version": "2.0.4",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "yarn validate-env && next build", "build": "yarn validate-env && next build",

View File

@ -1,9 +1,7 @@
import React from 'react'
import { FormattedNumber } from 'components/FormattedNumber' import { FormattedNumber } from 'components/FormattedNumber'
import Loading from 'components/Loading' import Loading from 'components/Loading'
export const BORROW_RATE_META = { accessorKey: 'borrowRate', header: 'Borrow Rate' } export const BORROW_RATE_META = { accessorKey: 'borrowRate', header: 'Borrow Rate APY' }
interface Props { interface Props {
borrowRate: number | null borrowRate: number | null

View File

@ -202,7 +202,7 @@ function BorrowModal(props: Props) {
<div className='flex gap-3 px-6 py-4 border-b border-white/5 gradient-header'> <div className='flex gap-3 px-6 py-4 border-b border-white/5 gradient-header'>
<TitleAndSubCell <TitleAndSubCell
title={formatPercent(modal.marketData.borrowRate || '0')} title={formatPercent(modal.marketData.borrowRate || '0')}
sub={'Borrow rate'} sub={'Borrow Rate APY'}
/> />
{totalDebt.isGreaterThan(0) && ( {totalDebt.isGreaterThan(0) && (
<> <>

View File

@ -81,7 +81,7 @@ export default function TradeSummary(props: Props) {
/> />
</div> </div>
<div className={infoLineClasses}> <div className={infoLineClasses}>
<span className='opacity-40'>Borrow rate</span> <span className='opacity-40'>Borrow Rate APY</span>
<span>{formatPercent(borrowRate || 0)}</span> <span>{formatPercent(borrowRate || 0)}</span>
</div> </div>
</> </>

View File

@ -5,6 +5,7 @@ import {
} from 'types/generated/mars-params/MarsParams.types' } from 'types/generated/mars-params/MarsParams.types'
import { Market as RedBankMarket } from 'types/generated/mars-red-bank/MarsRedBank.types' import { Market as RedBankMarket } from 'types/generated/mars-red-bank/MarsRedBank.types'
import { BN, getLeverageFromLTV } from 'utils/helpers' import { BN, getLeverageFromLTV } from 'utils/helpers'
import { convertAprToApy } from 'utils/parsers'
export function resolveMarketResponse( export function resolveMarketResponse(
marketResponse: RedBankMarket, marketResponse: RedBankMarket,
@ -13,7 +14,7 @@ export function resolveMarketResponse(
): Market { ): Market {
return { return {
denom: marketResponse.denom, denom: marketResponse.denom,
borrowRate: Number(marketResponse.borrow_rate) * 100, borrowRate: convertAprToApy(Number(marketResponse.borrow_rate), 365) * 100,
debtTotalScaled: marketResponse.debt_total_scaled, debtTotalScaled: marketResponse.debt_total_scaled,
collateralTotalScaled: marketResponse.collateral_total_scaled, collateralTotalScaled: marketResponse.collateral_total_scaled,
depositEnabled: assetParamsResponse.red_bank.deposit_enabled, depositEnabled: assetParamsResponse.red_bank.deposit_enabled,