IOracleRelayer
Inherits: IAuthorizable, IDisableable, IModifiable, IModifiablePerCollateral
Functions
safeEngine
The SAFEEngine is called to update the price of the collateral in the system
function safeEngine() external view returns (ISAFEEngine _safeEngine);
Returns
Name | Type | Description |
---|---|---|
_safeEngine | ISAFEEngine | Address 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
Name | Type | Description |
---|---|---|
_systemCoinOracle | IBaseOracle | Address of the contract that provides the system coin price |
params
Getter for the contract parameters struct
function params() external view returns (OracleRelayerParams memory _oracleRelayerParams);
Returns
Name | Type | Description |
---|---|---|
_oracleRelayerParams | OracleRelayerParams | An OracleRelayerParams struct |
_params
Getter for the unpacked contract parameters struct
function _params() external view returns (uint256 _redemptionRateUpperBound, uint256 _redemptionRateLowerBound);
Returns
Name | Type | Description |
---|---|---|
_redemptionRateUpperBound | uint256 | Upper bound for the per-second redemption rate [ray] |
_redemptionRateLowerBound | uint256 | Lower bound for the per-second redemption rate [ray] |
cParams
Getter for the collateral parameters struct
function cParams(bytes32 _cType) external view returns (OracleRelayerCollateralParams memory _oracleRelayerCParams);
Parameters
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
Returns
Name | Type | Description |
---|---|---|
_oracleRelayerCParams | OracleRelayerCollateralParams | An OracleRelayerCollateralParams struct |
_cParams
Getter for the unpacked collateral parameters struct
function _cParams(bytes32 _cType)
external
view
returns (IBaseOracle _oracle, uint256 _safetyCRatio, uint256 _liquidationCRatio);
Parameters
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
Returns
Name | Type | Description |
---|---|---|
_oracle | IBaseOracle | Usually a DelayedOracle that enforces delays to fresh price feeds |
_safetyCRatio | uint256 | CRatio used to compute the 'safePrice' - the price used when generating debt in SAFEEngine [ray] |
_liquidationCRatio | uint256 | CRatio used to compute the 'liquidationPrice' - the price used when liquidating SAFEs [ray] |
calcRedemptionPrice
View method to fetch the current redemption price
function calcRedemptionPrice() external view returns (uint256 _redemptionPrice);
Returns
Name | Type | Description |
---|---|---|
_redemptionPrice | uint256 | The current calculated redemption price [ray] |
marketPrice
The current system coin market price
function marketPrice() external view returns (uint256 _marketPrice);
Returns
Name | Type | Description |
---|---|---|
_marketPrice | uint256 | The 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
Name | Type | Description |
---|---|---|
_redemptionRate | uint256 | The 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
Name | Type | Description |
---|---|---|
_redemptionPriceUpdateTime | uint256 | The 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
Name | Type | Description |
---|---|---|
_updatedPrice | uint256 | The 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
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 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
Name | Type | Description |
---|---|---|
_redemptionRate | uint256 | The newly calculated redemption rate [ray] |
Events
UpdateRedemptionPrice
Emitted when the redemption price is updated
event UpdateRedemptionPrice(uint256 _redemptionPrice);
Parameters
Name | Type | Description |
---|---|---|
_redemptionPrice | uint256 | The new redemption price [ray] |
UpdateCollateralPrice
Emitted when a collateral type price is updated
event UpdateCollateralPrice(
bytes32 indexed _cType, uint256 _priceFeedValue, uint256 _safetyPrice, uint256 _liquidationPrice
);
Parameters
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
_priceFeedValue | uint256 | The new collateral price [wad] |
_safetyPrice | uint256 | The new safety price [ray] |
_liquidationPrice | uint256 | The new liquidation price [ray] |
UpdateRedemptionRate
Emitted when the redemption rate is updated
event UpdateRedemptionRate(uint256 _redemptionRate);
Parameters
Name | Type | Description |
---|---|---|
_redemptionRate | uint256 | The new redemption rate [ray] |
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 {
IBaseOracle oracle;
uint256 safetyCRatio;
uint256 liquidationCRatio;
}