Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1.15 KB

README.md

File metadata and controls

41 lines (27 loc) · 1.15 KB

v4-template

A template for writing Uniswap v4 Hooks 🦄

Use this Template

  1. The example hook Counter.sol demonstrates the beforeSwap() and afterSwap() hooks
  2. The test template Counter.t.sol preconfigures the v4 pool manager, test tokens, and test liquidity.

Local Development (Anvil)

Because v4 exceeds the bytecode limit of Ethereum and its business licensed, we can only deploy & test hooks on anvil.

# start anvil, with a larger code limit
anvil --code-size-limit 30000

# in a new terminal
forge script script/Counter.s.sol \
    --rpc-url http://localhost:8545 \
    --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
    --broadcast

Additional resources:

v4-periphery contains advanced hook implementations that serve as a great reference

v4-core


requires foundry

git clone https://github.com/saucepoint/v4-template
forge test