@@ -39,11 +39,11 @@ contract TreasuryLiquidator is SanityCheckTrait {
3939 address public immutable marketConfigurator;
4040
4141 /// @notice Mapping of approved liquidators who can use this contract
42- mapping (address => bool ) public isLiquidator;
42+ mapping (address liquidator = > bool isAllowed ) public isLiquidator;
4343
4444 /// @notice Mapping of minimum exchange rates (assetIn => assetOut => rate)
4545 /// Rate is in PERCENTAGE_FACTOR format (i.e. 10050 means 1.005 units of collateral per unit of underlying, regardless of decimals)
46- mapping (address => mapping (address => uint256 )) public minExchangeRates;
46+ mapping (address assetIn = > mapping (address assetOut = > uint256 rate )) public minExchangeRates;
4747
4848 // EVENTS
4949 event PartiallyLiquidateFromTreasury (
@@ -58,6 +58,7 @@ contract TreasuryLiquidator is SanityCheckTrait {
5858 error InsufficientTreasuryFundsException ();
5959 error UnsupportedTokenPairException ();
6060 error InvalidCreditSuiteException ();
61+ error IncorrectWrappedUnderlyingException ();
6162
6263 /// @notice Modifier to verify the sender is the treasury
6364 modifier onlyTreasury () {
@@ -72,6 +73,7 @@ contract TreasuryLiquidator is SanityCheckTrait {
7273 }
7374
7475 /// @notice Modifier to verify the credit facade is from the market configurator
76+ /// @param creditFacade The credit facade address
7577 modifier onlyCFFromMarketConfigurator (address creditFacade ) {
7678 address creditManager = ICreditFacadeV3 (creditFacade).creditManager ();
7779 bool isValidCM = IContractsRegister (IMarketConfigurator (marketConfigurator).contractsRegister ()).isCreditManager (
@@ -86,6 +88,7 @@ contract TreasuryLiquidator is SanityCheckTrait {
8688 /**
8789 * @notice Constructor
8890 * @param _treasury The address of the treasury
91+ * @param _marketConfigurator The address of the market configurator
8992 */
9093 constructor (address _treasury , address _marketConfigurator )
9194 nonZeroAddress (_treasury)
@@ -131,6 +134,7 @@ contract TreasuryLiquidator is SanityCheckTrait {
131134 * @param token The collateral token to seize
132135 * @param repaidAmount The amount of underlying to repay
133136 * @param priceUpdates Optional price updates to apply before liquidation
137+ * @param wrappedUnderlying ERC4626 vault that wraps the underlying token, if unwrapping is required
134138 */
135139 function partiallyLiquidateFromTreasury (
136140 address creditFacade ,
@@ -173,6 +177,7 @@ contract TreasuryLiquidator is SanityCheckTrait {
173177
174178 function _transferUnderlying (address underlying , address wrappedUnderlying , uint256 amount ) internal {
175179 if (wrappedUnderlying != address (0 )) {
180+ if (IERC4626 (wrappedUnderlying).asset () != underlying) revert IncorrectWrappedUnderlyingException ();
176181 uint256 wrappedAssets = IERC4626 (wrappedUnderlying).maxWithdraw (treasury);
177182 if (wrappedAssets < amount) revert InsufficientTreasuryFundsException ();
178183 IERC4626 (wrappedUnderlying).withdraw (amount, address (this ), treasury);
0 commit comments