Project Contracts
Overview
Stagenets have a built-in smart contract management system. You can add any number of contracts to your project and have them operate as special project contracts. This establishes each contract as its own unit within the stagenet and unlocks two key benefits, which are explained in later sections:
- Customised contract tooling
- Version and deployment tracking
The project contract system is illustrated in the example dashboard below. Each tile represents a single project contract, grouping its versions and deployments into one unit. This tile serves as the entry point for managing said versions and deployments and using the system's built-in development tools on them.
The project contract system works best with GitHub repositories that contain your project’s smart contracts. While manual use is also possible, this integration offers the most streamlined experience. See our quickstart for how to connect a repository with a Hardhat or Foundry project.
Contract Tooling
A suite of development tools is available via each project contract’s dashboard, shown below. These include interaction panels, state variable displays, transaction and activity reports, analytics, operation tracking tools, and more.
Versions and Deployments
All the versions and deployments of a contract that you update and deploy as you develop are unified under a single project contract unit, enabling streamlined versioning. A project contracts versions and deployments are managed in the Versions & Deployments section in its dashboard, shown below:
Each project contract has a single Active Deployment. This is a stagenet deployment of one of its versions that is considered the current instance of that contract.
New Versions
New project contract versions are created automatically when you push changes to a contract’s source code on the main branch of a linked GitHub repository. Furthermore, if you add a new contract and push it, it will be added as a new project contract.
Detecting Deployments
When a contract is deployed to your stagenet, whether via a deploy script or through the UI, the stagenet checks if the deployed bytecode matches an existing project contract version. If it does, the deployment is recorded as an instance of that version.