diff --git a/script/DeployOracles.sol b/script/DeployOracles.sol index e5c81d6..bb463e3 100644 --- a/script/DeployOracles.sol +++ b/script/DeployOracles.sol @@ -14,8 +14,9 @@ struct OracleConfig { address baseFeed1; address baseFeed2; address collateralToken; - uint256 expectedPrice; address loanToken; + uint256 maxPrice; + uint256 minPrice; string name; address quoteFeed1; address quoteFeed2; @@ -67,9 +68,8 @@ contract DeployOracle is ConfiguredScript { console2.log(" Deployed ChainlinkOracle for market [%s] at: %s", oracleConfig.name, address(oracle)); uint256 price = oracle.price(); - uint256 priceRatio = price * 1 ether / oracleConfig.expectedPrice; - require(priceRatio <= 10 ether, string.concat("price too high: ", vm.toString(price))); - require(priceRatio >= 0.1 ether, string.concat("price too low: ", vm.toString(price))); + require(price <= oracleConfig.maxPrice, string.concat("price too high: ", vm.toString(price))); + require(price >= oracleConfig.minPrice, string.concat("price too low: ", vm.toString(price))); } } } diff --git a/script/config/oracles/ethereum.json b/script/config/oracles/ethereum.json index cc4c2e1..43a90a2 100644 --- a/script/config/oracles/ethereum.json +++ b/script/config/oracles/ethereum.json @@ -8,7 +8,8 @@ "quoteFeed1": "0x0000000000000000000000000000000000000000", "quoteFeed2": "0x0000000000000000000000000000000000000000", "vaultConversionSample": 1, - "expectedPrice": 1000000000000000000000000000000000000 + "minPrice": 100000000000000000000000000000000000, + "maxPrice": 1500000000000000000000000000000000000 }, { "name": "WETH (cbETH)", @@ -19,7 +20,8 @@ "quoteFeed1": "0x0000000000000000000000000000000000000000", "quoteFeed2": "0x0000000000000000000000000000000000000000", "vaultConversionSample": 1, - "expectedPrice": 1000000000000000000000000000000000000 + "minPrice": 100000000000000000000000000000000000, + "maxPrice": 1500000000000000000000000000000000000 }, { "name": "USDC (sDAI)", @@ -30,6 +32,7 @@ "quoteFeed1": "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6", "quoteFeed2": "0x0000000000000000000000000000000000000000", "vaultConversionSample": 1000000000000000000, - "expectedPrice": 1000000000000000000000000 + "minPrice": 990000000000000000000000, + "maxPrice": 1500000000000000000000000 } ]