sherlock-audit / 2023-03-sense-judging

4 stars 0 forks source link

tsvetanovv - ERC20 transfer zero amount can be reverted #53

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

tsvetanovv

medium

ERC20 transfer zero amount can be reverted

Summary

The protocol currently uses any tokens:

ERC20: any (USDC, DAI, USDT, ETH, stETH, etc)

Certain ERC20 tokens do not support zero-value token transfers and revert. As ERC20 can be an arbitrary token, in the case when such token doesn't allow for zero amount transfers.

Vulnerability Detail

In addition to the code snippet below, you should also check the other places where there is a ERC20 transfer.

Impact

ERC20 transfer zero amount can be reverted.

Code Snippet

Periphery.sol

143: ERC20(stake).safeTransfer(msg.sender, ERC20(stake).balanceOf(address(this)));

Divider.sol

182: ERC20(stake).safeTransferFrom(adapter, msg.sender, stakeSize);

Tool used

Manual Review

Recommendation

Add a simple check for zero-value token transfers.