Skip to content
Monpediaby Unity Nodes
Monad Docsguides › uniswap v4 hooks › setup

Set up the hook project

From docs.monad.xyz/guides/uniswap-v4-hooks/setupUpdated Sep 18, 2026read Oct 24, 2026

Contents5 sections

On this page, you will install the pinned source, run local tests, and prepare a Monad Testnet account.

Install the toolchain and pin the source

Install Foundry v1.8.0, Git, Python 3, Node.js with npm, and jq. Node and npm are required because the Universal Router dependency tree includes npm packages. Check the versions before creating the checkout:

forge --version
node --version
npm --version
python3 --version
jq --version

Clone the uniswap-v4-hooks-example repository into a folder named monad-hook. The final argument in the git clone command sets this local folder name. Then enter the folder and check out the tested revision before initializing its recursive dependencies:

git clone https://github.com/monad-developers/uniswap-v4-hooks-example.git monad-hook
cd monad-hook
git checkout c3cc78a88f10e5ba141cd6fb632f31db83c0daf8
git submodule update --init --recursive

The checkout includes the scripts and dependencies used below. Use this monad-hook folder throughout the guide.

Create the manifest directory and install the locked npm dependencies. npm ci --ignore-scripts keeps package installation from running third-party lifecycle scripts:

mkdir -p deployments
npm ci --ignore-scripts

Build and test locally

foundry.toml configures Solidity 0.8.26, the Cancun EVM, and the compiler settings for the example's dependencies.

Build the project and run its tests:

FOUNDRY_PROFILE=monad_testnet forge build
FOUNDRY_PROFILE=monad_testnet forge test -vv
python3 -m unittest discover -s tools -p 'test_*.py' -v

The tests cover hook permissions, liquidity positions, swaps, and parsing the position NFT’s mint receipt.

Prepare a testnet account

Import a testnet account into Foundry’s encrypted keystore:

cast wallet import monad-hooks-testnet --interactive
export DEPLOYER="$(cast wallet address --account monad-hooks-testnet)"

Fund the address using the Monad Testnet faucet. This account will deploy your contracts and own the liquidity position.

export MONAD_TESTNET_RPC_URL="https://testnet-rpc.monad.xyz"
export EXPECTED_CHAIN_ID=10143

cast chain-id --rpc-url "$MONAD_TESTNET_RPC_URL"
cast balance "$DEPLOYER" --rpc-url "$MONAD_TESTNET_RPC_URL"

The chain ID should be 10143.

Load the contract addresses

shared-infrastructure.json is included at the root of the monad-hook directory you just cloned. It lists the existing testnet contracts. Load those addresses into your shell:

export SHARED_INFRA="shared-infrastructure.json"
export POOL_MANAGER="$(jq -er .poolManager "$SHARED_INFRA")"
export POSITION_MANAGER="$(jq -er .positionManager "$SHARED_INFRA")"
export UNIVERSAL_ROUTER="$(jq -er .universalRouter "$SHARED_INFRA")"
export STATE_VIEW="$(jq -er .stateView "$SHARED_INFRA")"
export QUOTER="$(jq -er .quoter "$SHARED_INFRA")"
export POSITION_DESCRIPTOR="$(jq -er .positionDescriptor "$SHARED_INFRA")"
export PERMIT2="$(jq -er .permit2 "$SHARED_INFRA")"
export WMON="$(jq -er .wrappedNative "$SHARED_INFRA")"

printf 'PoolManager: %s\nPositionManager: %s\nUniversalRouter: %s\n' \
  "$POOL_MANAGER" "$POSITION_MANAGER" "$UNIVERSAL_ROUTER"

Next step

Continue to Deploy from this directory and shell.