> ## Documentation Index
> Fetch the complete documentation index at: https://pulse-hook.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy Hook

> Deploy the Pulse Hook to any network

**-Deploying the Pulse Hook is fully automated by the deployment script. You do not need to manually calculate hook addresses or find CREATE2 salts.**

## 1. Clone the repository

Clone the [Pulse Hook repository](https://github.com/no-hive/pulse_hook) and move into the project directory:

```bash theme={null}
git clone https://github.com/no-hive/pulse_hook.git
cd pulse_hook
```

The repository is structured as a monorepo and contains the hook implementation, tests, documentation, and development instructions for AI coding agents.

## 2. Install dependencies

Install the project dependencies using Forge:

```bash theme={null}
forge install
```

## 3. Build and test

Before deploying, make sure the project compiles and all tests pass:

```bash theme={null}
forge build
forge test
```

If both commands complete successfully, you're ready to deploy.

## 4. Configure your environment

Copy the example environment file:

```bash theme={null}
cp .env.example .env
```

Set the following values:

* `RPC_URL` - RPC endpoint for the network you want to deploy to.
* `PRIVATE_KEY` - private key of the deploying wallet.
* `WALLET_ADDRESS` - address corresponding to `PRIVATE_KEY`.

> **Security:** Never commit `.env` or expose your private key. For deployments, use a dedicated wallet with only the funds required for gas.

Before broadcasting the deployment, verify that your RPC points to the intended network:

```bash theme={null}
cast chain-id --rpc-url $RPC_URL
```

Also make sure that `WALLET_ADDRESS` corresponds to `PRIVATE_KEY`.

## 5. HelperConfig

The deployment script uses `HelperConfig` to automatically load the correct configuration for the network you are deploying to.

`HelperConfig` reads `block.chainid` at deployment time and selects the corresponding configuration. You do not need to manually specify the chain ID in the deployment command.

<Frame>
  **Important: deploying to a new network**

  This guide is specifically designed for deploying the Pulse Hook to a network where it has **not been deployed yet**.

  If you are deploying to a new network, add a new network configuration to `HelperConfig` before deploying. This keeps the deployment configuration inside the repository, making the deployment process easier to understand, fully controlled, and automatic.

  You only need to provide the network-specific configuration, such as the Uniswap v4 Pool Manager address and the trusted tokens for that network.

  Once the configuration is added, the deployment script automatically selects it based on the detected chain ID.

  **Do not deploy to an unsupported network without adding its configuration first.**
</Frame>

### Currently configured networks

| Network          |   Chain ID | Configuration                 |
| ---------------- | ---------: | ----------------------------- |
| Ethereum Mainnet |        `1` | Pool Manager + trusted tokens |
| Unichain         |      `130` | Pool Manager + trusted tokens |
| Ethereum Sepolia | `11155111` | Pool Manager + trusted tokens |
| Base Mainnet     |     `8453` | Pool Manager + trusted tokens |
| Base Sepolia     |    `84532` | Pool Manager + trusted tokens |
| Robinhood        |     `4663` | Pool Manager + trusted tokens |
| Arbitrum One     |    `42161` | Pool Manager + trusted tokens |

### How `HelperConfig` works

The deployment script calls:

```solidity theme={null}
HelperConfig.getDeploymentConfig()
```

The function checks `block.chainid` and selects the appropriate network configuration:

```solidity theme={null}
if (block.chainid == SEPOLIA_CHAIN_ID) {
    return getSepoliaEthConfig();
} else if (block.chainid == ETHEREUM_MAINNET_CHAIN_ID) {
    return getEthereumMainnetConfig();
} else if (block.chainid == UNICHAIN_MAINNET_CHAIN_ID) {
    return getUnichainConfig();
}
// ...
```

Each network configuration provides:

* the network's **Uniswap v4 Pool Manager address**;
* a list of **trusted tokens** used by the hook.

For example, the Ethereum Mainnet configuration provides the Uniswap v4 Pool Manager address:

```solidity theme={null}
poolManager: 0x000000000004444c5dc75cB358380D2e3dE08A90
```

and a list of trusted tokens including ETH, WETH, WBTC, UNI, USDC, and USDT.

This means the same deployment command can be used across all configured networks. The network is determined from the RPC endpoint you provide.

> **Important:** `HelperConfig` does not deploy the Pool Manager or tokens. It only selects the network-specific addresses and configuration that the hook should use.

### Adding a new network

To deploy to a network that is not currently supported, add a new configuration function to `HelperConfig` and connect it to the corresponding chain ID.

For example:

```solidity theme={null}
function getMyNetworkConfig()
    internal
    pure
    returns (NetworkConfig memory)
{
    address[] memory soundTokens = new address[](3);

    soundTokens[0] = address(0);
    soundTokens[1] = WETH_ADDRESS;
    soundTokens[2] = USDC_ADDRESS;

    return NetworkConfig({
        poolManager: POOL_MANAGER_ADDRESS,
        soundTokens: soundTokens
    });
}
```

Then add the network to `getDeploymentConfig()`:

```solidity theme={null}
else if (block.chainid == MY_NETWORK_CHAIN_ID) {
    return getMyNetworkConfig();
}
```

After that, the deployment script will automatically use the new configuration whenever the corresponding chain ID is detected.

> **Important:** For a new network, make sure you use the correct Uniswap v4 Pool Manager address and the correct token addresses for that network.

If `block.chainid` does not match a configured network, the deployment should **revert with an unsupported-network error** rather than silently using a different network configuration.

## 6. Deploy the hook

Once your environment is configured, run:

```bash theme={null}
forge script script/00_DeployHook.s.sol:DeployHookScript \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --sender $WALLET_ADDRESS \
  --broadcast
```

You do not need to provide a chain ID or manually configure the Pool Manager.

The deployment script:

1. detects the network through `block.chainid`;
2. loads the corresponding `HelperConfig`;
3. performs the required hook address mining;
4. deploys the hook to the mined address;
5. broadcasts the deployment.

> **Important:** Make sure `RPC_URL` points to the network where you intend to deploy before using `--broadcast`.

## 7. Verify the deployment

After deployment, find the deployed hook address in the Forge output.

First, verify that contract code exists at the address:

```bash theme={null}
cast code "$DEPLOYED_HOOK_ADDRESS" \
  --rpc-url "$RPC_URL"
```

Then verify the hook permissions:

```bash theme={null}
cast call \
  "$DEPLOYED_HOOK_ADDRESS" \
  "getHookPermissions()(bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool,bool)" \
  --rpc-url "$RPC_URL"
```

The returned permissions should match the permissions implemented by the Pulse Hook.

> **Note:** The hook address is the address of your deployed hook contract. It is **not** the Uniswap v4 Pool Manager address.

## 8. Use the hook in a pool

Once the hook is deployed, you can use its address when creating a Uniswap v4 pool.

For pool creation, check  [Init Pool](/guides/overview-3) guidance.

## The conclusion

That's it. The Pulse Hook repository handles network configuration, hook address mining, and deployment automatically. Once the hook is deployed, use its address and **Dynamic Fee** when following the official Uniswap v4 pool creation guide.
