Price Oracle

We use ChainLink's decentralized oracles for the primary price feed, and use dForce oracle as a backup in case of price from ChainLink has significant deviation from markets.

  1. Check the price from a Chainlink aggregator.

  2. If the price is below or equal to zero, call dForce backup price oracle, which is currently maintained by the dForce team.

  3. For prices Chainlink not provided, price is posted by service maintained by dForce team, currently, only DF.

  4. In the future, dForce governance will manage the selection of price sources.

*GOLDx's price is calculated as the price of PAXG/30.1034768.

Method

getUnderlyingPrice()

Get the price of underlying token by iToken.

/**
     * @notice Get the underlying price of a iToken asset
     * @param _iToken The iToken to get the underlying price of
     * @return The underlying asset price mantissa (scaled by 1e18).
     *  Zero means the price is unavailable.
     */
    function getUnderlyingPrice(address _iToken)
        external
        view
        returns (uint256);

getUnderlyingPriceAndStatus()

Get underlying price and status if the price is available (for example, stock's price is unavailable when market close, here is "Nasdaq trading hours" for your reference).

/**
     * @notice Get the price and status of an underlying asset
     * @param _iToken The iToken to get the underlying price of
     * @return The underlying asset price mantissa (scaled by 1e18).
     * @return If the price is available, true is available, vice versa.
     */
    function getUnderlyingPriceAndStatus(address _iToken)
        external
        view
        returns (uint256, bool);

Last updated