The return value of IERC20(token).transfer is not checked. Actually, some tokens do not revert when failure and just return false state.
Vulnerability Detail
In DnGmxJuniorVaultManager._executeOperationToken, IERC20(token).transfer(address(state.balancerVault), amountWithPremium) is executed without check its return. When some tokens do not revert when failure and just return false, it won't act as the comments said "transfer token amount borrowed with premium back to balancer pool", and then, the pool would lost these assets.
In DnGmxBatchingManager.depositToken, IERC20(token).transferFrom(msg.sender,address(this),amount) is the same.
Impact
Unchecked return value would possibly cause loss of assets.
zimu
high
Unchecked return value of external tranfer call
Summary
The return value of
IERC20(token).transfer
is not checked. Actually, some tokens do not revert when failure and just return false state.Vulnerability Detail
In
DnGmxJuniorVaultManager._executeOperationToken
,IERC20(token).transfer(address(state.balancerVault), amountWithPremium)
is executed without check its return. When some tokens do not revert when failure and just return false, it won't act as the comments said "transfer token amount borrowed with premium back to balancer pool", and then, the pool would lost these assets.In
DnGmxBatchingManager.depositToken
, IERC20(token).transferFrom(msg.sender,address(this),amount) is the same.Impact
Unchecked return value would possibly cause loss of assets.
Code Snippet
https://github.com/sherlock-audit/2022-10-rage-trade/blob/main/dn-gmx-vaults/contracts/libraries/DnGmxJuniorVaultManager.sol#L947
https://github.com/sherlock-audit/2022-10-rage-trade/blob/main/dn-gmx-vaults/contracts/vaults/DnGmxBatchingManager.sol#187
Tool used
Manual Review
Recommendation
Check the return value of transfer. If return false, then revert the execution.