Assessment reports>Benqi Oracle>Threat Model>setAssetOracles

Function: setAssetOracles(address asset, address edgeFeed, address chainlinkFeed, uint256 stalenessThreshold, uint256 customDeviationThreshold)

This function sets the oracles for an asset.

Inputs

  • asset

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: An asset to set the oracles of.

  • edgeFeed

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: An Edge feed to set the Edge oracle of.

  • chainlinkFeed

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: A Chainlink feed to set the Chainlink oracle of.

  • stalenessThreshold

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: A threshold to set the staleness of.

  • customDeviationThreshold

    • Control: Fully controlled by the caller.

    • Constraints: None.

    • Impact: A custom deviation threshold to set the deviation threshold of.

Branches and code coverage

Intended branches

  • Try to get the price of the asset from the Edge oracle.

  • Try to get the price of the asset from the Chainlink oracle.

  • Check if the price is stale.

  • Calculate the deviation between the Edge and Chainlink prices.

  • Set the oracles for the asset.

Negative behavior

  • Revert if the caller is not an owner.

  • Revert if the asset is not a zero address.

  • Revert if the Edge feed is not a zero address.

  • Revert if the Chainlink feed is not a zero address.

  • Revert if the staleness threshold is zero.

  • Revert if the custom deviation threshold is greater than the max deviation threshold.

Zellic © 2025Back to top ↑