# Council Contract

The Council Contract oversees the selection and actions of the Maven Council, a group of dedicated community representatives who facilitate the Maven Finance's growth and development.

The Council Contract manages the Council's functionalities, enabling the addition and removal of members, changes in membership, and the setting of bakers.&#x20;

Further, it also governs actions related to vesting and financial governance, ensuring a fair and transparent administration of Maven Finance.

### Council Actions For Internal Control

#### councilActionAddMember

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

Creates a council action to add a new council member

{% hint style="info" %}
Can be called only by a 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 council member

{% hint style="info" %}
Can be called only by a 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 council member with a new council member. This preserves the number of council members.

{% 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>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>

### Council Actions For Vesting&#x20;

#### councilActionAddVestee

`function councilActionAddVestee(address vesteeAddress, nat totalAllocatedAmount, nat cliffInMonths, nat vestingInMonths)`

Creates a council action to add a new vestee

{% 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>vesteeAddress</td><td>address</td><td>The user address of the new vestee</td></tr><tr><td>totalAllocatedAmount</td><td>nat</td><td>The total allocated amount that will be given to the vestee over the vesting duration</td></tr><tr><td>cliffInMonths</td><td>nat</td><td>The number of months before a vestee may start to vest his tokens. Cannot be greater than vestingInMonths.</td></tr><tr><td>vestingInMonths</td><td>nat</td><td>The total duration in months for the vesting period. Has to be greater than 0.</td></tr></tbody></table>

#### councilActionRemoveVestee

`function councilActionRemoveVestee(address vesteeAddress)`

Creates a council action to remove an existing vestee

{% 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>vesteeAddress</td><td>address</td><td>The user address of the vestee to be removed</td></tr></tbody></table>

#### councilActionUpdateVestee

`function councilActionUpdateVestee(address vesteeAddress, nat newTotalAllocatedAmount, nat newCliffInMonths, nat newVestingInMonths)`

Creates a council action to update an existing vestee

{% 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>vesteeAddress</td><td>address</td><td>The user address of the vestee to be updated</td></tr><tr><td>newTotalAllocatedAmount</td><td>nat</td><td>The new total allocated amount that will be given to the vestee over the vesting duration</td></tr><tr><td>newCliffInMonths</td><td>nat</td><td>The new number of months before a vestee may start to vest his tokens. Cannot be greater than newVestingInMonths.</td></tr><tr><td>newVestingInMonths</td><td>nat</td><td>The new total duration in months for the vesting period. Has to be greater than 0.</td></tr></tbody></table>

#### councilActionToggleVesteeLock

`function councilActionToggleVesteeLock(address vesteeAddress)`

Creates a council action to toggle a lock on an existing vestee. If lock is enabled, the vestee will not be able to vest or claim his tokens.&#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>vesteeAddress</td><td>address</td><td>The user address of the vestee where lock status is to be toggled</td></tr></tbody></table>

### Council Actions For Financial Governance&#x20;

#### councilActionTransfer

`function councilActionTransfer(address receiverAddress, address tokenContractAddress, nat tokenAmount, string tokenType, nat tokenId, string purpose)`

Creates a council action for the transfer of tokens from the Council Contract to a recipient

{% 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>receiverAddress</td><td>address</td><td>The user address of the receiver of the transfer</td></tr><tr><td>tokenContractAddress</td><td>address</td><td>The token contract address of the token to be transferred</td></tr><tr><td>tokenAmount</td><td>nat</td><td>The total amount of tokens to be transferred</td></tr><tr><td>tokenType</td><td>string</td><td>Type of the token in string: "MVRK", "MRC-10", "MRC-20"</td></tr><tr><td>tokenId</td><td>nat</td><td>The token Id of the token to be transferred</td></tr><tr><td>purpose</td><td>string</td><td>A description of the purpose of this transfer council action</td></tr></tbody></table>

#### councilActionRequestTokens

`function councilActionRequestTokens(address treasuryAddress, address receiverAddress, address tokenContractAddress, string tokenName, nat tokenAmount, string tokenType, nat tokenId, string purpose)`

Creates a council action to request tokens from a specified treasury contract.&#x20;

If successfully voted on by the council, a financial governance request will automatically be created to be voted on by satellites. If sufficient votes from satellites are gathered, the financial governance request will be executed.&#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>treasuryAddress</td><td>address</td><td>The address of the treasury contract where tokens will be requested from</td></tr><tr><td>receiverAddress</td><td>address</td><td>The address of the receiver where tokens will be transferred to</td></tr><tr><td>tokenContractAddress</td><td>address</td><td>The token contract address of the token to be requested</td></tr><tr><td>tokenName</td><td>string</td><td>The reference name of the token to be requested</td></tr><tr><td>tokenAmount</td><td>nat</td><td>The total amount of tokens to be requested</td></tr><tr><td>tokenType</td><td>string</td><td>Type of the token in string: "MVRK", "MRC-10", "MRC-20"</td></tr><tr><td>tokenId</td><td>nat</td><td>The token Id of the token to be requested</td></tr><tr><td>purpose</td><td>string</td><td>A description of the purpose of this council action to request tokens</td></tr></tbody></table>

#### councilActionRequestMint

`function councilActionRequestTokens(address treasuryAddress, address receiverAddress, nat tokenAmount, string purpose)`

Creates a council action to request the minting of MVN tokens from a specified treasury contract.&#x20;

If successfully voted on by the council, a financial governance request will automatically be created to be voted on by satellites. If sufficient votes from satellites are gathered, the financial governance request will be executed.&#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>treasuryAddress</td><td>address</td><td>The address of the treasury contract where new MVN tokens will be minted from</td></tr><tr><td>receiverAddress</td><td>address</td><td>The address of the receiver where tokens will be minted to</td></tr><tr><td>tokenAmount</td><td>nat</td><td>The total amount of MVN tokens to be minted</td></tr><tr><td>purpose</td><td>string</td><td>A description of the purpose of this council action to request the minting of new tokens</td></tr></tbody></table>

#### councilActionSetContractBaker

`function councilActionSetContractBaker(address targetContractAddress, option(key_hash) keyHash)`

Creates a council action to set a baker on the target contract address.

If successfully voted on by the council, a financial governance request will automatically be created to be voted on by satellites. If sufficient votes from satellites are gathered, the financial governance request will be executed.&#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>targetContractAddress</td><td>address</td><td>The target address for which a new baker will be set</td></tr><tr><td>keyHash</td><td>option(key_hash)</td><td> Key hash of the baker</td></tr></tbody></table>

#### councilActionDropFinancialReq

`function councilActionDropFinancialReq(nat financialRequestId)`

Creates a council action to drop a financial request

If successfully voted on by the council, the financial governance request will be dropped from the Governance Financial contract.

{% 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>financialRequestId</td><td>nat</td><td>The id of the financial request to be dropped on the Governance Financial Contract</td></tr></tbody></table>

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

When the threshold number of signatures from 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, councilConfigActionType councilConfigAction)`

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>councilConfigAction</td><td>councilConfigActionType: <br>| unit ConfigThreshold<br>| unit ConfigActionExpiryDays<br>| unit ConfigCouncilNameMaxLength<br>| unit ConfigCouncilWebsiteMaxLength<br>| unit ConfigCouncilImageMaxLength<br>| unit ConfigRequestTokenNameMaxLength<br>| unit ConfigRequestPurposeMaxLength</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 |

#### updateCouncilMemberInfo

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

Updates a council member info&#x20;

{% hint style="info" %}
Can be called only by a 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

#### 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
