Skip to main content

Prerequisites

Complete Deploy and confirm the hook and both mock-token deployments. Run from the same monad-hook directory. It contains shared-infrastructure.json; the deployment scripts created deployments/tokens.json and deployments/hook.json. If you opened a new shell, restore the account, network, and contract addresses:
The script uses deployments/position.json to identify your NFT after it is minted.

Initialize and exercise one pool

PoolLifecycle.s.sol runs each operation as a separate stage. The function below simulates each stage before broadcasting it and stops if a command fails:
During addLiquidity, PositionManager issues a position NFT to your account. record_position.py reads your NFT’s Transfer event from the mint receipt and saves its token ID. Run it immediately after addLiquidity, before the next broadcast overwrites run-latest.json. PositionManager is used by multiple accounts, so the token ID must come from your receipt. fundAndApprove mints mock tokens and approves Permit2 to transfer them. For each token, it grants PositionManager 4e18 units and Universal Router 1e16 units through Permit2, with a one-day expiry. The ERC-20 allowance to Permit2 covers their combined total. The script uses these pool settings: The four swap stages cover exact input and exact output in both directions. Universal Router executes the swaps using Permit2 for token transfers. Each swap uses a fresh quote with a one-percent slippage bound. This example routes swaps through the Counter pool you created. Universal Router executes the supplied route; it does not certify the hook’s safety. Applications that select among pools must evaluate their hooks as well as their quoted prices.

Check the results

ReadState.s.sol reports pool state, hook counters, position liquidity, token balances, and allowances. Run it after the lifecycle completes:
For a newly deployed hook, the completed sequence produces these results:

Verify the deployed hook and mock tokens

Follow the Foundry verification guide to publish your contract source on an explorer. For Counter, supply the PoolManager address as its constructor argument:
The compiler settings are configured in foundry.toml. For the mock tokens, DeployMockTokens.s.sol specifies the constructor arguments: ("Monad Hooks Test A", "MHTA", 18) and ("Monad Hooks Test B", "MHTB", 18).

Next step

Continue to Customize and publish to change the hook’s behavior and learn about mainnet infrastructure and registry submission.