EquiGuard – Uniswap v4 Hedge Hook Hookathon 2025 submission · version v1.0.0 (Compat‑Only). Future milestones are planned up to v5.0.0 (full feature set).
EquiGuard adds an on‑chain hedge and automated range management to any Uniswap v4 pool. Each deposit is split into an active liquidity range and a passive reserve that counter‑trades swaps and pays for range rotations. The aim is to give v2‑style “set and forget” liquidity with v3‑level fee density and materially lower impermanent loss.
This repository currently holds Version 1 – Compatibility Only along with the scaffolding for later upgrades.
Quick Start
forge --version
forge install
forge build forge test
forge script script/MineHookAddress.s.sol --fork-url $UNI_RPC_URL
export DEPLOYER_PK=0x... export POOL_MANAGER=0x... export SPLIT_BPS=500 # 5 % skim for v2 export SALT=$(openssl rand -hex 32)
forge script script/DeployEquiGuardHookV2.s.sol
--rpc-url https://mainnet.unichain.org --broadcast -vvvv
This project is deployed straight to mainnet in line with competition rules. Use --simulate before broadcasting any live transaction.
Repository Layout Path Purpose src/EquiGuardHookV2.sol Core hook for the reserve‑split milestone script/MineHookAddress.s.sol Finds a create2 salt so the deployed address advertises the correct hook‑flag map script/DeployEquiGuardHookV2.s.sol Deployment script that uses the mined salt foundry.toml Remappings and Solidity version pin Version Tags v1.x – Compatibility only
v2.x – Reserve split
v3.x – Hedge logic
v4.x – Auto‑rotate range
v5.x – Full feature set
Milestone Roadmap Version Live Core feature Hook flags v1 Yes Advertises six callbacks; no logic BEFORE/AFTER_ADD, BEFORE/AFTER_REMOVE, BEFORE/AFTER_SWAP v2 WIP Skim splitBps (default 5 %) of every add‑liquidity deposit + AFTER_ADD_LIQUIDITY_RETURNS_DELTA v3 Planned Counter‑trade swaps to maintain 50/50 exposure – v4 Planned Rotate range when price exits band – v5 Planned Oracle penalty, keeper rewards, emergency switches – Configuration Environment variables recognised by the deployment script:
Variable Description DEPLOYER_PK Private key for broadcasting transactions (hex, no 0x prefix) POOL_MANAGER Address of the Uniswap v4 PoolManager on Unichain SPLIT_BPS Basis‑points skim on add‑liquidity (0–10 000) SALT 32‑byte salt obtained from MineHookAddress Example .env:
DEPLOYER_PK=0xabcdef... POOL_MANAGER=0x4200000000000000000000000000000000000006 SPLIT_BPS=500 SALT=0x12c4... Testing Layer Tool Status Unit forge test Stubs pass for v1 Invariant forge test -m invariant To be added in v3 Integration Anvil fork Planned for v3 Target gas for the hedge path is ≤ 40 k on Base (measured once v3 is available).
Security Static analysis with Slither (make slither) on CI.
Invariant tests planned for v3.
External audit scheduled after v4, before a liquidity‑mining launch.
Contributing Pull requests are welcome. Please open an issue first to discuss major changes. Run forge fmt before committing and ensure forge build && forge test pass.
References Uniswap v4 Core: https://github.com/Uniswap/v4-core
Uniswap v4 Periphery: https://github.com/Uniswap/v4-periphery
EIP‑6909: Multi‑token standard used for reserve shares
EquiGuard PRD/TDD: see the /docs.