@@ -620,6 +620,76 @@ contract ForeignControllerAddLiquidityFailureTests is UniswapV3TestBase {
620620 vm.stopPrank ();
621621 }
622622
623+
624+ function test_addLiquidityUniswapV3_lowerTickDoesNotMatchPosition () public {
625+ // Create new default position
626+ (UniswapV3Lib.Tick memory tick , UniswapV3Lib.TokenAmounts memory desired , )
627+ = _prepareDefaultAddLiquidity ();
628+
629+ vm.prank (ALM_RELAYER);
630+ (uint256 tokenId , , ,) = foreignController.addLiquidityUniswapV3 (
631+ _getPool (),
632+ 0 ,
633+ tick,
634+ desired,
635+ _minLiquidityPosition (desired.amount0, desired.amount1),
636+ block .timestamp + 1 hours
637+ );
638+
639+ vm.warp (block .timestamp + 2 hours);
640+
641+ // Adding liquidity with the different lower tick bound should fail
642+ vm.startPrank (ALM_RELAYER);
643+ vm.expectRevert ("UniswapV3Lib/lower-tick-does-not-match-position " );
644+ foreignController.addLiquidityUniswapV3 (
645+ _getPool (),
646+ tokenId,
647+ UniswapV3Lib.Tick ({
648+ lower: tick.lower + 1 ,
649+ upper: tick.upper
650+ }),
651+ desired,
652+ _minLiquidityPosition (desired.amount0, desired.amount1),
653+ block .timestamp + 1 hours
654+ );
655+ vm.stopPrank ();
656+ }
657+
658+ function test_addLiquidityUniswapV3_upperTickDoesNotMatchPosition () public {
659+ // Create new default position
660+ (UniswapV3Lib.Tick memory tick , UniswapV3Lib.TokenAmounts memory desired , )
661+ = _prepareDefaultAddLiquidity ();
662+
663+ vm.prank (ALM_RELAYER);
664+ (uint256 tokenId , , ,) = foreignController.addLiquidityUniswapV3 (
665+ _getPool (),
666+ 0 ,
667+ tick,
668+ desired,
669+ _minLiquidityPosition (desired.amount0, desired.amount1),
670+ block .timestamp + 1 hours
671+ );
672+
673+ vm.warp (block .timestamp + 2 hours);
674+
675+ // Adding liquidity with the different upper tick bound should fail
676+ vm.startPrank (ALM_RELAYER);
677+ vm.expectRevert ("UniswapV3Lib/upper-tick-does-not-match-position " );
678+ foreignController.addLiquidityUniswapV3 (
679+ _getPool (),
680+ tokenId,
681+ UniswapV3Lib.Tick ({
682+ lower: tick.lower,
683+ upper: tick.upper + 1
684+ }),
685+ desired,
686+ _minLiquidityPosition (desired.amount0, desired.amount1),
687+ block .timestamp + 1 hours
688+ );
689+ vm.stopPrank ();
690+ }
691+
692+
623693 function test_addLiquidityUniswapV3_failsAfterLowerTickBoundChanges () public {
624694 // Create new default position
625695 (UniswapV3Lib.Tick memory tick , UniswapV3Lib.TokenAmounts memory desired , )
0 commit comments