sherlock-audit / 2023-05-Index-judging

6 stars 3 forks source link

erictee - M - wrong function name used in _setEModeCategory in AaveV3LeverageStrategyExtension.sol #307

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

erictee

medium

M - wrong function name used in _setEModeCategory in AaveV3LeverageStrategyExtension.sol

Summary

Wrong implementation in function _setEModeCategory in AaveV3LeverageStrategyExtension.sol.

Vulnerability Detail

The function  _setEModeCategory in AaveV3LeverageStrategyExtension.sol is implemented wrongly. According to the parameters supplied, it is supposed to call setAssetEModeCategory instead of setEModeCategory. As a result, function cannot be called properly.

Impact

Wrong function name is used. As a result, the function cannot be called properly.

Code Snippet

 function _setEModeCategory(uint8 _categoryId) internal {
        bytes memory setEmodeCallData =
            abi.encodeWithSignature("setEModeCategory(address,uint8)", address(strategy.setToken), _categoryId); //@audit-issue Should be setAssetEModeCategory
        invokeManager(address(strategy.leverageModule), setEmodeCallData);
    }

https://github.com/sherlock-audit/2023-05-Index/blob/main/index-coop-smart-contracts/contracts/adapters/AaveV3LeverageStrategyExtension.sol#L66

Tool used

Manual Review

Recommendation

Use setAssetEModeCategory instead of setEModeCategory.
More Details: https://docs.aave.com/developers/core-contracts/poolconfigurator