File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,22 @@ contract UniswapHook is BaseHook {
116
116
return (BaseHook.beforeSwap.selector , returnDelta, 0 );
117
117
}
118
118
119
- // TODO: fix salt mining & verification for the hook
120
- function getHookPermissions () public pure override returns (Hooks.Permissions memory ) {}
121
- function validateHookAddress (BaseHook) internal pure override {}
119
+ function getHookPermissions () public pure override returns (Hooks.Permissions memory ) {
120
+ return Hooks.Permissions ({
121
+ beforeInitialize: false ,
122
+ afterInitialize: false ,
123
+ beforeAddLiquidity: false ,
124
+ afterAddLiquidity: false ,
125
+ beforeRemoveLiquidity: false ,
126
+ afterRemoveLiquidity: false ,
127
+ beforeSwap: true ,
128
+ afterSwap: false ,
129
+ beforeDonate: false ,
130
+ afterDonate: false ,
131
+ beforeSwapReturnDelta: true ,
132
+ afterSwapReturnDelta: false ,
133
+ afterAddLiquidityReturnDelta: false ,
134
+ afterRemoveLiquidityReturnDelta: false
135
+ });
136
+ }
122
137
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import {EulerSwapFactory} from "../src/EulerSwapFactory.sol";
9
9
import {EulerSwapPeriphery} from "../src/EulerSwapPeriphery.sol " ;
10
10
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol " ;
11
11
import {HookMiner} from "./utils/HookMiner.sol " ;
12
+ import {HookMiner as v4HookMiner} from "v4-periphery/src/utils/HookMiner.sol " ;
12
13
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol " ;
13
14
import {MetaProxyDeployer} from "../src/MetaProxyDeployer.sol " ;
14
15
@@ -37,7 +38,15 @@ contract EulerSwapTestBase is EVaultTestBase {
37
38
}
38
39
39
40
function deployEulerSwap (address poolManager_ ) public {
40
- eulerSwapImpl = address (new EulerSwap (address (evc), poolManager_));
41
+ // use the canonical miner to find a valid 'implementation' address
42
+ (, bytes32 salt ) = v4HookMiner.find (
43
+ address (this ),
44
+ uint160 (Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG),
45
+ type (EulerSwap).creationCode,
46
+ abi.encode (address (evc), poolManager_)
47
+ );
48
+
49
+ eulerSwapImpl = address (new EulerSwap {salt: salt}(address (evc), poolManager_));
41
50
eulerSwapFactory = new EulerSwapFactory (address (evc), address (factory), eulerSwapImpl);
42
51
periphery = new EulerSwapPeriphery ();
43
52
}
You can’t perform that action at this time.
0 commit comments