Skip to content

PegOracleImpl ​

Git Source

Inherits: OracleError

This contract is used to get the exchange rate between pegged assets like sUSDE / USDC or USDE / USDC. Price is adjusted for token decimals and optionally a IERC4626 source feed can be set (e.g. for sUSDE or sUSDS).

State Variables ​

_DECIMALS_PRICE_SCALER_MULTIPLIER ​

constant value for price scaling to reduce gas usage

solidity
uint256 internal immutable _DECIMALS_PRICE_SCALER_MULTIPLIER;

_ERC4626_FEED ​

IERC4626 source feed contract, e.g. sUSDE on mainnet 0x9d39a5de30e57443bff2a8307a4256c8797a3497

solidity
IERC4626 internal immutable _ERC4626_FEED;

_COL_TOKEN_DECIMALS ​

solidity
uint8 internal immutable _COL_TOKEN_DECIMALS;

_DEBT_TOKEN_DECIMALS ​

solidity
uint8 internal immutable _DEBT_TOKEN_DECIMALS;

Functions ​

constructor ​

solidity
constructor(uint8 colTokenDecimals_, uint8 debtTokenDecimals_, IERC4626 erc4626Feed_);

_getPegExchangeRate ​

Get the exchange rate for the pegged assets. Fetching from ERC4626 feed if configured.

solidity
function _getPegExchangeRate() internal view returns (uint256 rate_);

Returns

NameTypeDescription
rate_uint256The exchange rate in OracleUtils.RATE_OUTPUT_DECIMALS

pegOracleData ​

returns all peg oracle related data as utility for easy off-chain use / block explorer in a single view method

solidity
function pegOracleData()
    public
    view
    returns (uint256 pegExchangeRate_, IERC4626 erc4626Feed_, uint256 colTokenDecimals_, uint256 debtTokenDecimals_);