Skip to Content
SDK & CLICLIInit Workspaces

Init Workspaces

Initialize Workspaces from a Hardhat or Foundry project’s compiled contract artifacts.

Each artifact becomes a pending Workspace on your Stagenet. When a deployed contract matches the artifact’s bytecode, its Workspace is activated automatically.

A Workspace is a custom dashboard for a contract — it shows transactions, balances, TVL, storage, and tracked data over time.

How it works

The CLI scans your build artifacts (out/ for Foundry, artifacts/contracts/ for Hardhat) and extracts each contract’s ABI and bytecode. It sends them to your Stagenet, which creates a pending Workspace per contract.

When a contract is deployed on your Stagenet, its bytecode is compared against the pending Workspaces. If there is a match, the Workspace is activated.

Usage

With a contract.dev.js at your project root (see Setup):

contract.dev init-workspaces

Output:

Detected foundry project at /Users/you/myproject source: /Users/you/myproject/src artifacts: /Users/you/myproject/out Found 3 contract(s): - Vault (src/Vault.sol) - Token (src/Token.sol) - Router (src/Router.sol) Initializing workspaces on stagenet... Result: Vault created Token unchanged Router new_version

The CLI does not build your project. Run forge build or npx hardhat compile first.

Source directory

The CLI scans your compiled build artifacts, but only initializes Workspaces for contracts that come from the source directory defined by your project config.

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

Contracts outside that directory are skipped. This prevents imported dependencies, such as OpenZeppelin contracts or libraries from node_modules, from being treated as part of your project.

To override, set contracts in your contract.dev.js:

/** @type {import('contract.dev').Config} */ module.exports = { rpcUrl: process.env.STAGENET_RPC_URL, contracts: "src/protocol", };

Interfaces and abstract contracts (no deployable bytecode) are always skipped.

Last updated on