Skip to content

Deployment & explorer verification

Deploy BugCrawl's contracts, write the manifest, verify each contract on the explorer.

1. Configure

Copy .env.example to .env at the repository root. For a testnet deploy you need DEPLOYER_PRIVATE_KEY (a throwaway key funded from the testnet faucet). Never commit .env.

2. Test and deploy

npm run contracts:test
DEPLOY_PROFILE=core npm run deploy:testnet -w @bugcrawl/contracts
# mainnet additionally requires CONFIRM_MAINNET=yes

The core profile deploys 23 modules. full adds the optional ecosystem registries. The script grants module roles, seeds networks and providers, registers each module in the directory, records the manifest hash in DeploymentRegistry and writes contracts/deployments/<chainId>.json. Every address and transaction hash in that file comes from a receipt.

3. Verify every contract on the explorer

npm run preflight:testnet -w @bugcrawl/contracts   # offline rehearsal, expect 27/27
npm run verify:testnet -w @bugcrawl/contracts

The preflight rebuilds each submission and recompiles it locally, checking it reproduces the deployment transaction byte for byte, which is the same comparison the explorer makes. Only submit once it reports every contract as matching.

For each contract the script reads Hardhat's build-info, keeps only the files in its import closure, submits standard-JSON input with the recorded constructor arguments, polls until the job finishes and writes the result back to the manifest.

4. Publish to the web app

npm run sync      # copies manifests, catalogue and ABIs into apps/web/src/generated
npm run build

5. Hand admin to a timelock

TIMELOCK_PROPOSERS=0xYourSafe TIMELOCK_EXECUTORS=0xYourSafe \
  npx hardhat run scripts/handover.ts --network robinhoodTestnet

Checklist

  • Tests pass on the commit you deploy.
  • Compiler version and optimizer settings in the manifest match hardhat.config.ts.
  • Each manifest entry shows verification.status: "verified", and its explorer page shows the source.
  • The manifest hash in the file equals the latest release in DeploymentRegistry.
  • Operator roles point at the intended accounts; the deployer has renounced what it no longer needs.
  • Admin transfer to the timelock has been started and accepted.