Skip to Content
CLIPush Contracts

Push Contracts

Push your Hardhat or Foundry project’s ABIs to your Stagenet in one command. Deployed contracts are matched by bytecode and get their ABI attached automatically, fully activating their contract dashboards — decoded calls, events, and storage — with no manual ABI adding per contract.

Re-run after each rebuild to keep ABIs in sync — unchanged contracts are no-ops.

Usage

Run it from your project root after compiling:

# Foundry forge build # Hardhat npx hardhat compile # Then contract.dev push-contracts
Detected Hardhat project 2 contracts pushed: - Token - Vault ABI added to 2 contracts on your Stagenet: - Token @ 0x5FbDB2315678afecb367f032d93F642f64180aa3 - Vault @ 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
FlagDescription
--contracts <dir>Override the detected source directory.
--artifacts <dir>Override the detected compiled-artifacts directory.

import-contracts is accepted as an alias for the old name.

How it works

The CLI scans your compiled build artifacts:

  • Foundry: out/
  • Hardhat: artifacts/contracts/

For each deployable contract, it uploads the ABI, bytecode, and metadata to your Stagenet. Contracts already deployed on the Stagenet are matched by bytecode and get the pushed name and ABI attached immediately — including a backfill of their past calls, now decoded. Contracts you deploy later are matched the same way at deploy time. Names and ABIs you’ve already set on an address by hand are never overwritten.

The CLI does not build your project — compile first.

Source and artifact directories

The CLI pushes only contracts from your project’s source directory, so dependencies (OpenZeppelin, node_modules libraries) aren’t treated as part of your project:

  • Foundry: reads [profile.default].src and out from foundry.toml (defaults src/, out/).
  • Hardhat: reads paths.sources and paths.artifacts from hardhat.config.{ts,js,cjs,mjs} (defaults contracts/, artifacts/contracts/).

The Hardhat config is not executed — paths are read as string literals. If your config computes paths dynamically (env vars, path.join, imported constants, template literals), the CLI falls back to the defaults and tells you; pass the resolved paths explicitly:

contract.dev push-contracts --contracts src/protocol --artifacts build/artifacts/src/protocol

For Hardhat, --artifacts should be the artifacts root plus your sources subpath — Hardhat mirrors the sources tree under the artifacts root.

Storage layout

Pushes include the storage layout when your Hardhat or Foundry project outputs it in the compiled artifacts — it powers the dashboard’s decoded storage section.

Notes

  • Interfaces and abstract contracts are skipped.
  • Contracts without deployable bytecode are skipped.
Last updated on