@@ -164,6 +164,87 @@ contract SystemParamsTest is DevTestSetup {
164164 );
165165 }
166166
167+ function testConstructorRevertsWhenRedistPenaltyExceedsMCRBuffer () public {
168+ // MCR = 110%, so buffer = 10%. Set redistribution penalty to 11% (exceeds buffer)
169+ ISystemParams.LiquidationParams memory liquidationParams = ISystemParams.LiquidationParams ({
170+ liquidationPenaltySP: 5e16 ,
171+ liquidationPenaltyRedistribution: 11 * _1pct // 11% > (110% - 100%)
172+ });
173+
174+ vm.expectRevert (ISystemParams.RedistPenaltyTooHigh.selector );
175+ new SystemParams (false ,
176+ _getValidDebtParams (),
177+ liquidationParams,
178+ _getValidGasCompParams (),
179+ _getValidCollateralParams (),
180+ _getValidInterestParams (),
181+ _getValidRedemptionParams (),
182+ _getValidPoolParams ()
183+ );
184+ }
185+
186+ function testConstructorAllowsRedistPenaltyEqualToMCRBuffer () public {
187+ // MCR = 110%, so buffer = 10%. Set redistribution penalty to exactly 10%
188+ ISystemParams.LiquidationParams memory liquidationParams = ISystemParams.LiquidationParams ({
189+ liquidationPenaltySP: 5e16 ,
190+ liquidationPenaltyRedistribution: 10 * _1pct // 10% == (110% - 100%)
191+ });
192+
193+ // Should not revert
194+ SystemParams params = new SystemParams (false ,
195+ _getValidDebtParams (),
196+ liquidationParams,
197+ _getValidGasCompParams (),
198+ _getValidCollateralParams (),
199+ _getValidInterestParams (),
200+ _getValidRedemptionParams (),
201+ _getValidPoolParams ()
202+ );
203+
204+ assertEq (params.LIQUIDATION_PENALTY_REDISTRIBUTION (), 10 * _1pct);
205+ }
206+
207+ function testConstructorRevertsWhenRedistPenaltyExceedsMCRBufferWithDifferentMCR () public {
208+ // MCR = 115%, so buffer = 15%. Set redistribution penalty to 16% (exceeds buffer)
209+ ISystemParams.CollateralParams memory collateralParams = ISystemParams.CollateralParams ({
210+ ccr: 150 * _1pct,
211+ scr: 115 * _1pct,
212+ mcr: 115 * _1pct,
213+ bcr: 10 * _1pct
214+ });
215+
216+ ISystemParams.LiquidationParams memory liquidationParams = ISystemParams.LiquidationParams ({
217+ liquidationPenaltySP: 5e16 ,
218+ liquidationPenaltyRedistribution: 16 * _1pct // 16% > (115% - 100%)
219+ });
220+
221+ vm.expectRevert (ISystemParams.RedistPenaltyTooHigh.selector );
222+ new SystemParams (false ,
223+ _getValidDebtParams (),
224+ liquidationParams,
225+ _getValidGasCompParams (),
226+ collateralParams,
227+ _getValidInterestParams (),
228+ _getValidRedemptionParams (),
229+ _getValidPoolParams ()
230+ );
231+
232+ liquidationParams = ISystemParams.LiquidationParams ({
233+ liquidationPenaltySP: 5e16 ,
234+ liquidationPenaltyRedistribution: 15 * _1pct // 15%
235+ });
236+
237+ new SystemParams (false ,
238+ _getValidDebtParams (),
239+ liquidationParams,
240+ _getValidGasCompParams (),
241+ collateralParams,
242+ _getValidInterestParams (),
243+ _getValidRedemptionParams (),
244+ _getValidPoolParams ()
245+ );
246+ }
247+
167248 // ========== GAS COMPENSATION VALIDATION TESTS ==========
168249
169250 function testConstructorRevertsWhenGasCompDivisorZero () public {
0 commit comments