IOracleMiddlewareWithPyth

Git Source

Inherits: ICommonOracleMiddleware

The oracle middleware is a contract that is used by the USDN protocol to validate price data. Using a middleware allows the protocol to later upgrade to a new oracle logic without having to modify the protocol's contracts.

This middleware uses Pyth as low-latency oracle and Chainlink Data Feeds as fallback.

Functions

BPS_DIVISOR

Gets the denominator for the variables using basis points as a unit.

function BPS_DIVISOR() external pure returns (uint16 denominator_);

Returns

NameTypeDescription
denominator_uint16The BPS divisor.

MAX_CONF_RATIO

Gets the maximum value for _confRatioBps.

function MAX_CONF_RATIO() external pure returns (uint16 ratio_);

Returns

NameTypeDescription
ratio_uint16The max allowed confidence ratio.

getConfRatioBps

Gets the confidence ratio.

This ratio is used to apply a specific portion of the confidence interval provided by an oracle, which is used to adjust the precision of predictions or estimations.

function getConfRatioBps() external view returns (uint16 ratio_);

Returns

NameTypeDescription
ratio_uint16The confidence ratio (in basis points).

setConfRatio

Sets the confidence ratio.

The new value should be lower than MAX_CONF_RATIO.

function setConfRatio(uint16 newConfRatio) external;

Parameters

NameTypeDescription
newConfRatiouint16the new confidence ratio.