Skip to main content

Bound Validator

The BoundValidator contract provides price boundary validation within the Rheofi Protocol's resilient oracle system. It compares the main oracle's reported price against a pivot oracle's price and ensures the deviation falls within configured bounds.

Overview

The BoundValidator acts as a gatekeeper in the multi-source price validation pipeline. By enforcing upper and lower deviation thresholds, it detects potentially manipulated or erroneous prices before they are consumed by the protocol. If the main oracle's price deviates beyond the acceptable range relative to the pivot oracle, the price is rejected and the fallback oracle is consulted instead.

Key Functions

validatePriceWithAnchorPrice

Validates a reported price against an anchor (pivot) price using the configured bounds for the asset.

function validatePriceWithAnchorPrice(
address asset,
uint256 reportedPrice,
uint256 anchorPrice
) external view returns (bool);

Returns true if the reported price is within bounds, false otherwise.

setValidateConfig

Configures the validation bounds for a specific asset.

function setValidateConfig(ValidateConfig memory config) external;

The ValidateConfig struct:

struct ValidateConfig {
address asset;
uint256 upperBoundRatio;
uint256 lowerBoundRatio;
}
  • upperBoundRatio: Maximum allowed ratio of reported price to anchor price (e.g., 1.1e18 = 110%).
  • lowerBoundRatio: Minimum allowed ratio (e.g., 0.9e18 = 90%).

See Also