MasterPriceOracle
Inherits: Ownable, IOracle
Author: Sperax Foundation
Communicates with different price feeds to get the price
State Variables
tokenPriceFeed
Store price feed data for tokens.
Functions
updateTokenPriceFeed
Add/Update price feed for _token
Have to be extra cautious while updating the price feed.
Parameters
Name | Type | Description |
---|---|---|
_token | address | address of the desired token. |
_source | address | price feed source. |
_data | bytes | call data for fetching the price feed. |
removeTokenPriceFeed
Remove an existing price feed for _token
.
Parameters
Name | Type | Description |
---|---|---|
_token | address | address of the token. |
getPrice
Gets the price feed for _token
.
Function reverts if the price feed does not exists.
Parameters
Name | Type | Description |
---|---|---|
_token | address | address of the desired token. |
Returns
Name | Type | Description |
---|---|---|
PriceData | (uint256 price, uint256 precision). |
priceFeedExists
Validates if price feed exists for a _token
Function reverts if price feed not set.
Parameters
Name | Type | Description |
---|---|---|
_token | address | address of the desired token. |
Returns
Name | Type | Description |
---|---|---|
bool | bool if price feed exists. |
_getPriceFeed
Gets the price feed for a _token
given the feed data.
Parameters
Name | Type | Description |
---|---|---|
_token | address | address of the desired token. |
_source | address | price feed source. |
_msgData | bytes | call data for fetching feed. |
Returns
Name | Type | Description |
---|---|---|
priceData | PriceData | (uint256 price, uint256 precision). |
Events
PriceFeedUpdated
PriceFeedRemoved
Errors
InvalidAddress
UnableToFetchPriceFeed
InvalidPriceFeed
PriceFeedNotFound
Last updated