Skip to content
Request an audit

‹ All findings

Codeup::claimCodeupERC20() may revert whenever the weth balance is very low

MediumCODEUP·Three Sigma · DeFi game · 23rd October, 2024M-1

Description

Codeup::claimCodeupERC20() adds liquidity to the Uniswap pool whenever the weth balance is bigger than 1. However, an amount bigger than 1 may still lead to reverts if it is low enough. If it is exactly 1, it will shift right to get the amount of weth to swap for CodeupERC20, trying to swap an amount of 0 and reverting. If it is bigger than 2, but still low, it may swap this for an even smaller amount of CodeupERC20, reverting when adding liquidity due to not providing enough liquidity to mint a single share. A poc is available to confirm the finding.

Recommendation

Instead of setting 1, a slightly bigger dust amount could be use to ensure it does not revert.