Skip to content

Commit

Permalink
chore: 👕
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Sep 20, 2023
1 parent 7fed176 commit bf53351
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions subgraphs/venus/src/utilities/getBnbPriceInUsd.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Address, BigDecimal } from '@graphprotocol/graph-ts';

import { PriceOracle } from '../../generated/templates/VToken/PriceOracle';
import { mantissaFactorBigDecimal } from '../constants';
import { vBnbAddress } from '../constants/addresses';
import { getOrCreateComptroller } from '../operations/getOrCreate';
import { mantissaFactorBigDecimal } from '../constants';

export function getBnbPriceInUsd(): BigDecimal {
const comptroller = getOrCreateComptroller();

const oracleAddress = Address.fromBytes(comptroller.priceOracle);
const oracle = PriceOracle.bind(oracleAddress);
const bnbPriceInUSD = oracle.getUnderlyingPrice(vBnbAddress).toBigDecimal().div(mantissaFactorBigDecimal);
const oracle = PriceOracle.bind(oracleAddress);
const bnbPriceInUSD = oracle
.getUnderlyingPrice(vBnbAddress)
.toBigDecimal()
.div(mantissaFactorBigDecimal);
return bnbPriceInUSD;
}

0 comments on commit bf53351

Please sign in to comment.