Skip to content

DexReservesFromPEX ​

Git Source

Inherits:DexOracleBase, DexPricesAndExchangePrices

reads the dex reserves directly from Liquidity (user supply / user debt) but adjusts them for a certain price, incl. adjusted PEX.

Functions ​

constructor ​

solidity
constructor(address dexPool_, bool quoteInToken0_) DexOracleBase(dexPool_, quoteInToken0_);

_getDexCollateralReserves ​

Get the col reserves at the Dex adjusted to 1e12 decimals. Pass in the conversion price and PEX fetched via _getPricesAndExchangePrices().

solidity
function _getDexCollateralReserves(uint256 price_, PricesAndExchangePrice memory pex_)
    internal
    view
    returns (uint256 token0Reserves_, uint256 token1Reserves_);

_getDexDebtReserves ​

Get the debt reserves at the Dex adjusted to 1e12 decimals. Pass in the conversion price and PEX fetched via _getPricesAndExchangePrices().

solidity
function _getDexDebtReserves(uint256 price_, PricesAndExchangePrice memory pex_)
    internal
    view
    returns (uint256 token0Debt_, uint256 token1Debt_);