L-1: Incorrect disable controller call
Description:
The leverage and deleverage operators that use Euler as the flashloan provider first enable the controller via EVC.enableController() and then disable it via EVC.disableController(), which is incorrect, since the controller must disable itself.
120: eulerFL_items[0] = IEVC.BatchItem({
121: targetContract: address(EULER_EVC),
122: onBehalfOfAccount: address(0),
123: value: 0,
124: data: abi.encodeCall(IEVC.enableController, (address(this), address(targetVault)))
125: });
... ...
147: // 5) Disable controller
148: eulerFL_items[4] = IEVC.BatchItem({
149: targetContract: address(EULER_EVC),
150: onBehalfOfAccount: address(0),
151: value: 0,
152: data: abi.encodeCall(IEVC.disableController, (address(this)))
153: });
Impact:
Low. The controller is not properly disabled and will remain enabled after the leverage or deleverage call.
Recommendation:
In LeverageOperator_EulerFL and DeleverageOperator_EulerFL, change the last element of the Euler batch and call disableController() directly through the targetVault / collateralAsset.
Developer Response:
Fixed in PR#204.