-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add reverting tests, fix fuzz for hooks.t.sol (#548)
* add reverting tests, fix fuzz for hooks.t.sol * cleanup * fix comments * fix failing CI * fix other CI * typo in comment * make hooks 160s --------- Co-authored-by: Alice Henshaw <[email protected]> Co-authored-by: Alice <[email protected]>
- Loading branch information
1 parent
e3cea10
commit 6786fd4
Showing
4 changed files
with
236 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.24; | ||
|
||
import {IHooks} from "../interfaces/IHooks.sol"; | ||
import {PoolKey} from "../types/PoolKey.sol"; | ||
import {BalanceDelta} from "../types/BalanceDelta.sol"; | ||
import {IPoolManager} from "../interfaces/IPoolManager.sol"; | ||
import {BeforeSwapDelta} from "../types/BeforeSwapDelta.sol"; | ||
|
||
contract EmptyRevertHook is IHooks { | ||
function beforeInitialize( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
uint160, /* sqrtPriceX96 **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4) { | ||
revert(); | ||
} | ||
|
||
function afterInitialize( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
uint160, /* sqrtPriceX96 **/ | ||
int24, /* tick **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4) { | ||
revert(); | ||
} | ||
|
||
function beforeAddLiquidity( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
IPoolManager.ModifyLiquidityParams calldata, /* params **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4) { | ||
revert(); | ||
} | ||
|
||
function afterAddLiquidity( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
IPoolManager.ModifyLiquidityParams calldata, /* params **/ | ||
BalanceDelta, /* delta **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4, BalanceDelta) { | ||
revert(); | ||
} | ||
|
||
function beforeRemoveLiquidity( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
IPoolManager.ModifyLiquidityParams calldata, /* params **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4) { | ||
revert(); | ||
} | ||
|
||
function afterRemoveLiquidity( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
IPoolManager.ModifyLiquidityParams calldata, /* params **/ | ||
BalanceDelta, /* delta **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4, BalanceDelta) { | ||
revert(); | ||
} | ||
|
||
function beforeSwap( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
IPoolManager.SwapParams calldata, /* params **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4, BeforeSwapDelta, uint24) { | ||
revert(); | ||
} | ||
|
||
function afterSwap( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
IPoolManager.SwapParams calldata, /* params **/ | ||
BalanceDelta, /* delta **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4, int128) { | ||
revert(); | ||
} | ||
|
||
function beforeDonate( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
uint256, /* amount0 **/ | ||
uint256, /* amount1 **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4) { | ||
revert(); | ||
} | ||
|
||
function afterDonate( | ||
address, /* sender **/ | ||
PoolKey calldata, /* key **/ | ||
uint256, /* amount0 **/ | ||
uint256, /* amount1 **/ | ||
bytes calldata /* hookData **/ | ||
) external virtual returns (bytes4) { | ||
revert(); | ||
} | ||
} |
Oops, something went wrong.