# Governance Financial Contract

Acting as the gateway to the platform's treasury, the Financial Governance contract administers and governs financial decisions that shape Maven Finance's financial landscape.

The Financial Governance contract is responsible for creating financial requests to access funds from the treasury, overseeing the voting procedure by satellites on these requests, and executing approved requests.&#x20;

With its operations rooted in transparency and decentralized decision-making, the Financial Governance contract bolsters Maven Finance's commitment to a robust and community-driven DeFi ecosystem.

### Financial Governance Entrypoints

#### requestTokens

`function requestTokens(councilActionRequestTokensType councilActionRequestTokens)`

Creates a financial request for tokens from a specified treasury

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

<table><thead><tr><th width="272.3333333333333">Param Name</th><th width="296">Type</th><th>Description</th></tr></thead><tbody><tr><td>councilActionRequestTokens</td><td>councilActionRequestTokensType:<br>(address treasuryAddress,<br>address receiverAddress,<br>address tokenContractAddress,<br>string tokenName,<br>nat tokenAmount,<br>string tokenType,<br>nat tokenId,<br>string purpose)</td><td>The params sent when a council action for requesting tokens is sent from the council contract</td></tr><tr><td>treasuryAddress</td><td>address</td><td>The treasury from which 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>Contract address of the token which will be transferred</td></tr><tr><td>tokenName</td><td>string</td><td>Name of the token as reference</td></tr><tr><td>tokenAmount</td><td>nat</td><td>Total amount of tokens requested</td></tr><tr><td>tokenType</td><td>string</td><td>Type of the token in string: "XTZ", "FA12", "FA2"</td></tr><tr><td>tokenId</td><td>nat</td><td>Token ID of the token requested</td></tr><tr><td>purpose</td><td>string</td><td>Description about the purpose behind this financial request</td></tr></tbody></table>

#### requestMint

`function requestMint(councilActionRequestMintType councilActionRequestMint)`

Creates a financial request for the minting of new MVN Tokens from a specified treasury

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

<table><thead><tr><th width="272.3333333333333">Param Name</th><th width="296">Type</th><th>Description</th></tr></thead><tbody><tr><td>councilActionRequestMint</td><td>councilActionRequestMintType:<br>(address treasuryAddress,<br>address receiverAddress,<br>nat tokenAmount,<br>string purpose)</td><td>The params sent when a council action for requesting mint is sent from the council contract</td></tr><tr><td>treasuryAddress</td><td>address</td><td>The treasury from which 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>Total amount of tokens to be minted</td></tr><tr><td>purpose</td><td>string</td><td>Description about the purpose behind this financial request</td></tr></tbody></table>

#### setContractBaker

`function setContractBaker(councilActionSetContractBakerType councilActionSetContractBaker)`

Creates a financial request to set a baker for a specified contract

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

<table><thead><tr><th width="238.33333333333331">Param Name</th><th width="315">Type</th><th>Description</th></tr></thead><tbody><tr><td>councilActionSetContractBaker</td><td>councilActionSetContractBakerType:<br>(address targetContractAddress,<br>option(key_hash) keyHash)</td><td>The params sent when a council action for setting a contract baker is sent from the council contract</td></tr><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>

#### dropFinancialRequest

`function dropFinancialRequest(nat financialRequestId)`

Drops a financial request that had been previously created

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

<table><thead><tr><th width="272.3333333333333">Param Name</th><th width="296">Type</th><th>Description</th></tr></thead><tbody><tr><td>financialRequestId</td><td>nat</td><td>ID of the financial request to be dropped</td></tr></tbody></table>

#### voteForRequest

`function voteForRequest(nat financialRequestId, voteType vote)`

Vote for a financial request by a satellite

{% hint style="info" %}
Can be called only by an Active Satellite
{% endhint %}

<table><thead><tr><th width="272.3333333333333">Param Name</th><th width="296">Type</th><th>Description</th></tr></thead><tbody><tr><td>financialRequestId</td><td>nat</td><td>ID of the financial request to be voted on</td></tr><tr><td>vote</td><td>voteType:<br>| unit Yay<br>| unit Nay<br>| unit Pass</td><td>Vote choices that a satellite may choose when voting on the financial request</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, governanceFinancialConfigActionType governanceFinancialConfigAction)`

Updates the config variables on the Governance Financial Contract

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

<table><thead><tr><th width="212.33333333333331">Param Name</th><th width="355">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>governanceFinancialConfigAction</td><td>governanceFinancialConfigActionType: <br>| unit ConfigApprovalPercentage<br>| unit ConfigFinancialReqDurationDays</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 %}

<table><thead><tr><th width="249.33333333333331">Param Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>whitelistContractAddress</td><td>address</td><td>The contract address to be updated in the whitelist contracts bigmap</td></tr><tr><td>updateType</td><td>updateType: <br>| unit Update  <br>| unit Remove</td><td>Specifies whether the whitelistContractAddress should be updated or removed from the whitelist contracts bigmap</td></tr></tbody></table>

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

#### updateWhitelistTokenContracts

`function updateWhitelistTokenContracts(address whitelistTokenContractAddress, updateType update)`

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

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

<table><thead><tr><th width="232.33333333333331">Param Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td>whitelistTokenContractAddress</td><td>address</td><td>The token contract address to be updated in the whitelist token contracts bigmap</td></tr><tr><td>updateType</td><td>updateType: <br>| unit Update  <br>| unit Remove</td><td>Specifies whether the whitelistTokenContractAddress should be updated or removed from the whitelist token contracts bigmap</td></tr></tbody></table>

#### 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="190.33333333333331">Param Name</th><th width="347">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) Fa12 <br>| (address tokenContractAddress, nat tokenId)  MRC-20</td><td>The token type of the token to be transferred, corresponding to either mav, MRC-10 0r MRC-20</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

#### getFinancialRequestCounter

`function getFinancialRequestCounter()`

Returns the latest financial request counter

#### getFinancialRequestVoterOpt

`function getFinancialRequestVoterOpt(nat financialRequestId * address satelliteAddress)`

Returns a vote record based on the provided financial request id and satellite address, else returns none

#### getLambdaOpt

`function getLambdaOpt(string lambdaName)`

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