datahaven/test/cli/handlers/contracts
Steve Degosserie eaeb06dbbb
feat(contracts): deploy stagenet-hoodi AVS contracts, fix verification and update-metadata CLI (#439)
## Summary
- Add stagenet-hoodi deployment artifacts (contract addresses, rewards
info) and update Snowbridge config with latest validator set
- Fix the `bun cli contracts verify` command to correctly verify all
deployed contracts, including proxy contracts and Snowbridge
dependencies
- Fix the `bun cli contracts update-metadata` command to use the correct
config file when `--environment` is specified

## Contract verification fixes
The verification CLI hardcoded all contract source paths as
`src/<Name>.sol`, which failed for:
- **Snowbridge contracts** (Gateway, BeefyClient, AgentExecutor) — these
live in `lib/snowbridge/contracts/src/`
- **Gateway proxy** — the `Gateway` deployment address is actually a
`GatewayProxy`, not the Gateway implementation. The implementation
address needs to be resolved from the ERC1967 storage slot
- **ServiceManager proxy** — was not being verified at all

Changes:
- Added `contractPath` field to `ContractToVerify` so each contract
specifies its source location relative to the contracts directory
- Added `guessConstructorArgs` option for proxy contracts with complex
encoded init data (uses forge's `--guess-constructor-args`)
- Gateway is now verified as two separate contracts: Gateway
Implementation (address resolved from ERC1967 proxy slot) and
GatewayProxy
- ServiceManager proxy is now verified as `TransparentUpgradeableProxy`

## Update-metadata fix
The `update-metadata` command was ignoring the `--environment` flag when
selecting the deployments file:
1. The handler received a pre-built networkId (`"stagenet-hoodi"`) as
the chain parameter, which `getChainDeploymentParams` couldn't resolve
(falling back to anvil). Now chain and environment are passed
separately.
2. Commander.js routed `--environment` to the parent contracts command,
leaving `options.environment` undefined on the subcommand. Added the
same parent-fallback logic already used for `--chain`.

## Test plan
- [x] `bun typecheck` passes
- [x] Ran `bun cli contracts verify --chain hoodi --environment
stagenet` — all contracts verified successfully on Etherscan
- [x] `bun cli contracts update-metadata --chain hoodi --environment
stagenet` now reads the correct `stagenet-hoodi.json` deployments file

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:22:37 +01:00
..
.env.example Fix: command cli deploy contracts (#319) 2025-11-27 15:06:04 +01:00
beefy-checkpoint.ts feat: Add DH-AVS stagenet/testnet Hoodi deployment support (#422) 2026-02-02 16:41:15 +01:00
deploy.ts feat: Add DH-AVS stagenet/testnet Hoodi deployment support (#422) 2026-02-02 16:41:15 +01:00
index.ts feat: Add DH-AVS stagenet/testnet Hoodi deployment support (#422) 2026-02-02 16:41:15 +01:00
README.md misc: remove slasher middleware solidity contracts (#366) 2025-12-29 14:55:21 +01:00
rewards-origin.ts feat: Add DH-AVS stagenet/testnet Hoodi deployment support (#422) 2026-02-02 16:41:15 +01:00
status.ts refactor: clean old veto committee (#434) 2026-02-09 14:28:34 +01:00
update-metadata.ts feat(contracts): deploy stagenet-hoodi AVS contracts, fix verification and update-metadata CLI (#439) 2026-02-12 09:22:37 +01:00
verify.ts feat(contracts): deploy stagenet-hoodi AVS contracts, fix verification and update-metadata CLI (#439) 2026-02-12 09:22:37 +01:00

DataHaven Contracts Deployment

Deploy DataHaven AVS contracts to supported chains (Hoodi, Mainnet).

What Gets Deployed

  • DataHaven: ServiceManager, RewardsRegistry
  • Snowbridge: BeefyClient, AgentExecutor, Gateway, RewardsAgent
  • EigenLayer: References existing contracts (not deployed)

Prerequisites

  1. Account Setup: Create or import an account in Metamask (you'll need the private key)
  2. Funding: Get native tokens for deployment fees:
  3. API Key (optional): Generate API token from block explorer for contract verification:

Setup

cd test && cp cli/handlers/contracts/.env.example .env

Edit .env with your values:

# Required: Private key with deployment funds
DEPLOYER_PRIVATE_KEY=0x...

# Required: AVS owner private key (can be same as DEPLOYER_PRIVATE_KEY)
AVS_OWNER_PRIVATE_KEY=0x...

# Optional: For contract verification
ETHERSCAN_API_KEY=your_api_key_here

Deployment Commands

Deploy to Hoodi

bun cli contracts deploy --chain hoodi

Deploy to Mainnet

bun cli contracts deploy --chain mainnet

Custom RPC URL

bun cli contracts deploy --chain hoodi --rpc-url https://your-rpc-url.com

Check Deployment Status

bun cli contracts status --chain hoodi

Deployment Files

Successful deployments create:

  • ../contracts/deployments/{chain}.json - Contract addresses
  • ../contracts/deployments/{chain}-rewards-info.json - Rewards configuration