From cc11e13765e52d45c17dc2e4c30a22e1ec25c351 Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Mon, 22 Jan 2024 09:27:44 -0300 Subject: [PATCH] fix: try get underlying price --- subgraphs/venus/src/utilities/getTokenPriceCents.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subgraphs/venus/src/utilities/getTokenPriceCents.ts b/subgraphs/venus/src/utilities/getTokenPriceCents.ts index e8161adb..117a0bce 100644 --- a/subgraphs/venus/src/utilities/getTokenPriceCents.ts +++ b/subgraphs/venus/src/utilities/getTokenPriceCents.ts @@ -1,5 +1,6 @@ import { Address, BigInt, log } from '@graphprotocol/graph-ts'; +import { valueOrNotAvailableIntIfReverted } from '.'; import { PriceOracle } from '../../generated/templates/VToken/PriceOracle'; import { getOrCreateComptroller } from '../operations/getOrCreate'; import { exponentToBigInt } from './exponentToBigInt'; @@ -22,7 +23,9 @@ export function getTokenPriceCents(eventAddress: Address, underlyingDecimals: i3 const mantissaDecimalFactor = 36 - underlyingDecimals; const bdFactor = exponentToBigInt(mantissaDecimalFactor); const oracle2 = PriceOracle.bind(oracleAddress); - const oracleUnderlyingPrice = oracle2.getUnderlyingPrice(eventAddress); + const oracleUnderlyingPrice = valueOrNotAvailableIntIfReverted( + oracle2.try_getUnderlyingPrice(eventAddress), + ); if (oracleUnderlyingPrice.equals(BigInt.zero())) { return oracleUnderlyingPrice; }