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

# dokrypt deploy

> Track, manage, and compare contract deployments across chains.

## Usage

```bash theme={null}
dokrypt deploy track <contract-name> <address> [flags]
dokrypt deploy list [flags]
dokrypt deploy export [flags]
dokrypt deploy multi [flags]
dokrypt deploy diff [flags]
```

## Subcommands

### `deploy track`

Record a contract deployment for tracking across environments.

```bash theme={null}
dokrypt deploy track MyToken 0x1234... --network arbitrum --tx-hash 0xabc...
dokrypt deploy track MyToken 0x1234... --network sepolia --tags "staging,v2"
```

| Flag         | Default       | Description                             |
| ------------ | ------------- | --------------------------------------- |
| `--network`  | `localhost`   | Deployment network                      |
| `--chain-id` |               | Chain ID                                |
| `--tx-hash`  |               | Deployment transaction hash             |
| `--deployer` |               | Deployer address                        |
| `--compiler` | `solc-0.8.20` | Compiler version                        |
| `--tags`     |               | Comma-separated tags (e.g., staging,v2) |

Deployments are saved to `deployments.json` in the project root.

### `deploy list`

List all tracked deployments with optional filters.

```bash theme={null}
dokrypt deploy list
dokrypt deploy list --network arbitrum
dokrypt deploy list --tag production
```

| Flag        | Default | Description       |
| ----------- | ------- | ----------------- |
| `--network` |         | Filter by network |
| `--tag`     |         | Filter by tag     |

### `deploy export`

Export the deployment manifest in different formats.

```bash theme={null}
dokrypt deploy export --format json
dokrypt deploy export --format env
dokrypt deploy export --format markdown
```

| Flag       | Default | Description                        |
| ---------- | ------- | ---------------------------------- |
| `--format` | `json`  | Output format: json, env, markdown |

**env format** outputs environment variables:

```
MYTOKEN_ARBITRUM_ADDRESS=0x1234...
MYTOKEN_SEPOLIA_ADDRESS=0x5678...
```

**markdown format** outputs a table:

```markdown theme={null}
| Contract | Network | Address |
|----------|---------|---------|
| MyToken | arbitrum | `0x1234...` |
```

### `deploy multi`

Prepare deployment to multiple networks in sequence.

```bash theme={null}
dokrypt deploy multi --networks "arbitrum,optimism,base" --script scripts/deploy.js
dokrypt deploy multi --networks "sepolia,arb-sepolia" --script scripts/deploy.js --dry-run
```

| Flag         | Default | Description                          |
| ------------ | ------- | ------------------------------------ |
| `--networks` |         | Comma-separated networks (required)  |
| `--script`   |         | Path to deployment script (required) |
| `--dry-run`  | `false` | Preview deployment without executing |

### `deploy diff`

Compare contract deployments across two networks.

```bash theme={null}
dokrypt deploy diff --net1 arbitrum --net2 sepolia
```

| Flag     | Default | Description               |
| -------- | ------- | ------------------------- |
| `--net1` |         | First network to compare  |
| `--net2` |         | Second network to compare |

Shows which contracts exist on each network and highlights differences.

## Examples

Track a deployment after deploying to Arbitrum:

```bash theme={null}
forge script scripts/Deploy.s.sol --rpc-url $ARBITRUM_RPC --broadcast

dokrypt deploy track MyToken 0x1234... --network arbitrum --tx-hash 0xabc...
dokrypt deploy track StakingRewards 0x5678... --network arbitrum --tx-hash 0xdef...
```

Compare staging vs production:

```bash theme={null}
dokrypt deploy diff --net1 arb-sepolia --net2 arbitrum
```

Export addresses for frontend:

```bash theme={null}
dokrypt deploy export --format env > .env.contracts
```

Multi-chain dry run:

```bash theme={null}
dokrypt deploy multi --networks "arbitrum,optimism,base" --script scripts/deploy.js --dry-run
```
