Skip to content

Commit

Permalink
fix: return optimalAmountUnderlying
Browse files Browse the repository at this point in the history
  • Loading branch information
doomsower committed May 23, 2024
1 parent 595019d commit f785124
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 11 additions & 1 deletion contracts/Liquidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,16 @@ contract Liquidator is Ownable {
address creditAccount,
uint256 hfOptimal,
IPartialLiquidationBotV3.PriceUpdate[] memory priceUpdates
) external returns (address tokenOut, uint256 optimalAmount, uint256 repaidAmount, bool isOptimalRepayable) {
)
external
returns (
address tokenOut,
uint256 optimalAmount,
uint256 optimalAmountUnderlying,
uint256 repaidAmount,
bool isOptimalRepayable
)
{
ICreditManagerV3 creditManager = ICreditManagerV3(ICreditAccountV3(creditAccount).creditManager());
IPriceOracleV3 priceOracle = IPriceOracleV3(creditManager.priceOracle());

Expand All @@ -280,6 +289,7 @@ contract Liquidator is Ownable {

(optimalAmount, repaidAmount, isOptimalRepayable) =
_getOptimalAmount(creditAccount, tokenOut, hfOptimal, creditManager, priceOracle);
optimalAmountUnderlying = priceOracle.convert(optimalAmount, tokenOut, creditManager.underlying());
}

function _getBestTokenOut(address creditAccount, ICreditManagerV3 creditManager, IPriceOracleV3 priceOracle)
Expand Down
10 changes: 9 additions & 1 deletion contracts/interfaces/ILiquidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ interface ILiquidator {
address creditAccount,
uint256 hfOptimal,
IPartialLiquidationBotV3.PriceUpdate[] memory priceUpdates
) external returns (address tokenOut, uint256 optimalAmount, uint256 repaidAmount, bool isOptimalRepayable);
)
external
returns (
address tokenOut,
uint256 optimalAmount,
uint256 optimalAmountUnderlying,
uint256 repaidAmount,
bool isOptimalRepayable
);

function registerCM(address creditManager) external;

Expand Down

0 comments on commit f785124

Please sign in to comment.