# Vesting Contract

At the core of Maven Finance's commitment to fostering a sustainable, engaged community of stakeholders, lies the Vesting Contract.&#x20;

This smart contract manages the release of MVN tokens to team members, advisors, investors, and other vested parties, in a manner that aligns long-term incentives and bolsters platform stability.

The Vesting Contract details a clear and predetermined schedule for the release of tokens, ensuring that the beneficiaries remain committed to the project's success over an extended period.&#x20;

This crucial element of the Maven Finance ecosystem underpins the platform's trustworthiness, security, and integrity.

### Internal Vestee Control Entrypoints

#### addVestee

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

Adds a new vestee to the Vesting Contract with the given parameters

{% hint style="info" %}
Can be called only by the admin or the Council Contract
{% 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>

#### removeVestee

`function removeVestee(address vesteeAddress)`

Removes an existing vestee from the Vesting Contract

{% hint style="info" %}
Can be called only by the admin or the Council Contract
{% 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>

#### updateVestee

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

Updates the record of an existing vestee

{% hint style="info" %}
Can be called only by the admin or the Council Contract
{% 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>

#### toggleVesteeLock

`function toggleVesteeLock(address vesteeAddress)`

Toggles 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 the admin or the Council Contract
{% 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>

### Vestee Entrypoints

#### claim

`function claim()`

Can be called by any vestee to claim any vested tokens

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

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

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

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

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

#### getTotalVestedAmount

`function getTotalVestedAmount()`

Returns the total amount that has been vested thus far

#### getVesteeBalanceOpt

`function getVesteeBalanceOpt(address vesteeAddress)`

Returns the total vesting remainder for the vestee if found

#### getVesteeOpt

`function getVesteeOpt(address vesteeAddress)`

Returns the vestee record of the given vesteeAddress if found, else returns none

#### getLambdaOpt

`function getLambdaOpt(string lambdaName)`

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