Skip to content
Discussion options

You must be logged in to vote

Update: This is my new test that passed, I think i did it correctly, can anyone verify it?

function testSellPoolTokensBug() public {
        vm.startPrank(liquidityProvider);
        weth.approve(address(pool), 100e18);
        poolToken.approve(address(pool), 100e18);
        pool.deposit(100e18, 100e18, 100e18, uint64(block.timestamp));
        vm.stopPrank();

        vm.startPrank(user);
        poolToken.approve(address(pool), 9e18);
        uint256 expectedWethAmount =
            pool.getOutputAmountBasedOnInput(9e18, poolToken.balanceOf(address(pool)), weth.balanceOf(address(pool)));

        vm.expectRevert();
        pool.sellPoolTokens(9e18);
    }

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@EngrPips
Comment options

@EngrPips
Comment options

Answer selected by SquilliamX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants