From 0d3c003367b83b0e49c00daeb5590d6dbb47bef9 Mon Sep 17 00:00:00 2001 From: clemlak Date: Fri, 23 Feb 2024 18:15:41 +0400 Subject: [PATCH] test: add revert check when maxDeltaY is reached in G3M strategy --- src/test/unit/strategies/G3M/Allocate.t.sol | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/unit/strategies/G3M/Allocate.t.sol b/src/test/unit/strategies/G3M/Allocate.t.sol index 96e54964..20999b39 100644 --- a/src/test/unit/strategies/G3M/Allocate.t.sol +++ b/src/test/unit/strategies/G3M/Allocate.t.sol @@ -57,6 +57,17 @@ contract G3MAllocateTest is G3MSetUp { dfmm.allocate(POOL_ID, data); } + function test_G3M_allocate_RevertsIfMoreThanMaxDeltaY() public init { + uint256 maxDeltaX = 0.1 ether; + + (uint256 maxDeltaY, uint256 deltaLiquidity) = + solver.allocateGivenDeltaX(POOL_ID, maxDeltaX); + + bytes memory data = abi.encode(maxDeltaX, maxDeltaY - 1, deltaLiquidity); + vm.expectRevert(); + dfmm.allocate(POOL_ID, data); + } + function test_G3M_allocate_GivenY() public init { uint256 maxDeltaY = 0.1 ether;