> 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/source-code/core/mezzgovernor.md).

# MezzGovernor

[Git Source](https://github.com/EntreDevelopers-Lab-Inc/Mezz-Companies/blob/f7a3e84e3dd5bb33c4bd7f77283983f9e8ba20b2/src/core/governance/MezzGovernor.sol)

**Inherits:** StateAware, Patchable, IMezzGovernor

**Author:** Daniel Yamagata

A base contract for governor that defines upgradeability logic and modifiers for access control

*All governors are able to execute arbitrary transactions. Therefore, they are able to call the Mezz Migrator to upgrade themselves to a newer version. Specifically, the governor should call the Mezz Migrator's upgradeToNewerVersion() However, resetting to a patched version may not be possible depending on the protocol state. Therefore, a function to execute this callback is provided via 'Patchable'*

## State Variables

### MezzGovernorStorageLocation

```solidity
bytes32 private constant MezzGovernorStorageLocation =
    0x0b1a6379e7855c565527499b30056eabdaf3a2b55abb1e5da911b250c18bf800;
```

## Functions

### \_getMezzGovernorStorage

```solidity
function _getMezzGovernorStorage() internal pure returns (MezzGovernorStorage storage $);
```

### constructor

```solidity
constructor(address _mezzHub, address _mezzMigrator) StateAware(_mezzHub) Patchable(_mezzMigrator);
```

### onlyMezzGovernance

*Reverts if the caller is not 'this'*

```solidity
modifier onlyMezzGovernance();
```

### init

Intializes the Governor's state

```solidity
function init(address initTreasury, bytes memory params) external virtual;
```

**Parameters**

| Name           | Type      | Description                                                   |
| -------------- | --------- | ------------------------------------------------------------- |
| `initTreasury` | `address` | The address of the Treasury that the Governor is in charge of |
| `params`       | `bytes`   | Bespoke abi.encoded parameters                                |

### \_\_MezzGovernor\_init

```solidity
function __MezzGovernor_init(address initTreasury) internal virtual onlyInitializing;
```

### treasury

Returns the address of the treasury associated with the governor

```solidity
function treasury() public view virtual returns (address);
```

### name

Returns the name of the governor

```solidity
function name() public view virtual returns (string memory);
```

### \_validateCallerIsGovernance

*Reverts if the caller is not 'this'*

```solidity
function _validateCallerIsGovernance() internal view;
```

### \_authorizePatch

*Access control for 'resetToPatchedLatestVersion()'*

```solidity
function _authorizePatch(bytes memory) internal view override;
```

## Structs

### MezzGovernorStorage

```solidity
struct MezzGovernorStorage {
    address _treasury;
}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mezzanine.xyz/smart-contracts/source-code/core/mezzgovernor.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
