block-quote On this pagechevron-down
GitBook Assistant Ask chevron-down 技术参考 chevron-right 预言机 BoundValidator The BoundValidator contract is used to validate prices fetched from two different sources. Each asset has an upper and lower bound ratio set in the config. In order for a price to be valid it must fall within this range of the validator price.
Copy struct ValidateConfig {
address asset ;
uint256 upperBoundRatio ;
uint256 lowerBoundRatio ;
} validateConfigs
validation configs by asset
Copy mapping ( address => struct BoundValidator . ValidateConfig ) validateConfigs Constructor for the implementation contract. Sets immutable variables.
Initializes the owner of the contract
Parameters
setValidateConfigs
Add multiple validation configs at the same time
Parameters
📅 Events
Emits ValidateConfigAdded for each validation config that is successfully set
⛔️ Access Requirements
❌ Errors
Zero length error is thrown if length of the config array is 0
setValidateConfig
Add a single validation config
Parameters
📅 Events
Emits ValidateConfigAdded when a validation config is successfully set
⛔️ Access Requirements
❌ Errors
Null address error is thrown if asset address is null
Range error thrown if bound ratio is not positive
Range error thrown if lower bound is greater than or equal to upper bound
validatePriceWithAnchorPrice
Test reported asset price against anchor price
Parameters
❌ Errors
Missing error thrown if asset config is not set
Price error thrown if anchor price is not valid
Last updated 3 months ago