By not checking the return value, operations that should have marked as failed, may potentially go through without actually approving anything.
Proof of Concept
Not all IERC20 implementations revert() when there's a failure in approve(). The function signature has a boolean return value and they indicate errors that way instead.
There are 4 instance of this issue:
```solidity
File: libraries/InteractionHelper.sol
32: IERC20Partial(token0).approve(address(sfpm), type(uint256).max);
33: IERC20Partial(token1).approve(address(sfpm), type(uint256).max);
36: IERC20Partial(token0).approve(address(ct0), type(uint256).max);
37: IERC20Partial(token1).approve(address(ct1), type(uint256).max);
```
[32](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L32), [33](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L33), [36](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L36), [37](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L37).
Lines of code
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/libraries/InteractionHelper.sol#L32-L37
Vulnerability details
Impact
By not checking the return value, operations that should have marked as failed, may potentially go through without actually approving anything.
Proof of Concept
Not all
IERC20
implementationsrevert()
when there's a failure inapprove()
. The function signature has aboolean
return value and they indicate errors that way instead.There are 4 instance of this issue:
```solidity File: libraries/InteractionHelper.sol 32: IERC20Partial(token0).approve(address(sfpm), type(uint256).max); 33: IERC20Partial(token1).approve(address(sfpm), type(uint256).max); 36: IERC20Partial(token0).approve(address(ct0), type(uint256).max); 37: IERC20Partial(token1).approve(address(ct1), type(uint256).max); ``` [32](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L32), [33](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L33), [36](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L36), [37](https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/libraries/InteractionHelper.sol#L37).Tools Used
Bot
Recommended Mitigation Steps
Make sure the return value is
true
.Assessed type
ERC20