thehubbleproject / hubble-contracts

Hubble optimistic rollup
https://thehubbleproject.github.io/docs/
MIT License
133 stars 28 forks source link

Skip ERC20 allowance check and transfer when depositFor l1Amount is zero #627

Closed jacque006 closed 3 years ago

jacque006 commented 3 years ago

Problem

When a user calls DepositManager.depositFor with a zero (0) l1Amount, a ERC20 check and then transfer are called (https://github.com/thehubbleproject/hubble-contracts/blob/master/contracts/DepositManager.sol#L155-L159). This is unnecessary and leads to a higher gas cost.

Solution