🐛fix prices passed to HC and formatting (#473)
This commit is contained in:
parent
8a87329c90
commit
d7b91f4115
@ -9,4 +9,4 @@ export default async function getAssetParams(): Promise<AssetParamsBaseForAddr[]
|
||||
} catch (ex) {
|
||||
throw ex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,4 +140,4 @@ export default function LendingMarketsTable(props: Props) {
|
||||
)
|
||||
|
||||
return <AssetListTable title={title} rowRenderer={rowRenderer} columns={columns} data={data} />
|
||||
}
|
||||
}
|
||||
|
@ -269,4 +269,4 @@ export class OsmosisTheGraphDataFeed implements IDatafeedChartApi {
|
||||
unsubscribeBars(listenerGuid: string): void {
|
||||
// TheGraph doesn't support websockets yet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,4 +229,4 @@ export const ASSETS: Asset[] = [
|
||||
hasOraclePrice: !IS_TESTNET,
|
||||
forceFetchPrice: !IS_TESTNET,
|
||||
},
|
||||
]
|
||||
]
|
||||
|
@ -102,4 +102,4 @@ export default function useDepositVault(props: Props): {
|
||||
actions,
|
||||
totalValue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import {
|
||||
HealthComputer,
|
||||
} from 'types/generated/mars-rover-health-computer/MarsRoverHealthComputer.types'
|
||||
import { convertAccountToPositions } from 'utils/accounts'
|
||||
import { getAssetByDenom } from 'utils/assets'
|
||||
import { LTV_BUFFER } from 'utils/constants'
|
||||
import {
|
||||
BorrowTarget,
|
||||
@ -70,7 +71,13 @@ export default function useHealthComputer(account?: Account) {
|
||||
const priceData = useMemo(() => {
|
||||
return prices.reduce(
|
||||
(prev, curr) => {
|
||||
prev[curr.denom] = curr.amount.shiftedBy(VALUE_SCALE_FACTOR).toString()
|
||||
const decimals = getAssetByDenom(curr.denom)?.decimals || 6
|
||||
|
||||
// The HealthComputer needs prices expressed per 1 amount. So we need to correct here for any additional decimals.
|
||||
prev[curr.denom] = curr.amount
|
||||
.shiftedBy(VALUE_SCALE_FACTOR)
|
||||
.shiftedBy(-decimals + 6)
|
||||
.toString()
|
||||
return prev
|
||||
},
|
||||
{} as { [key: string]: string },
|
||||
|
@ -56,4 +56,4 @@ function useLendingMarketAssetsTableData(): {
|
||||
}, [markets, marketDeposits, marketLiquidities, accountLentAmounts, convertAmount])
|
||||
}
|
||||
|
||||
export default useLendingMarketAssetsTableData
|
||||
export default useLendingMarketAssetsTableData
|
||||
|
2
src/types/interfaces/asset.d.ts
vendored
2
src/types/interfaces/asset.d.ts
vendored
@ -96,4 +96,4 @@ interface MarketTableData {
|
||||
marketLiquidityRate: number
|
||||
marketLiquidityAmount: BigNumber
|
||||
marketLiquidationThreshold: number
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user