diff --git a/test/fuzz/GulpFuzzTest.t.sol b/test/fuzz/GulpFuzzTest.t.sol index 67756c56..602eff00 100644 --- a/test/fuzz/GulpFuzzTest.t.sol +++ b/test/fuzz/GulpFuzzTest.t.sol @@ -1,11 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; -import { - EulerAggregationVaultBase, - EulerAggregationVault, - IEulerAggregationVault -} from "../common/EulerAggregationVaultBase.t.sol"; +import {EulerAggregationVaultBase, EulerAggregationVault} from "../common/EulerAggregationVaultBase.t.sol"; contract GulpFuzzTest is EulerAggregationVaultBase { function setUp() public virtual override { @@ -15,11 +11,9 @@ contract GulpFuzzTest is EulerAggregationVaultBase { _addStrategy(manager, address(eTST), initialStrategyAllocationPoints); } - function testFuzz_interestAccrued_under_uint168( - uint256 _interestAmount, - uint256 _depositAmount, - uint256 _timePassed - ) public { + function testFuzzInterestAccruedUnderUint168(uint256 _interestAmount, uint256 _depositAmount, uint256 _timePassed) + public + { _depositAmount = bound(_depositAmount, 0, type(uint112).max); // this makes sure that the mint won't cause overflow in token accounting _interestAmount = bound(_interestAmount, 0, type(uint112).max - _depositAmount); @@ -41,7 +35,7 @@ contract GulpFuzzTest is EulerAggregationVaultBase { } // this tests shows that when you have a very small deposit and a very large interestAmount minted to the contract - function testFuzz_gulp_under_uint168(uint256 _interestAmount, uint256 _depositAmount) public { + function testFuzzGulpUnderUint168(uint256 _interestAmount, uint256 _depositAmount) public { _depositAmount = bound(_depositAmount, 1e7, type(uint112).max); _interestAmount = bound(_interestAmount, 0, type(uint256).max - _depositAmount); // this makes sure that the mint won't cause overflow @@ -64,4 +58,24 @@ contract GulpFuzzTest is EulerAggregationVaultBase { assertEq(aggregationVaultSavingRate.interestLeft, type(uint168).max); } } + + function testFuzzGulpBelowMinSharesForGulp() public { + uint256 depositAmount = 1337; + assetTST.mint(user1, depositAmount); + vm.startPrank(user1); + assetTST.approve(address(eulerAggregationVault), depositAmount); + eulerAggregationVault.deposit(depositAmount, user1); + vm.stopPrank(); + + uint256 interestAmount = 10e18; + // Mint interest directly into the contract + assetTST.mint(address(eulerAggregationVault), interestAmount); + eulerAggregationVault.gulp(); + skip(eulerAggregationVault.INTEREST_SMEAR()); + + EulerAggregationVault.AggregationVaultSavingRate memory aggregationVaultSavingRate = + eulerAggregationVault.getAggregationVaultSavingRate(); + assertEq(eulerAggregationVault.totalAssets(), depositAmount); + assertEq(aggregationVaultSavingRate.interestLeft, 0); + } }