MasterPriceOracle

Git Source

Inherits: Ownable, IOracle

Author: Sperax Foundation

Communicates with different price feeds to get the price

State Variables

tokenPriceFeed

Store price feed data for tokens.

mapping(address => PriceFeedData) public tokenPriceFeed;

Functions

updateTokenPriceFeed

Add/Update price feed for _token

Have to be extra cautious while updating the price feed.

function updateTokenPriceFeed(address _token, address _source, bytes memory _data) external onlyOwner;

Parameters

removeTokenPriceFeed

Remove an existing price feed for _token.

function removeTokenPriceFeed(address _token) external onlyOwner;

Parameters

getPrice

Gets the price feed for _token.

Function reverts if the price feed does not exists.

function getPrice(address _token) external view returns (PriceData memory);

Parameters

Returns

priceFeedExists

Validates if price feed exists for a _token

Function reverts if price feed not set.

function priceFeedExists(address _token) external view returns (bool);

Parameters

Returns

_getPriceFeed

Gets the price feed for a _token given the feed data.

function _getPriceFeed(address _token, address _source, bytes memory _msgData)
    private
    view
    returns (PriceData memory priceData);

Parameters

Returns

Events

PriceFeedUpdated

event PriceFeedUpdated(address indexed token, address indexed source, bytes msgData);

PriceFeedRemoved

event PriceFeedRemoved(address indexed token);

Errors

InvalidAddress

error InvalidAddress();

UnableToFetchPriceFeed

error UnableToFetchPriceFeed(address token);

InvalidPriceFeed

error InvalidPriceFeed(address token);

PriceFeedNotFound

error PriceFeedNotFound(address token);

Last updated