> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monad.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up the hook project

> 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](https://book.getfoundry.sh/getting-started/installation), 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:

```sh theme={null}
forge --version
node --version
npm --version
python3 --version
jq --version
```

Clone the [`uniswap-v4-hooks-example` repository](https://github.com/monad-developers/uniswap-v4-hooks-example) 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:

```sh theme={null}
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:

```sh theme={null}
mkdir -p deployments
npm ci --ignore-scripts
```

## Build and test locally

[`foundry.toml`](https://github.com/monad-developers/uniswap-v4-hooks-example/blob/c3cc78a88f10e5ba141cd6fb632f31db83c0daf8/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:

```sh theme={null}
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:

```sh theme={null}
cast wallet import monad-hooks-testnet --interactive
export DEPLOYER="$(cast wallet address --account monad-hooks-testnet)"
```

Fund the address using the [Monad Testnet faucet](/developer-essentials/testnet). This account will deploy your contracts and own the liquidity position.

```sh theme={null}
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`](https://github.com/monad-developers/uniswap-v4-hooks-example/blob/c3cc78a88f10e5ba141cd6fb632f31db83c0daf8/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:

```sh theme={null}
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](/guides/uniswap-v4-hooks/deploy) from this directory and shell.
