> 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/mvn-token-contract.md).

# MVN Token Contract

Empowering the Maven Ecosystem with MVN

The MVN Token Contract governs the operations of Maven Finance's native token, MVN.&#x20;

As the fundamental currency within the Maven Finance ecosystem, the MVN Token Contract ensures the smooth functioning of token transactions, from transfers to staking and governance.

Within this contract, the mechanisms for the management of MVN tokens, as well as the rules governing the maximum total supply of the MVN token through its inflation rate, are laid out.&#x20;

Whether you're earning MVN through yield farming, staking for governance power, or transacting within the Maven ecosystem, the MVN Token Contract plays a pivotal role in your interaction with the platform.

### FA2 Token Contract **Entrypoints**

#### assertMetadata

`function assertMetadata(string key, bytes hash)`

Asserts whether the given metadata matches the one on the token contract

| Param Name | Type   | Description                                                               |
| ---------- | ------ | ------------------------------------------------------------------------- |
| key        | string | The key in the metadata bigmap on the token contract                      |
| hash       | bytes  | The metadata hash to be compared with the result from the key-value given |

#### transfer

`function transfer(fa2TransferType transferList)`

Transfers tokens from one user to another

| Param Name   | Type                                                                              | Description                                                                 |
| ------------ | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| transferList | fa2TransferType: list(transferType transfer)                                      | A list of transfers to be processed                                         |
| transfer     | <p>transferType: <br>address from\_,<br>list(transferDestinationType tx) txs </p> | Specifies the sender from\_ and a list of transfer destination transactions |
| from\_       | address                                                                           | Sender of the token                                                         |
| txs          | list(transferDestinationType tx)                                                  | List of transfer destination transactions                                   |
| tx           | <p>transferDestinationType:<br>address to\_,<br>nat tokenId,<br>nat amount</p>    | Specifies the transfer destination of the transaction                       |
| to\_         | address                                                                           | Recipient of the transfer operation                                         |
| tokenId      | nat                                                                               | The id of the token to be transferred                                       |
| amount       | nat                                                                               | The total amount of tokens to be transferred                                |

#### balance\_of

`function balance_of(list(balanceOfRequestType balanceOfRequest) requests, contract(list(balanceOfResponseType balanceOfResponse) callback)`

Facilitates inter-contract calls to retrieve the balance of a given user

<table><thead><tr><th width="203.33333333333331">Param Name</th><th width="286">Type</th><th>Description</th></tr></thead><tbody><tr><td>requests</td><td>list(balanceOfRequestType balanceOfRequest)</td><td>A list of balance_of requests for the balance of given addresses</td></tr><tr><td>callback</td><td>contract(list(balanceOfResponseType balanceOfResponse))</td><td>A list of contracts to send the balanceOf requests to</td></tr><tr><td>balanceOfResponse</td><td>balanceOfResponseType:<br>balanceOfRequestType balanceOfRequest,<br>nat balance </td><td>A balanceOf response to be forwarded to the contract specified in the callback</td></tr><tr><td>balanceOfRequest</td><td>balanceOfRequestType:<br>address owner, <br>nat tokenId</td><td>Specifies the token id and balance of owner requested from</td></tr><tr><td>owner</td><td>address</td><td>The requested user address to find the balance of</td></tr><tr><td>tokenId</td><td>nat</td><td>The requested token id to find the balance of</td></tr><tr><td>balance</td><td>nat</td><td>The balance of the requested user address and token id</td></tr></tbody></table>

#### update\_operators

`function update_operators(list(updateOperatorVariantType updateOperatorVariant) updateOperatorsList)`

Updates the operators for a given token id and owner

{% hint style="info" %}
Can be called only by token owners to set operators for themselves
{% endhint %}

<table><thead><tr><th width="234.33333333333331">Param Name</th><th width="286">Type</th><th>Description</th></tr></thead><tbody><tr><td>updateOperatorsList</td><td>list(updateOperatorVariantType updateOperatorVariant)</td><td>A list of updateOperators transactions to be processed</td></tr><tr><td>updateOperatorVariant</td><td>updateOperatorVariantType:<br>| operatorParameterType Add_operator<br>| operatorParameterType Remove_operator</td><td>Specify whether an operator should be added or removed</td></tr><tr><td>Add_operator</td><td>operatorParameterType:<br>address owner,<br>address operator,<br>nat tokenId</td><td>Authorises an operator to act on behalf of the owner for the given token id</td></tr><tr><td>Remove_operator</td><td>operatorParameterType:<br>address owner,<br>address operator,<br>nat tokenId</td><td>Removes the authority of an operator to act on behalf of the owner for the given token id</td></tr><tr><td>owner</td><td>address</td><td>Address of the user to set the operator on</td></tr><tr><td>operator</td><td>address</td><td>Address of the operator to be authorized</td></tr><tr><td>tokenId</td><td>nat</td><td>Id of the token where the operator will be set</td></tr></tbody></table>

#### mint

`function mint(address userAddress, nat tokenAmount)`

Mints a given token amount to the provided user address

{% hint style="info" %}
Can be called only by the admin or whitelisted contracts set by Governance
{% endhint %}

| Param Name  | Type    | Description                                   |
| ----------- | ------- | --------------------------------------------- |
| userAddress | address | The user address to receive new minted tokens |
| tokenAmount | nat     | The token amount to be minted                 |

#### burn

`function burn(nat tokenAmount)`

Burns the provided token amount

<table><thead><tr><th>Param Name</th><th width="198.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>tokenAmount</td><td>nat</td><td>The token amount to be burned</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 |

#### 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) 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 OR MRC-20</td></tr></tbody></table>

### Protected **Entrypoints**

#### updateInflationRate

`function updateInflationRate(nat newInflationRate)`

Updates the inflation rate for the MVN Token, which is the rate of increase of the maximum total supply allowed

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

| Param Name       | Type | Description                                       |
| ---------------- | ---- | ------------------------------------------------- |
| newInflationRate | nat  | The new inflation rate for the MVN Token Contract |

#### triggerInflation

`function triggerInflation()`

Triggers inflation for the MVN Token, where the maximum total supply limit is increased based on the inflation rate percentage of the current MVN total supply.

The inflation rate may be triggered only once every 360 days and only when at least 90% of the maximum supply has been minted.

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

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

#### get\_balance

`function get_balance(address userAddress * nat tokenId)`

Returns the balance for the given userAddress and tokenId, else returns 0

#### all\_tokens

`function all_tokens()`

Returns a list of token ids used by the token contract (in this case, only the zero token id is used)

#### is\_operator

`function is_operator(address ownerAddress, address operatorAddress, nat tokenId)`

Returns the operator record for the given ownerAddress and tokenId, else returns none

#### token\_metadata

`function token_metadata(nat tokenId)`

Returns the token metadata for the given token id, else returns none

#### total\_supply

`function total_supply()`

Returns the maximum supply of MVN Tokens

#### getMaximumSupply

`function getMaximumSupply()`

Returns the maximum supply of MVN Tokens

#### getInflationRate

`function getInflationRate()`

Returns the current inflation rate of the MVN Token Contract

#### getNextInflationRateTimestamp

`function getNextInflationRateTimestamp()`

Returns the timestamp of the next instance when the inflation rate can be triggered for the MVN Token Contract
