diff --git a/.forge-snapshots/initialize.snap b/.forge-snapshots/initialize.snap index bf8722821..497506973 100644 --- a/.forge-snapshots/initialize.snap +++ b/.forge-snapshots/initialize.snap @@ -1 +1 @@ -51533 \ No newline at end of file +51532 \ No newline at end of file diff --git a/.forge-snapshots/poolManager bytecode size.snap b/.forge-snapshots/poolManager bytecode size.snap index 014db780a..84de03df6 100644 --- a/.forge-snapshots/poolManager bytecode size.snap +++ b/.forge-snapshots/poolManager bytecode size.snap @@ -1 +1 @@ -23659 \ No newline at end of file +23694 \ No newline at end of file diff --git a/src/PoolManager.sol b/src/PoolManager.sol index badac55e8..8733bc276 100644 --- a/src/PoolManager.sol +++ b/src/PoolManager.sol @@ -131,11 +131,12 @@ contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claim tick = _pools[id].initialize(sqrtPriceX96, lpFee); - key.hooks.afterInitialize(key, sqrtPriceX96, tick); - + // event is emitted before the afterInitialize call to ensure events are always emitted in order // emit all details of a pool key. poolkeys are not saved in storage and must always be provided by the caller // the key's fee may be a static fee or a sentinel to denote a dynamic fee. emit Initialize(id, key.currency0, key.currency1, key.fee, key.tickSpacing, key.hooks, sqrtPriceX96, tick); + + key.hooks.afterInitialize(key, sqrtPriceX96, tick); } /// @inheritdoc IPoolManager