> For the complete documentation index, see [llms.txt](https://docs.mezzanine.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mezzanine.xyz/smart-contracts/deployment-of-core-contracts.md).

# 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](https://eips.ethereum.org/EIPS/eip-1167) and [ERC1967 Proxies ](https://eips.ethereum.org/EIPS/eip-1967)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.

<figure><img src="/files/4auiC6KLgjvNdMFTQX9F" alt=""><figcaption><p>Code Snippet from <em>TreasuryLogic.sol</em></p></figcaption></figure>

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. &#x20;

<figure><img src="/files/sU0F6Eas8dG6R2OzWkCK" alt=""><figcaption><p>Mezz Deployer's <em>deployAsset</em> function</p></figcaption></figure>

*Learn more about Creation vs Runtime code* [*here*](https://blog.openzeppelin.com/deconstructing-a-solidity-contract-part-ii-creation-vs-runtime-6b9d60ecb44c)*.*

*Learn more about the gas cost for the CREATE opcode* [*here*](https://github.com/wolflo/evm-opcodes/blob/main/gas.md#a9-create-operations)*.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mezzanine.xyz/smart-contracts/deployment-of-core-contracts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
