Deployment of Core Contracts

The Mezz Deployer is the smart contract responsible for deploying proxies of core contracts. It is a non-core contract. The Mezz Deployer specifically deploys new minimal, non-upgradeable EIP-1167 proxies and ERC1967 Proxies that point to implementations of Mezzanine core contracts. Proxies are used to reduce deployment costs since their runtime code is much smaller than that of implementations. The cost of a contract's deployment is directly proportional to the size of its creation and runtime code.

Implementations are versioned and set in the Mezz Migrator. Proxies deployed by the Mezz Deployer will always point to the latest implementations set in the Mezz Migrator. Implementations are queried from the Mezz Migrator when provided core identifiers, which point to the latest version of an implementation.

Upon deployment, all proxies are initialized atomically. Multiple major exploits have occurred from improper initialization. Some core contracts deploy contracts from the Mezz Deployer and subsequently set state atomically.

The initialization of deployments is standardized as a means to reduce the size of the Mezz Deployer. Bespoke initialization arguments are passed via abi-encoded parameters. For example, all assets in Mezzanine are deployed via the Mezzanine Deployer's deployAsset function. Assets are all initialized in the same manner. The validity of implementations is checked via ERC165. In the below code, the function would revert if given a core identifier that does not correspond to an asset.

Learn more about Creation vs Runtime code here.

Learn more about the gas cost for the CREATE opcode here.

Last updated