diff --git a/contracts/protocol/pool/DefaultReserveInterestRateStrategy.sol b/contracts/protocol/pool/DefaultReserveInterestRateStrategy.sol index 7735bd16f..e8dc47f56 100644 --- a/contracts/protocol/pool/DefaultReserveInterestRateStrategy.sol +++ b/contracts/protocol/pool/DefaultReserveInterestRateStrategy.sol @@ -7,6 +7,7 @@ import {PercentageMath} from '../libraries/math/PercentageMath.sol'; import {DataTypes} from '../libraries/types/DataTypes.sol'; import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol'; import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol'; +import {Errors} from '../libraries/helpers/Errors.sol'; /** * @title DefaultReserveInterestRateStrategy contract diff --git a/test-suites/rate-strategy.spec.ts b/test-suites/rate-strategy.spec.ts index c90e8ca1d..195a8241f 100644 --- a/test-suites/rate-strategy.spec.ts +++ b/test-suites/rate-strategy.spec.ts @@ -364,4 +364,41 @@ makeSuite('InterestRateStrategy', (testEnv: TestEnv) => { rateStrategyStableTwo.stableRateSlope2 ); }); + + it('Deploy an interest rate strategy with optimalUtilizationRate out of range', async () => { + const { addressesProvider } = testEnv; + + await expect( + deployDefaultReserveInterestRateStrategy([ + addressesProvider.address, + utils.parseUnits('1.0', 28), + rateStrategyStableTwo.baseVariableBorrowRate, + rateStrategyStableTwo.variableRateSlope1, + rateStrategyStableTwo.variableRateSlope2, + rateStrategyStableTwo.stableRateSlope1, + rateStrategyStableTwo.stableRateSlope2, + rateStrategyStableTwo.baseStableRateOffset, + rateStrategyStableTwo.stableRateExcessOffset, + rateStrategyStableTwo.optimalStableToTotalDebtRatio, + ]) + ).to.be.reverted; + }); + + it('Deploy an interest rate strategy with optimalStableToTotalDebtRatio out of range', async () => { + const { addressesProvider } = testEnv; + await expect( + deployDefaultReserveInterestRateStrategy([ + addressesProvider.address, + rateStrategyStableTwo.optimalUtilizationRate, + rateStrategyStableTwo.baseVariableBorrowRate, + rateStrategyStableTwo.variableRateSlope1, + rateStrategyStableTwo.variableRateSlope2, + rateStrategyStableTwo.stableRateSlope1, + rateStrategyStableTwo.stableRateSlope2, + rateStrategyStableTwo.baseStableRateOffset, + rateStrategyStableTwo.stableRateExcessOffset, + utils.parseUnits('1.0', 28), + ]) + ).to.be.reverted; + }); });