# Security & Deployment Gates

## Test Gate

All contract tests must pass before any deployment:

```bash
npm --workspace contracts run test    # 226 Solidity tests
npm run verify:chain-integrity        # On-chain state verification
```

## Preflight

Before deploying to either network:

```bash
npm run chain:preflight:base-sepolia   # Testnet
npm run chain:preflight:base-mainnet   # Production
```

Preflight validates:

* RPC chain ID is correct
* Operator private key is validly shaped
* Operator has sufficient ETH for deployment gas
* Never prints private keys or RPC URLs

## Reconciliation

Read-only scripts verify deployed contract state:

```bash
npm run chain:reconcile:base-sepolia
npm run chain:reconcile:base-mainnet
```

Validates:

* `chain_contracts` rows exist for deployed contracts
* Bytecode exists at recorded addresses
* Contract names, roles, and configuration are correct
* Reports whether any minted assets exist on-chain

## Deployment Status

Both networks are deployed. See:

* [Base Mainnet Deployment](/numex-docs/blockchain-deployments/base-mainnet-deployment.md)
* [Base Sepolia Deployment](/numex-docs/blockchain-deployments/base-sepolia-smoke-deployment.md)

### Deployment checklist (completed):

1. Contract security hardening (ReentrancyGuard, state machine, admin protection)
2. Independent security audit — all Critical/High findings fixed
3. 226 Solidity tests pass including fuzz tests
4. Preflight passes on both networks
5. Contracts deployed and verified on Base Sepolia and Base mainnet
6. Settlement contract granted OPERATOR\_ROLE on registry

### Remaining operational items:

* [ ] Transfer DEFAULT\_ADMIN\_ROLE to multisig
* [ ] Role separation (separate minter/operator keys)
* [ ] Chain reconciliation worker
* [ ] Event indexing service

## Architecture

```mermaid
flowchart TD
  A["Contract tests (226)"] --> G["Deploy"]
  B["Independent audit"] --> G
  C["Preflight checks"] --> G
  D["Role configuration"] --> G
  G --> H["Base Sepolia (testnet)"]
  G --> I["Base Mainnet (production)"]
  H --> J["Reconciliation"]
  I --> J
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://numex-greenfield.gitbook.io/numex-docs/blockchain-deployments/security-and-deployment-gates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
