mirror of
https://github.com/cerc-io/mars-interface.git
synced 2024-12-22 04:07:44 +00:00
Merge pull request #6 from mars-protocol/hotfix/incentives-apy
fix: fixed the incentives
This commit is contained in:
commit
41e2ee2e22
@ -31,15 +31,10 @@ const redBankSlice = (set: NamedSet<Store>, get: GetState<Store>): RedBankSlice
|
||||
const whitelistedAssets = get().whitelistedAssets
|
||||
const convertToBaseCurrency = get().convertToBaseCurrency
|
||||
const marsAsset = get().otherAssets?.find((asset) => asset.denom === MARS_SYMBOL)
|
||||
if (
|
||||
!incentive?.asset_incentive ||
|
||||
!marketTotalLiquidity ||
|
||||
!whitelistedAssets ||
|
||||
!convertToBaseCurrency
|
||||
)
|
||||
return
|
||||
|
||||
const anualEmission = Number(incentive.asset_incentive.emission_per_second) * SECONDS_IN_YEAR
|
||||
if (!incentive || !marketTotalLiquidity || !whitelistedAssets || !convertToBaseCurrency) return
|
||||
|
||||
const anualEmission = Number(incentive.emission_per_second) * SECONDS_IN_YEAR
|
||||
const anualEmissionVaule = convertToBaseCurrency({
|
||||
denom: lookupDenomBySymbol(MARS_SYMBOL, otherAssets),
|
||||
amount: anualEmission.toString(),
|
||||
@ -85,10 +80,6 @@ const redBankSlice = (set: NamedSet<Store>, get: GetState<Store>): RedBankSlice
|
||||
const convertToBaseCurrency = get().convertToBaseCurrency
|
||||
const reserveInfo = findByDenom(get().marketInfo, asset.denom)
|
||||
const depositApy = reserveInfo?.liquidity_rate || 0
|
||||
const incentiveInfo = get().calculateIncentiveAssetInfo(
|
||||
findByDenom(get().marketIncentiveInfo, asset.denom),
|
||||
{ denom: asset.denom, amount: get().computeMarketLiquidity(asset.denom).toString() },
|
||||
)
|
||||
const borrowApy = reserveInfo?.borrow_rate || 0
|
||||
const depositBalance = get().findUserDeposit(asset.denom)
|
||||
const borrowBalance = get().findUserDebt(asset.denom)
|
||||
@ -101,6 +92,12 @@ const redBankSlice = (set: NamedSet<Store>, get: GetState<Store>): RedBankSlice
|
||||
|
||||
const marketLiquidity = (depositLiquidity - debtLiquidity).toString()
|
||||
marketAssetLiquidity.push({ denom: asset.denom, amount: marketLiquidity })
|
||||
|
||||
const incentiveInfo = get().calculateIncentiveAssetInfo(
|
||||
findByDenom(get().marketIncentiveInfo, asset.denom),
|
||||
{ denom: asset.denom, amount: marketLiquidity },
|
||||
)
|
||||
|
||||
const redBankAsset: RedBankAsset = {
|
||||
...asset,
|
||||
walletBalance: assetWallet?.amount.toString(),
|
||||
|
8
src/types/interfaces/redbank.d.ts
vendored
8
src/types/interfaces/redbank.d.ts
vendored
@ -44,9 +44,7 @@ interface InterestRateModel {
|
||||
|
||||
interface MarketIncentive {
|
||||
denom: string
|
||||
asset_incentive: {
|
||||
emission_per_second: number
|
||||
index: number
|
||||
last_updated: number
|
||||
}
|
||||
emission_per_second: number
|
||||
index: number
|
||||
last_updated: number
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user