diff --git a/.forge-snapshots/PositionManager_permit_secondPosition.snap b/.forge-snapshots/PositionManager_permit_secondPosition.snap index b1dc5c69..f7b2bb9f 100644 --- a/.forge-snapshots/PositionManager_permit_secondPosition.snap +++ b/.forge-snapshots/PositionManager_permit_secondPosition.snap @@ -1 +1 @@ -62075 \ No newline at end of file +62063 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_permit_twice.snap b/.forge-snapshots/PositionManager_permit_twice.snap index 3df0b01a..54b7cc91 100644 --- a/.forge-snapshots/PositionManager_permit_twice.snap +++ b/.forge-snapshots/PositionManager_permit_twice.snap @@ -1 +1 @@ -44963 \ No newline at end of file +44975 \ No newline at end of file diff --git a/script/DeployPosm.s.sol b/script/DeployPosm.s.sol index 006ce4f6..c51c2ca4 100644 --- a/script/DeployPosm.s.sol +++ b/script/DeployPosm.s.sol @@ -21,7 +21,7 @@ contract DeployPosmTest is Script { ) public returns (IPositionDescriptor positionDescriptor, IPositionManager posm) { vm.startBroadcast(); - positionDescriptor = Deploy.positionDescriptor(poolManager, wrappedNative, nativeCurrencyLabel); + positionDescriptor = Deploy.positionDescriptor(poolManager, wrappedNative, nativeCurrencyLabel, hex"00"); console2.log("PositionDescriptor", address(positionDescriptor)); posm = Deploy.positionManager( diff --git a/script/DeployStateView.s.sol b/script/DeployStateView.s.sol index c90fbe6a..230bd819 100644 --- a/script/DeployStateView.s.sol +++ b/script/DeployStateView.s.sol @@ -13,7 +13,7 @@ contract DeployStateView is Script { vm.startBroadcast(); // forge script --broadcast --sig 'run(address)' --rpc-url <RPC_URL> --private-key <PRIV_KEY> --verify script/DeployStateView.s.sol:DeployStateView <POOL_MANAGER_ADDR> - state = Deploy.stateView(poolManager); + state = Deploy.stateView(poolManager, hex"00"); console2.log("StateView", address(state)); console2.log("PoolManager", address(state.poolManager())); diff --git a/script/DeployV4Quoter.s.sol b/script/DeployV4Quoter.s.sol index 1d7e82a9..72361df6 100644 --- a/script/DeployV4Quoter.s.sol +++ b/script/DeployV4Quoter.s.sol @@ -13,7 +13,7 @@ contract DeployV4Quoter is Script { vm.startBroadcast(); // forge script --broadcast --sig 'run(address)' --rpc-url <RPC_URL> --private-key <PRIV_KEY> --verify script/DeployV4Quoter.s.sol:DeployV4Quoter <POOL_MANAGER_ADDR> - state = Deploy.v4Quoter(poolManager); + state = Deploy.v4Quoter(poolManager, hex"00"); console2.log("V4Quoter", address(state)); console2.log("PoolManager", address(state.poolManager())); diff --git a/test/StateViewTest.t.sol b/test/StateViewTest.t.sol index 21228f25..17e8f7f7 100644 --- a/test/StateViewTest.t.sol +++ b/test/StateViewTest.t.sol @@ -39,7 +39,7 @@ contract StateViewTest is Test, Deployers, Fuzzers, GasSnapshot { poolId = key.toId(); manager.initialize(key, SQRT_PRICE_1_1); - state = Deploy.stateView(address(manager)); + state = Deploy.stateView(address(manager), hex"00"); } function test_getSlot0() public { diff --git a/test/V4Quoter.t.sol b/test/V4Quoter.t.sol index 5deaacf1..8b2dc5c3 100644 --- a/test/V4Quoter.t.sol +++ b/test/V4Quoter.t.sol @@ -55,7 +55,7 @@ contract QuoterTest is Test, Deployers, GasSnapshot { function setUp() public { deployFreshManagerAndRouters(); - quoter = Deploy.v4Quoter(address(manager)); + quoter = Deploy.v4Quoter(address(manager), hex"00"); positionManager = new PoolModifyLiquidityTest(manager); // salts are chosen so that address(token0) < address(token1) && address(token1) < address(token2) diff --git a/test/shared/Deploy.sol b/test/shared/Deploy.sol index eab08ec0..4b671d8c 100644 --- a/test/shared/Deploy.sol +++ b/test/shared/Deploy.sol @@ -25,30 +25,32 @@ library Deploy { } } - function stateView(address poolManager) internal returns (IStateView stateView_) { + function stateView(address poolManager, bytes memory salt) internal returns (IStateView stateView_) { bytes memory args = abi.encode(poolManager); bytes memory initcode = abi.encodePacked(vm.getCode("StateView.sol:StateView"), args); assembly { - stateView_ := create(0, add(initcode, 0x20), mload(initcode)) + stateView_ := create2(0, add(initcode, 0x20), mload(initcode), salt) } } - function v4Quoter(address poolManager) internal returns (IV4Quoter quoter) { + function v4Quoter(address poolManager, bytes memory salt) internal returns (IV4Quoter quoter) { bytes memory args = abi.encode(poolManager); bytes memory initcode = abi.encodePacked(vm.getCode("V4Quoter.sol:V4Quoter"), args); assembly { - quoter := create(0, add(initcode, 0x20), mload(initcode)) + quoter := create2(0, add(initcode, 0x20), mload(initcode), salt) } } - function positionDescriptor(address poolManager, address wrappedNative, string memory nativeCurrencyLabel) - internal - returns (IPositionDescriptor descriptor) - { + function positionDescriptor( + address poolManager, + address wrappedNative, + string memory nativeCurrencyLabel, + bytes memory salt + ) internal returns (IPositionDescriptor descriptor) { bytes memory args = abi.encode(poolManager, wrappedNative, nativeCurrencyLabel); bytes memory initcode = abi.encodePacked(vm.getCode("PositionDescriptor.sol:PositionDescriptor"), args); assembly { - descriptor := create(0, add(initcode, 0x20), mload(initcode)) + descriptor := create2(0, add(initcode, 0x20), mload(initcode), salt) } } } diff --git a/test/shared/PosmTestSetup.sol b/test/shared/PosmTestSetup.sol index 4c934c9d..8798220e 100644 --- a/test/shared/PosmTestSetup.sol +++ b/test/shared/PosmTestSetup.sol @@ -68,7 +68,7 @@ contract PosmTestSetup is Test, Deployers, DeployPermit2, LiquidityOperations { // We use deployPermit2() to prevent having to use via-ir in this repository. permit2 = IAllowanceTransfer(deployPermit2()); positionDescriptor = - Deploy.positionDescriptor(address(poolManager), 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, "ETH"); + Deploy.positionDescriptor(address(poolManager), 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, "ETH", hex"00"); lpm = Deploy.positionManager( address(poolManager), address(permit2), 100_000, address(positionDescriptor), address(_WETH9), hex"03" );