OraclePriceChecker
Inherits: IPriceChecker
Price checker that validates swap prices using IPriceOracle implementations
This allows reusing existing oracle infrastructure (ChainlinkOracle, CurveEMAOracle, CrossAdapter, etc.)
State Variables
oracle
The price oracle to use for validation
IPriceOracle public immutable oracle;
defaultMaxDeviationBps
Maximum allowed price deviation in basis points
uint256 public immutable defaultMaxDeviationBps;
Functions
constructor
Constructor
constructor(IPriceOracle _oracle, uint256 _defaultMaxDeviationBps) payable;
Parameters
Name | Type | Description |
---|---|---|
_oracle | IPriceOracle | The IPriceOracle implementation to use |
_defaultMaxDeviationBps | uint256 | Maximum allowed deviation in basis points (e.g., 500 = 5%) |
checkPrice
Check if a swap price meets the oracle requirements
function checkPrice(
uint256 amountIn,
address fromToken,
address toToken,
uint256 feeAmount,
uint256 minOut,
bytes calldata data
)
external
view
override
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
amountIn | uint256 | The amount of input tokens (including fee) |
fromToken | address | The input token address |
toToken | address | The output token address |
feeAmount | uint256 | The fee amount in input tokens |
minOut | uint256 | The minimum output amount from the solver |
data | bytes | Additional data (used for max deviation bps) |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | True if the price is acceptable |
Errors
InvalidDeviationBps
ERRORS ///
error InvalidDeviationBps();
PriceBelowMinimum
error PriceBelowMinimum();