> For the complete documentation index, see [llms.txt](https://docs.mavenfinance.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mavenfinance.io/smart-contracts/smart-contracts-overview/break-glass-contract.md).

# Break Glass Contract

Rapid Response for Decentralized Finance

The Break Glass Contract is an essential component of Maven Finance's security measures. This contract is a fail-safe mechanism that ensures the continuity of the Maven Finance ecosystem, even in the event of unexpected or emergency situations.

Primarily, the Break Glass Contract allows for swift and decisive action, bypassing regular governance processes when the security or stability of the Maven ecosystem is at stake.&#x20;

It empowers the community to take immediate action, guaranteeing the overall resilience and robustness of the Maven Finance platform.

### Break Glass Council Actions For Internal Control

#### councilActionAddMember

`function councilActionAddMember(address memberAddress, string memberName, string memberWebsite, string memberImage)`

Creates a council action to add a new break glass council member

{% hint style="info" %}
Can be called only by a Break Glass Council Member
{% endhint %}

| Param Name    | Type    | Description                                  |
| ------------- | ------- | -------------------------------------------- |
| memberAddress | address | The user address of the new council member   |
| memberName    | string  | The name of the new council member           |
| memberWebsite | string  | The website of the new council member        |
| memberImage   | string  | A url to the image of the new council member |

#### councilActionRemoveMember

`function councilActionRemoveMember(address memberAddress)`

Creates a council action to remove an existing break glass council member

{% hint style="info" %}
Can be called only by a Break Glass Council Member
{% endhint %}

| Param Name    | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| memberAddress | address | The user address of the council member to be removed |

#### councilActionChangeMember

`function councilActionChangeMember(address oldCouncilMemberAddress, address newCouncilMemberAddress, string newCouncilMemberName, string newCouncilMemberWebsite, string newCouncilMemberImage)`

Creates a council action to change an existing break glass council member with a new council member. This preserves the number of council members.

{% hint style="info" %}
Can be called only by a Break Glass Council Member
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>oldMemberAddress</td><td>address</td><td>The user address of the council member to be removed</td></tr><tr><td>newMemberAddress</td><td>address</td><td>The user address of the new council member</td></tr><tr><td>newCouncilMemberName</td><td>string</td><td>The name of the new council member</td></tr><tr><td>newCouncilMemberWebsite</td><td>string</td><td>The website of the new council member </td></tr><tr><td>newCouncilMemberImage</td><td>string</td><td>A url to the image of the new council member</td></tr></tbody></table>

### Break Glass Actions

#### breakGlass

`function breakGlass()`

Triggers break glass and sets the glassBroken boolean to True&#x20;

{% hint style="info" %}
Can be called only by the Emergency Governance Contract
{% endhint %}

### Break Glass Actions: Glass Broken Required

#### propagateBreakGlass

`function propagateBreakGlass(set(address) contractAddressSet)`

This creates a propagateBreakGlass action on the Break Glass Contract. When the threshold number of signatures from Break Glass Council members has been reached, it will execute and propagate break glass across the given set of Maven contract addresses.&#x20;

The set of contract addresses will be sent to the Maven Governance Contract. Thereafter, the admin of each contract will be set to the Break Glass Contract and all entrypoints within the contract will be paused.

{% hint style="info" %}
Can be called only by a Break Glass Council Member when glassBroken is True
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>contractAddressSet</td><td>set(address)</td><td>A set of Maven contract addresses to propagate break glass</td></tr></tbody></table>

#### setContractsAdmin

`function setContractsAdmin(set(address) contractAddressSet, address newAdminAddress)`

This creates a setContractsAdmin action on the Break Glass Contract. When the threshold number of signatures from Break Glass Council members has been reached, it will execute and set a new admin address on each of the contracts within the contract address set.&#x20;

The new admin address will have to be a valid admin address in which it is the Governance Proxy Contract or an address within the whitelist developers set on the Governance Contract.

{% hint style="info" %}
Can be called only by a Break Glass Council Member when glassBroken is True
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>contractAddressSet</td><td>set(address)</td><td>A set of Maven contract addresses</td></tr><tr><td>newAdminAddress</td><td>address</td><td>A valid new admin address</td></tr></tbody></table>

#### pauseAllEntrypoints

`function pauseAllEntrypoints(set(address) contractAddressSet)`

This creates a pauseAllEntrypoints action on the Break Glass Contract.&#x20;

When the threshold number of signatures from Break Glass Council members has been reached, it will execute and call the pauseAll entrypoint on each of the contracts within the contract address set.

{% hint style="info" %}
Can be called only by a Break Glass Council Member when glassBroken is True
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>contractAddressSet</td><td>set(address)</td><td>A set of Maven contract addresses</td></tr></tbody></table>

#### unpauseAllEntrypoints

`function unpauseAllEntrypoints(set(address) contractAddressSet)`

This creates a unpauseAllEntrypoints action on the Break Glass Contract.&#x20;

When the threshold number of signatures from Break Glass Council members has been reached, it will execute and call the unpauseAll entrypoint on each of the contracts within the contract address set.

{% hint style="info" %}
Can be called only by a Break Glass Council Member when glassBroken is True
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>contractAddressSet</td><td>set(address)</td><td>A set of Maven contract addresses</td></tr></tbody></table>

#### removeBreakGlassControl

`function removeBreakGlassControl(set(address) contractAddressSet)`

This creates a removeBreakGlassControl action on the Break Glass Contract.&#x20;

When the threshold number of signatures from Break Glass Council members has been reached, it will execute and remove the Break Glass Control.&#x20;

When executed, the admin of the Break Glass Contract and contracts in the contract address set will be reset back to the Governance Proxy Contract Address, and the glassBroken boolean will be reset back to False.

{% hint style="info" %}
Can be called only by a Break Glass Council Member when glassBroken is True
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>contractAddressSet</td><td>set(address)</td><td>A set of Maven contract addresses</td></tr></tbody></table>

### Break Glass Council Signing of Actions

#### flushAction

`function flushAction(nat councilActionId)`

Creates a council action to flush the specified council action id

{% hint style="info" %}
Can be called only by a Break Glass Council Member
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>councilActionId</td><td>nat</td><td>The id of the council action to be flushed</td></tr></tbody></table>

#### signAction

`function signAction(nat councilActionId)`

Creates a council action to sign the specified council action id.&#x20;

When the threshold number of signatures from Break Glass Council members has been reached, the council action will automatically be executed by the last signer.&#x20;

{% hint style="info" %}
Can be called only by a Council Member
{% endhint %}

<table><thead><tr><th width="274.3333333333333">Param Name</th><th width="199">Type</th><th>Description</th></tr></thead><tbody><tr><td>councilActionId</td><td>nat</td><td>The id of the council action to be signed</td></tr></tbody></table>

### Housekeeping **Entrypoints**

setAdmin

`function setAdmin(address newAdminAddress)`

Sets a new admin address for the contract

{% hint style="info" %}
Can be called only by the admin or the governance contract address
{% endhint %}

| Param Name      | Type    | Description                  |
| --------------- | ------- | ---------------------------- |
| newAdminAddress | address | The address of the new admin |

#### setGovernance

`function setGovernance(address newGovernanceAddress)`

Sets a new governance contract address

{% hint style="info" %}
Can be called only by the admin or the governance contract address
{% endhint %}

| Param Name           | Type    | Description                                |
| -------------------- | ------- | ------------------------------------------ |
| newGovernanceAddress | address | The address of the new governance contract |

#### updateMetadata

`function updateMetadata(string key, bytes hash)`

Replace the hash of the contract metadata based on the provided key

{% hint style="info" %}
Can be called only by the admin (i.e. the governance proxy contract)
{% endhint %}

| Param Name | Type   | Description                                  |
| ---------- | ------ | -------------------------------------------- |
| key        | string | The key in the metadata bigmap to be updated |
| hash       | bytes  | The hash of the metadata key                 |

#### updateConfig

`function updateConfig(nat newConfigValue, breakGlassConfigActionType breakGlassConfigAction)`

Updates the config variables on the Council Contract

{% hint style="info" %}
Can be called only by the admin (i.e. the governance proxy contract)
{% endhint %}

<table><thead><tr><th width="232">Param Name</th><th width="364.3333333333333">Type</th><th>Description</th></tr></thead><tbody><tr><td>newConfigValue</td><td>nat</td><td>The new value of the config parameter</td></tr><tr><td>breakGlassConfigAction</td><td>breakGlassConfigActionType: <br>| unit ConfigThreshold<br>| unit ConfigActionExpiryDays<br>| unit ConfigCouncilNameMaxLength<br>| unit ConfigCouncilWebsiteMaxLength<br>| unit ConfigCouncilImageMaxLength</td><td>The variant config variable to be updated</td></tr></tbody></table>

#### updateWhitelistContracts

`function updateWhitelistContracts(address whitelistContractAddress, updateType update)`

Add, update or remove a whitelist contract in the whitelistContracts map in the storage

{% hint style="info" %}
Can be called only by the admin (i.e. the governance proxy contract)
{% endhint %}

| Param Name               | Type                | Description                                                          |                 |                                                                                                                 |
| ------------------------ | ------------------- | -------------------------------------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------- |
| whitelistContractAddress | address             | The contract address to be updated in the whitelist contracts bigmap |                 |                                                                                                                 |
| updateType               | <p>updateType: <br> | unit Update  <br>                                                    | unit Remove</p> | Specifies whether the whitelistContractAddress should be updated or removed from the whitelist contracts bigmap |

#### updateGeneralContracts

`function updateGeneralContracts(string generalContractName, address generalContractAddress, updateType update)`

Add, update or remove a general contract in the generalContracts map in the storage

{% hint style="info" %}
Can be called only by the admin (i.e. the governance proxy contract)
{% endhint %}

| Param Name             | Type                | Description                                                                                                       |                 |                                                                                                             |
| ---------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------- |
| generalContractName    | string              | The identifier key to be set in the general contracts bigmap which will be the general contract name in camelcase |                 |                                                                                                             |
| generalContractAddress | address             | The contract address to be updated in the general contracts bigmap                                                |                 |                                                                                                             |
| updateType             | <p>updateType: <br> | unit Update <br>                                                                                                  | unit Remove</p> | Specifies whether the generalContractAddress should be updated or removed from the general contracts bigmap |

#### mistakenTransfer

`function mistakenTransfer(transferActionType transferList)`

Transfers any mav or token that may have mistakenly been sent to this contract

{% hint style="info" %}
Can be called only by the admin or the governance satellite contract
{% endhint %}

<table><thead><tr><th width="196.33333333333331">Param Name</th><th width="331">Type</th><th>Description</th></tr></thead><tbody><tr><td>transferList</td><td><p>transferActionType:</p><p>list(address to_, <br>nat tokenAmount, <br>token tokenType)</p></td><td>A list of transfers of tokens to recipients</td></tr><tr><td>to_</td><td>address</td><td>The recipient of the mistaken transfer</td></tr><tr><td>tokenAmount</td><td>nat</td><td>The amount of tokens to be transferred</td></tr><tr><td>token</td><td>tokenType: <br>| unit Mav<br>| (address tokenContractAddress) MRC-20 <br>| (address tokenContractAddress, nat tokenId)  MRC-20</td><td>The token type of the token to be transferred, corresponding to either Mav, MRC-10 OR MRC-20</td></tr></tbody></table>

#### updateCouncilMemberInfo

`function updateCouncilMemberInfo(string memberName, string memberWebsite, string memberImage)`

Updates a council member info&#x20;

{% hint style="info" %}
Can be called only by a Break Glass Council Member
{% endhint %}

<table><thead><tr><th>Param Name</th><th width="182.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>memberName</td><td>string</td><td>The updated name of the council member</td></tr><tr><td>memberWebsite</td><td>string</td><td>The updated website of the council member</td></tr><tr><td>memberImage</td><td>string</td><td>The updated url to the image of the council member</td></tr></tbody></table>

#### setLambda

`function setLambda(string lambdaName, bytes func_bytes)`

Sets a lambda in the contract with the given bytes and name

{% hint style="info" %}
Can be called only by the admin (i.e. the governance proxy contract)
{% endhint %}

<table><thead><tr><th width="249.33333333333331">Param Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>lambdaName</td><td>string</td><td>The name of the lambda to be set</td></tr><tr><td>func_bytes</td><td>bytes</td><td>The data of the lambda in Michelson bytes format</td></tr></tbody></table>

### View Methods

#### getGlassBroken

`function getGlassBroken()`

Returns the glass broken boolean

#### getAdmin

`function getAdmin()`

Returns the contract admin

#### getGovernanceAddress

`function getGovernanceAddress()`

Returns the contract governance address

#### getConfig

`function getConfig()`

Returns the contract configuration parameters

#### getWhitelistContractOpt

`function getWhitelistContractOpt(address contractAddress)`

Returns unit if contract address is whitelisted, else returns none

#### getGeneralContractOpt

`function getGeneralContractOpt(string contractName)`

Returns the contract address if the contract name is found, else returns none

#### getCouncilMemberOpt

`function getCouncilMemberOpt(address councilMemberAddress)`

Returns the council member record if it exists, else returns none

#### getCouncilActionOpt

`function getCouncilActionOpt(nat councilActionId)`

Returns the council action record if it exists, else returns none

#### getCouncilActionSignerOpt

`function getCouncilActionSignerOpt(nat councilActionId * address councilMemberAddress)`

Returns unit if council member has signed the given council action, else returns none

#### getActionCounter

`function getActionCounter()`

Returns the latest action counter

#### getLambdaOpt

`function getLambdaOpt(string lambdaName)`

Returns a lambda in the contract for the given lambda name, else returns none
