Skip to content

Commit 40db263

Browse files
committed
revert on CLAMM liquidity; updated flags
1 parent ba4b294 commit 40db263

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/UniswapHook.sol

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ contract UniswapHook is BaseHook {
2727

2828
PoolKey internal _poolKey;
2929

30+
error NativeConcentratedLiquidityUnsupported();
31+
3032
constructor(address evc_, address _poolManager) BaseHook(IPoolManager(_poolManager)) {
3133
evc = evc_;
3234
}
@@ -116,11 +118,20 @@ contract UniswapHook is BaseHook {
116118
return (BaseHook.beforeSwap.selector, returnDelta, 0);
117119
}
118120

121+
function _beforeAddLiquidity(address, PoolKey calldata, IPoolManager.ModifyLiquidityParams calldata, bytes calldata)
122+
internal
123+
pure
124+
override
125+
returns (bytes4)
126+
{
127+
revert NativeConcentratedLiquidityUnsupported();
128+
}
129+
119130
function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
120131
return Hooks.Permissions({
121132
beforeInitialize: false,
122133
afterInitialize: false,
123-
beforeAddLiquidity: false,
134+
beforeAddLiquidity: true,
124135
afterAddLiquidity: false,
125136
beforeRemoveLiquidity: false,
126137
afterRemoveLiquidity: false,

test/EulerSwapTestBase.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ contract EulerSwapTestBase is EVaultTestBase {
4141
// use the canonical miner to find a valid 'implementation' address
4242
(, bytes32 salt) = v4HookMiner.find(
4343
address(this),
44-
uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG),
44+
uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG | Hooks.BEFORE_ADD_LIQUIDITY_FLAG),
4545
type(EulerSwap).creationCode,
4646
abi.encode(address(evc), poolManager_)
4747
);
@@ -178,7 +178,7 @@ contract EulerSwapTestBase is EVaultTestBase {
178178
(address predictedAddr, bytes32 salt) = HookMiner.find(
179179
address(eulerSwapFactory),
180180
holder,
181-
uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG),
181+
uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG | Hooks.BEFORE_ADD_LIQUIDITY_FLAG),
182182
creationCode
183183
);
184184

test/FactoryTest.t.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ contract FactoryTest is EulerSwapTestBase {
3333
}
3434

3535
function mineSalt(IEulerSwap.Params memory poolParams) internal view returns (address hookAddress, bytes32 salt) {
36-
uint160 flags = uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG);
36+
uint160 flags =
37+
uint160(Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG | Hooks.BEFORE_ADD_LIQUIDITY_FLAG);
3738
bytes memory creationCode = MetaProxyDeployer.creationCodeMetaProxy(eulerSwapImpl, abi.encode(poolParams));
3839
(hookAddress, salt) = HookMiner.find(address(eulerSwapFactory), holder, flags, creationCode);
3940
}

0 commit comments

Comments
 (0)