Skip to content

Commit

Permalink
feat: add PoolManager test (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
partylikeits1983 authored Aug 15, 2023
1 parent 1f6e9d5 commit 5ffaa5f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/foundry-tests/PoolManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,19 @@ contract PoolManagerTest is Test, Deployers, TokenFixture, GasSnapshot, IERC1155
manager.initialize(keyInvertedCurrency, sqrtPriceX96, ZERO_BYTES);
}

function testPoolManagerInitializeRevertsWhenPoolAlreadyInitialized(uint160 sqrtPriceX96) public {
// Assumptions tested in Pool.t.sol
vm.assume(sqrtPriceX96 >= TickMath.MIN_SQRT_RATIO);
vm.assume(sqrtPriceX96 < TickMath.MAX_SQRT_RATIO);

PoolKey memory key =
PoolKey({currency0: currency0, currency1: currency1, fee: 3000, hooks: IHooks(address(0)), tickSpacing: 60});

manager.initialize(key, sqrtPriceX96, ZERO_BYTES);
vm.expectRevert(Pool.PoolAlreadyInitialized.selector);
manager.initialize(key, sqrtPriceX96, ZERO_BYTES);
}

function testPoolManagerInitializeFailsWithIncorrectSelectors() public {
address hookAddr = address(uint160(Hooks.BEFORE_INITIALIZE_FLAG | Hooks.AFTER_INITIALIZE_FLAG));

Expand Down

0 comments on commit 5ffaa5f

Please sign in to comment.