Assessment reports>Benqi Oracle>Threat Model>getOraclePriceWithFreshness

Function: getOraclePriceWithFreshness(IQiToken qiToken, bool isEdge, uint256 stalenessThreshold)

This function gets a price from an oracle and checks if it is fresh.

Inputs

  • qiToken

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: A qiToken to get the price of.

  • isEdge

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: A boolean to check if the price should be retrieved from the Edge oracle.

  • stalenessThreshold

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: A staleness threshold to check if the price is stale.

Branches and code coverage

Intended branches

  • Check if the price is stale.

  • Get the price from the Edge oracle.

  • Get the price from the Chainlink oracle.

  • Return the price and whether it is stale.

Negative behavior

  • Revert if the price is zero.

Zellic © 2025Back to top ↑