IOracleRelayer

Git Source

Inherits: IAuthorizable, IModifiable, IDisableable

Functions

safeEngine

The SAFEEngine is called to update the price of the collateral in the system

function safeEngine() external view returns (ISAFEEngine _safeEngine);

Returns

NameTypeDescription
_safeEngineISAFEEngineAddress of the contract that handles the state of the SAFEs

systemCoinOracle

The oracle used to fetch the system coin market price

function systemCoinOracle() external view returns (IBaseOracle _systemCoinOracle);

Returns

NameTypeDescription
_systemCoinOracleIBaseOracleAddress of the contract that provides the system coin price

params

Getter for the contract parameters struct

Returns a OracleRelayerParams struct

function params() external view returns (OracleRelayerParams memory _oracleRelayerParams);

_params

Getter for the unpacked contract parameters struct

function _params() external view returns (uint256 _redemptionRateUpperBound, uint256 _redemptionRateLowerBound);

cParams

Getter for the collateral parameters struct

Returns a OracleRelayerCollateralParams struct

function cParams(bytes32 _cType) external view returns (OracleRelayerCollateralParams memory _oracleRelayerCParams);

Parameters

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type

_cParams

Getter for the unpacked collateral parameters struct

function _cParams(bytes32 _cType)
  external
  view
  returns (IDelayedOracle _oracle, uint256 _safetyCRatio, uint256 _liquidationCRatio);

Parameters

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type

calcRedemptionPrice

View method to fetch the current redemption price

function calcRedemptionPrice() external view returns (uint256 _redemptionPrice);

Returns

NameTypeDescription
_redemptionPriceuint256The current calculated redemption price [ray]

marketPrice

The current system coin market price

function marketPrice() external view returns (uint256 _marketPrice);

Returns

NameTypeDescription
_marketPriceuint256The current system coin market price [ray]

redemptionRate

The redemption rate is the rate at which the redemption price changes over time

By changing the redemption rate, it changes the incentives of the system users

The redemption rate is a per-second rate [ray]

function redemptionRate() external view returns (uint256 _redemptionRate);

Returns

NameTypeDescription
_redemptionRateuint256The current updated redemption rate [ray]

redemptionPriceUpdateTime

Last time when the redemption price was changed

Used to calculate the current redemption price

function redemptionPriceUpdateTime() external view returns (uint256 _redemptionPriceUpdateTime);

Returns

NameTypeDescription
_redemptionPriceUpdateTimeuint256The last time when the redemption price was changed [unix timestamp]

redemptionPrice

Fetch the latest redemption price by first updating it

function redemptionPrice() external returns (uint256 _updatedPrice);

Returns

NameTypeDescription
_updatedPriceuint256The newly updated redemption price [ray]

updateCollateralPrice

Update the collateral price inside the system (inside SAFEEngine)

Usually called by a keeper, incentivized by the system to keep the prices up to date

function updateCollateralPrice(bytes32 _cType) external;

Parameters

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type

updateRedemptionRate

Update the system redemption rate, the rate at which the redemption price changes over time

Usually called by the PIDRateSetter

function updateRedemptionRate(uint256 _redemptionRate) external;

Parameters

NameTypeDescription
_redemptionRateuint256The newly calculated redemption rate [ray]

initializeCollateralType

Register a new collateral type in the OracleRelayer

function initializeCollateralType(bytes32 _cType, OracleRelayerCollateralParams memory _collateralParams) external;

Parameters

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type
_collateralParamsOracleRelayerCollateralParamsOracleRelayerCollateralParams valid struct containing the collateral parameters

collateralList

List of all the collateral types registered in the OracleRelayer

function collateralList() external view returns (bytes32[] memory __collateralList);

Returns

NameTypeDescription
__collateralListbytes32[]Array of all the collateral types registered

Events

UpdateRedemptionPrice

Emitted when the redemption price is updated

event UpdateRedemptionPrice(uint256 _redemptionPrice);

UpdateCollateralPrice

Emitted when a collateral type price is updated

event UpdateCollateralPrice(
  bytes32 indexed _cType, uint256 _priceFeedValue, uint256 _safetyPrice, uint256 _liquidationPrice
);

Errors

OracleRelayer_RedemptionPriceNotUpdated

Throws if the redemption price is not updated when updating the rate

error OracleRelayer_RedemptionPriceNotUpdated();

OracleRelayer_CollateralTypeAlreadyInitialized

Throws when trying to initialize a collateral type that is already initialized

error OracleRelayer_CollateralTypeAlreadyInitialized();

Structs

OracleRelayerParams

struct OracleRelayerParams {
  uint256 redemptionRateUpperBound;
  uint256 redemptionRateLowerBound;
}

OracleRelayerCollateralParams

struct OracleRelayerCollateralParams {
  IDelayedOracle oracle;
  uint256 safetyCRatio;
  uint256 liquidationCRatio;
}