@@ -275,8 +275,8 @@ contract Liquidator is Ownable {
275275 returns (
276276 address tokenOut ,
277277 uint256 optimalAmount ,
278- uint256 flashLoanAmount ,
279278 uint256 repaidAmount ,
279+ uint256 flashLoanAmount ,
280280 bool isOptimalRepayable
281281 )
282282 {
@@ -289,7 +289,7 @@ contract Liquidator is Ownable {
289289
290290 (optimalAmount, repaidAmount, isOptimalRepayable) =
291291 _getOptimalAmount (creditAccount, tokenOut, hfOptimal, creditManager, priceOracle);
292- flashLoanAmount = priceOracle. convert (optimalAmount, tokenOut, creditManager. underlying ()) ;
292+ flashLoanAmount = _getChargedAmount (repaidAmount, creditManager) * 1005 / 1000 ;
293293 }
294294
295295 function _getBestTokenOut (address creditAccount , ICreditManagerV3 creditManager , IPriceOracleV3 priceOracle )
@@ -352,6 +352,13 @@ contract Liquidator is Ownable {
352352 return _adjustToDebtLimits (creditManager, optimalAmount, repaidAmount, CreditLogic.calcTotalDebt (cdd));
353353 }
354354
355+ function _getChargedAmount (uint256 repaidAmount , ICreditManagerV3 creditManager ) internal view returns (uint256 ) {
356+ (, uint256 feeLiquidation ,,,) = creditManager.fees ();
357+ uint256 partialFeeLiquidation =
358+ feeLiquidation * IPartialLiquidationBotV3 (partialLiquidationBot).feeScaleFactor () / PERCENTAGE_FACTOR;
359+ return repaidAmount * PERCENTAGE_FACTOR / (PERCENTAGE_FACTOR - partialFeeLiquidation);
360+ }
361+
355362 function _adjustToDebtLimits (
356363 ICreditManagerV3 creditManager ,
357364 uint256 optimalAmount ,
0 commit comments