Skip to content

HookMiner CREATE2 mining + PoolManager tick-init workaround for Unichain Sepolia#66

Open
Moses-main wants to merge 1 commit intomainfrom
codex/fix-deployment-issues-for-voltaic-hook
Open

HookMiner CREATE2 mining + PoolManager tick-init workaround for Unichain Sepolia#66
Moses-main wants to merge 1 commit intomainfrom
codex/fix-deployment-issues-for-voltaic-hook

Conversation

@Moses-main
Copy link
Owner

Motivation

  • Fix two deployment blockers on Unichain Sepolia: a mismatched hook callback flag mask on the deployed VoltaicHook and incorrect/assumed tick behavior when initializing pools with sqrtPriceX96 = 2^96.
  • Ensure deployed hook exposes the exact callback mask 0x14C0 and make pool initialization resilient to the observed PoolManager tick discrepancy without changing core hook logic.

Description

  • Add contracts/script/VoltaicScriptConfig.sol which centralizes Unichain Sepolia constants, exposes requiredHookFlags(), provides paritySqrtPriceX96() (uses TickMath.getSqrtPriceAtTick(0)), integrates HookMiner.find(...) via mineHookAddress(), validates hook flags with validateHookAddress(), and supplies tick-range helpers centeredLiquidityRange()/floorToSpacing().
  • Update contracts/script/DeployVoltaicHook.s.sol to call VoltaicScriptConfig.mineHookAddress(...), deploy the hook with the mined salt, validate the deployed address flags, and log the expected/actual addresses and flags; FindValidHook.s.sol now previews the mined address and salt instead of brute-force deploying trials.
  • Workaround PoolManager tick behavior: update DeployTestPool.s.sol, FreshPoolSwap.s.sol, and LocalTest.s.sol to initialize pools with TickMath.getSqrtPriceAtTick(0) via VoltaicScriptConfig.paritySqrtPriceX96() and then use the tick returned by poolManager.initialize as the canonical center when computing liquidity ranges (via centeredLiquidityRange). DeployTestPool.s.sol also reads VOLTAIC_HOOK_ADDRESS from the environment and validates its flags before use.
  • Project/Docs updates: fix Foundry remapping for @uniswap/v4-periphery, document the new HookMiner-based deployment workflow and the PoolManager tick workaround in README.md and contracts/README.md, and add guidance to init Uniswap v4 submodules before running scripts.
  • Preserved existing hook implementation and protocol-facing contracts; only deployment, scripting, and initialization logic and documentation were changed.

Testing

  • Ran git diff --check which reported no issues.
  • Attempted to run Foundry build/tests (forge build/forge test) but forge is not available in this environment so on-chain tests were not executed here.
  • Attempted to fetch submodules required for Uniswap v4 (lib/v4-core, lib/v4-periphery, lib/openzeppelin-contracts) but the container could not reach GitHub (HTTP 403), so the HookMiner runtime and end-to-end Sepolia scripts could not be executed here.
  • The updated scripts include FindValidHook.s.sol and DeployVoltaicHook.s.sol which, when run in a developer environment with Foundry and the submodules initialized, will mine and validate the CREATE2 hook address and confirm the required 0x14C0 mask; FreshPoolSwap.s.sol is provided for the optional end-to-end initialize/add-liquidity/swap verification on Sepolia.

Codex Task

@vercel
Copy link

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
voltaic Ready Ready Preview, Comment Mar 19, 2026 2:43pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant