You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EulerSwap pools act as hooks for Uniswap v4. Uniswap v4 requires hook addresses to have specific permission bits encoded in their address. This presents a challenge because EulerSwap uses MetaProxy deployment, which means the actual pool address must have the correct permission bits.
34
+
35
+
## Solution: HookMiner
36
+
37
+
The solution is to use the `HookMiner` utility from the EulerSwap test suite to find a salt that produces a valid hook address.
38
+
39
+
## How It Works
40
+
41
+
1.**Define Pool Parameters**: Set up your pool configuration (vaults, reserves, fees, etc.)
42
+
43
+
2.**Calculate Required Flags**: EulerSwap pools need these permission flags:
44
+
-`BEFORE_INITIALIZE_FLAG`
45
+
-`BEFORE_SWAP_FLAG`
46
+
-`BEFORE_SWAP_RETURNS_DELTA_FLAG`
47
+
-`BEFORE_DONATE_FLAG`
48
+
-`BEFORE_ADD_LIQUIDITY_FLAG`
49
+
50
+
3.**Mine Salt**: Use HookMiner to find a salt that produces an address with the correct permission bits:
1.**Salt is Pool-Specific**: The salt depends on the exact pool parameters. If you change any parameter (vaults, reserves, fees, etc.), you need to mine a new salt.
93
+
94
+
2.**Deterministic Addresses**: On fresh anvil with deterministic addresses, the same pool parameters will always require the same salt.
95
+
96
+
3.**HookMiner Limits**: HookMiner tries up to 160,444 iterations to find a valid salt. If it fails, you may need to adjust your pool parameters slightly.
97
+
98
+
4.**Performance**: Salt mining typically takes a few seconds to find a valid salt among ~80k attempts.
99
+
100
+
## Troubleshooting
101
+
102
+
-**"HookAddressNotValid" Error**: The pool address doesn't have the correct permission bits. Use HookMiner to find a valid salt.
103
+
104
+
-**"Could not find salt" Error**: HookMiner couldn't find a valid salt within its iteration limit. Try adjusting pool parameters slightly (e.g., change fee by 1 wei).
105
+
106
+
-**Deployment Succeeds but Pool Not Found**: Check that you're using the correct euler account and that the operator was set properly.
107
+
108
+
## Production Recommendations
109
+
110
+
For production use:
111
+
1. Use the EulerSwap UI which handles salt mining automatically
112
+
2. Use the EulerSwap SDK which includes salt mining utilities
0 commit comments