> 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/documents.md).

# Documents

The *document registry* is a non-core contract used throughout the protocol.  It is not redeployed each time that a Mezz organization is created.  Rather, all instances of Mezzanine use the same document registry.  Notably, the document registry in Mezzanine is not access-controlled.  Anyone can add documents to the registry if desired. &#x20;

A document is made up of four different variables:

<figure><img src="https://lh7-us.googleusercontent.com/Hy36H-Dn22ROSHdp-TuODS9MfyHIEO8IayKNrJVsaYs9ZaQic7Ilfkww-YCQQBQp7lsImkwfG-WHjrajOImyEtSDZn-yzwrPpqiZumSykqXbMEh9E34vSjQagvHTy5TAqWheVf477gDe4cXRvMD6tr8" alt="" width="375"><figcaption><p>Code snippet from Mezzanine's DataTypes.sol</p></figcaption></figure>

Documents are always versioned, and previous versions are always stored on-chain:

<figure><img src="https://lh7-us.googleusercontent.com/07rva_0z5mnuXaba1Fosp84oGEoTrHo4IkBD-yXLZL5HLg09ycc41yLEfuwAOhHcPPyG8QAK828Dqnm-r8hAvXm9rDFVVDNY0WZepoQsZxHgG0Jv62G85Y3Yb4oS12g8NSZiNLYefrMC0sjbwp5M1X8" alt=""><figcaption><p>Code snippet from Mezzanine's DataTypes.sol</p></figcaption></figure>

Whenever a document is updated, *nextVersion’s* current value is set to the updated document, and it is subsequently incremented.  Only a document that exists can be updated. &#x20;

Versioned documents are always associated with an *owner*, and each document is associated with an index.

<figure><img src="https://lh7-us.googleusercontent.com/YFoMjBGYhxBVu0Jm1A8vXskoPDOPbXY3vXde10STtJMKi8vTu-z2OWhA6W6Uh4I9vG5Jmzw41Bro2UqVJH4Bz_QVJwru-ELTidksWKBogzWP0E8i3DPl_bkClHEgs8PUvYuxuaeWEzOp7IMrfkxAQeA" alt=""><figcaption><p>Code Snippet from DocumentRegistry.sol</p></figcaption></figure>

The exact methods for access control for documents have yet to be determined.  Access control for documents would occur off-chain, such as by using [Lit Protocol.](https://www.litprotocol.com/)  The URIs, themselves, will likely be stored on IPFS with the providers either being Filecoin or Pinata.  However, this has yet to be determined.  Initial versions of Mezzanine may have document URIs that point to a centralized interface. &#x20;

Generally, a document's name and URI are set by the users, themselves.  There is a single exception: a company will always be created with an incorporation document and its initial name will be “*Company Name Incorporation Document*”.  The owner of the Incorporation Document is the Treasury contract.  The name and URI can always be updated by the Treasury later on if desired. &#x20;

At various points throughout the codebase, certain mappings keep track of a document index.  For example, an asset in a company's capital stack will always point to a document.  However, this document is not guaranteed to have an accurate, valid name and URI. &#x20;

Certain actions in Mezzanine will always create a document:

* Adding an asset to the *capital stack*
* Sending an invoice via the *billing router*&#x20;
* Hiring an employee via the *payroll manager*
* Creating a Mezzanine company

Old versions of a document are always queryable and immutable.  The URI of an old version cannot be changed on-chain.  However, depending on the system used for URIs, a URI may point to a new document if Mezzanine does not use a decentralized storage system.

Departments and Treasuries are multi-signature wallets.  Therefore, they can execute arbitrary transactions on their own.  However, modules and ancillary contracts are standalone contracts and are unable to execute arbitrary transactions.  Each of them contains logic to update their documents.  "Removing" documents is akin to setting the document’s name and URI to null values. &#x20;

The Document Registry is upgradeable and can only be upgraded by the owner of the Mezz Hub, which will be the Mezzanine’s multi-signature wallet. &#x20;

Notably, the document registry's functionality is not aware of protocol state, since its functionality never deals with user funds.  Therefore, it realistically never needs to be paused or frozen. &#x20;


---

# 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/documents.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.
