# 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;
}
```
