@@ -27,11 +27,7 @@ abstract contract BaseHook is IHooks, ImmutableState {
2727 /// @notice Returns a struct of permissions to signal which hook functions are to be implemented
2828 /// @dev Used at deployment to validate the address correctly represents the expected permissions
2929 /// @return Permissions struct
30- function getHookPermissions ()
31- public
32- pure
33- virtual
34- returns (Hooks.Permissions memory );
30+ function getHookPermissions () public pure virtual returns (Hooks.Permissions memory );
3531
3632 /// @notice Validates the deployed hook address agrees with the expected permissions of the hook
3733 /// @dev this function is virtual so that we can override it during testing,
@@ -42,38 +38,28 @@ abstract contract BaseHook is IHooks, ImmutableState {
4238 }
4339
4440 /// @inheritdoc IHooks
45- function beforeInitialize (
46- address sender ,
47- PoolKey calldata key ,
48- uint160 sqrtPriceX96
49- ) external onlyMultiHookAdapter returns ( bytes4 ) {
41+ function beforeInitialize (address sender , PoolKey calldata key , uint160 sqrtPriceX96 )
42+ external
43+ onlyMultiHookAdapter
44+ returns ( bytes4 )
45+ {
5046 return _beforeInitialize (sender, key, sqrtPriceX96);
5147 }
5248
53- function _beforeInitialize (
54- address ,
55- PoolKey calldata ,
56- uint160
57- ) internal virtual returns (bytes4 ) {
49+ function _beforeInitialize (address , PoolKey calldata , uint160 ) internal virtual returns (bytes4 ) {
5850 revert HookNotImplemented ();
5951 }
6052
6153 /// @inheritdoc IHooks
62- function afterInitialize (
63- address sender ,
64- PoolKey calldata key ,
65- uint160 sqrtPriceX96 ,
66- int24 tick
67- ) external onlyMultiHookAdapter returns (bytes4 ) {
54+ function afterInitialize (address sender , PoolKey calldata key , uint160 sqrtPriceX96 , int24 tick )
55+ external
56+ onlyMultiHookAdapter
57+ returns (bytes4 )
58+ {
6859 return _afterInitialize (sender, key, sqrtPriceX96, tick);
6960 }
7061
71- function _afterInitialize (
72- address ,
73- PoolKey calldata ,
74- uint160 ,
75- int24
76- ) internal virtual returns (bytes4 ) {
62+ function _afterInitialize (address , PoolKey calldata , uint160 , int24 ) internal virtual returns (bytes4 ) {
7763 revert HookNotImplemented ();
7864 }
7965
@@ -87,12 +73,11 @@ abstract contract BaseHook is IHooks, ImmutableState {
8773 return _beforeAddLiquidity (sender, key, params, hookData);
8874 }
8975
90- function _beforeAddLiquidity (
91- address ,
92- PoolKey calldata ,
93- ModifyLiquidityParams calldata ,
94- bytes calldata
95- ) internal virtual returns (bytes4 ) {
76+ function _beforeAddLiquidity (address , PoolKey calldata , ModifyLiquidityParams calldata , bytes calldata )
77+ internal
78+ virtual
79+ returns (bytes4 )
80+ {
9681 revert HookNotImplemented ();
9782 }
9883
@@ -106,12 +91,11 @@ abstract contract BaseHook is IHooks, ImmutableState {
10691 return _beforeRemoveLiquidity (sender, key, params, hookData);
10792 }
10893
109- function _beforeRemoveLiquidity (
110- address ,
111- PoolKey calldata ,
112- ModifyLiquidityParams calldata ,
113- bytes calldata
114- ) internal virtual returns (bytes4 ) {
94+ function _beforeRemoveLiquidity (address , PoolKey calldata , ModifyLiquidityParams calldata , bytes calldata )
95+ internal
96+ virtual
97+ returns (bytes4 )
98+ {
11599 revert HookNotImplemented ();
116100 }
117101
@@ -124,15 +108,7 @@ abstract contract BaseHook is IHooks, ImmutableState {
124108 BalanceDelta feesAccrued ,
125109 bytes calldata hookData
126110 ) external onlyMultiHookAdapter returns (bytes4 , BalanceDelta) {
127- return
128- _afterAddLiquidity (
129- sender,
130- key,
131- params,
132- delta,
133- feesAccrued,
134- hookData
135- );
111+ return _afterAddLiquidity (sender, key, params, delta, feesAccrued, hookData);
136112 }
137113
138114 function _afterAddLiquidity (
@@ -155,15 +131,7 @@ abstract contract BaseHook is IHooks, ImmutableState {
155131 BalanceDelta feesAccrued ,
156132 bytes calldata hookData
157133 ) external onlyMultiHookAdapter returns (bytes4 , BalanceDelta) {
158- return
159- _afterRemoveLiquidity (
160- sender,
161- key,
162- params,
163- delta,
164- feesAccrued,
165- hookData
166- );
134+ return _afterRemoveLiquidity (sender, key, params, delta, feesAccrued, hookData);
167135 }
168136
169137 function _afterRemoveLiquidity (
@@ -178,21 +146,19 @@ abstract contract BaseHook is IHooks, ImmutableState {
178146 }
179147
180148 /// @inheritdoc IHooks
181- function beforeSwap (
182- address sender ,
183- PoolKey calldata key ,
184- SwapParams calldata params ,
185- bytes calldata hookData
186- ) external onlyMultiHookAdapter returns (bytes4 , BeforeSwapDelta, uint24 ) {
149+ function beforeSwap (address sender , PoolKey calldata key , SwapParams calldata params , bytes calldata hookData )
150+ external
151+ onlyMultiHookAdapter
152+ returns (bytes4 , BeforeSwapDelta, uint24 )
153+ {
187154 return _beforeSwap (sender, key, params, hookData);
188155 }
189156
190- function _beforeSwap (
191- address ,
192- PoolKey calldata ,
193- SwapParams calldata ,
194- bytes calldata
195- ) internal virtual returns (bytes4 , BeforeSwapDelta, uint24 ) {
157+ function _beforeSwap (address , PoolKey calldata , SwapParams calldata , bytes calldata )
158+ internal
159+ virtual
160+ returns (bytes4 , BeforeSwapDelta, uint24 )
161+ {
196162 revert HookNotImplemented ();
197163 }
198164
@@ -207,13 +173,11 @@ abstract contract BaseHook is IHooks, ImmutableState {
207173 return _afterSwap (sender, key, params, delta, hookData);
208174 }
209175
210- function _afterSwap (
211- address ,
212- PoolKey calldata ,
213- SwapParams calldata ,
214- BalanceDelta,
215- bytes calldata
216- ) internal virtual returns (bytes4 , int128 ) {
176+ function _afterSwap (address , PoolKey calldata , SwapParams calldata , BalanceDelta, bytes calldata )
177+ internal
178+ virtual
179+ returns (bytes4 , int128 )
180+ {
217181 revert HookNotImplemented ();
218182 }
219183
@@ -228,13 +192,11 @@ abstract contract BaseHook is IHooks, ImmutableState {
228192 return _beforeDonate (sender, key, amount0, amount1, hookData);
229193 }
230194
231- function _beforeDonate (
232- address ,
233- PoolKey calldata ,
234- uint256 ,
235- uint256 ,
236- bytes calldata
237- ) internal virtual returns (bytes4 ) {
195+ function _beforeDonate (address , PoolKey calldata , uint256 , uint256 , bytes calldata )
196+ internal
197+ virtual
198+ returns (bytes4 )
199+ {
238200 revert HookNotImplemented ();
239201 }
240202
@@ -249,13 +211,11 @@ abstract contract BaseHook is IHooks, ImmutableState {
249211 return _afterDonate (sender, key, amount0, amount1, hookData);
250212 }
251213
252- function _afterDonate (
253- address ,
254- PoolKey calldata ,
255- uint256 ,
256- uint256 ,
257- bytes calldata
258- ) internal virtual returns (bytes4 ) {
214+ function _afterDonate (address , PoolKey calldata , uint256 , uint256 , bytes calldata )
215+ internal
216+ virtual
217+ returns (bytes4 )
218+ {
259219 revert HookNotImplemented ();
260220 }
261221}
0 commit comments