20,000 USDC
View results
Submission Details
Severity: medium

Some ERC20 tokens revert on 0 transfer

Summary

Some ERC20 tokens revert when 0 value is transferred. Tokens like LEND have this additional restriction and can cause the pool's functionality to break. When fees are set to 0, users cannot access the Change() function. This broken functionality can limit what users can do in the pool. Having a token like LEND in a private pool is reasonable as the token is relatively well-known, but its extra functionality can cause a key function in the Private pool to revert.

Vulnerability Details

src/Staking.sol:
37 /// @param _amount the amount to deposit
38: function deposit(uint _amount) external {
39: TKN.transferFrom(msg.sender, address(this), _amount);
40: updateFor(msg.sender);
41: balances[msg.sender] += _amount;
42: }

Impact

Tools Used

Manuel Code Review

Recommendations

We recommend the protocol check if the feeAmount is 0 before performing transfer

if(_amount > 0) {
ERC20(baseToken).safeTransferFrom(
msg.sender,
address(this),
_amount
);
}

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.