Contract Deployment
In the Aztec protocol, contracts are created as instances of contract classes. The deployment process consists of two main steps: first publishing the contract class (if not already published), and then creating a contract instance that references this class.
Contract Classes
A contract class is a collection of state variable declarations, and related private, public and utility functions. Contract classes don't have state, they just define code (storage structure and function logic). A contract class cannot be called; only a contract instance can be called.
Key Benefits of Contract Classes
Contract classes simplify code reuse by making implementations a first-class citizen in the protocol. With a single class registration, multiple contract instances can be deployed that reference it, reducing deployment costs. Classes also facilitate upgradability by decoupling state from code, making it easier for an instance to switch to different code while retaining its state.