Skip to main content

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:
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:
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:

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:
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:
Fund the address using the Monad Testnet faucet. This account will deploy your contracts and own the liquidity position.
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:

Next step

Continue to Deploy from this directory and shell.