DexReservesFromLiquidityPeg ​
Inherits:DexReservesFromLiquidity
reads the dex reserves directly from Liquidity (user supply / user debt) and adds a certain % buffer.
State Variables ​
RESERVES_PEG_BUFFER_PERCENT ​
if Dex is e.g. USDC / USDT a peg can be assumed instead of fetching the price at the Dex Oracle (which might not even be active in such a case). If so, this var defines the peg buffer to reduce collateral value (and increase debt value) by some defined percentage for safety handling of price ranges. in 1e4: 10000 = 1%, 1000000 = 100%
solidity
uint256 public immutable RESERVES_PEG_BUFFER_PERCENT;
Functions ​
constructor ​
solidity
constructor(address dexPool_, bool quoteInToken0_, uint256 reservesPegBufferPercent_)
DexReservesFromLiquidity(dexPool_, quoteInToken0_);
_getDexCollateralReserves ​
Get the col reserves at the Dex adjusted to 1e12 decimals
solidity
function _getDexCollateralReserves()
internal
view
override
returns (uint256 token0Reserves_, uint256 token1Reserves_);
_getDexDebtReserves ​
Get the debt reserves at the Dex adjusted to 1e12 decimals
solidity
function _getDexDebtReserves() internal view override returns (uint256 token0Reserves_, uint256 token1Reserves_);