# KYCToken

{% hint style="info" %}
The KYC status is represented by a **non-transferable** NFT ERC721, minted only by **trusted KYC providers**. This NFT, associated with a **unique** address, allows that address to deposit funds in all vaults.
{% endhint %}

## Types

### TokenParameters

```solidity
struct TokenParameters {
    bool active; 
    string provider; 
    string proof; 
    uint256 flag; 
    uint256 expiration; 
}
```

TokenParameters represents the stored metadata to enable on chain filtering when entering Vaults

| Name         | Type    | Description           |
| ------------ | ------- | --------------------- |
| `active`     | bool    | ongoing KYC state     |
| `provider`   | string  | KYC trust provider    |
| `proof`      | string  | hash of the proof     |
| `flag`       | uint256 | degree of sensitivity |
| `expiration` | uint256 | expiration date       |

## View Methods

### ownedNFTMap

```solidity
function ownedNFTMap(address _owner) external view returns (uint256 tokenId)
```

Returns the token ID of the KYC NFT of a user.&#x20;

**Call Parameters:**

| Name     | Type    | Description         |
| -------- | ------- | ------------------- |
| `_owner` | address | address of an owner |

**Return Value:**

| Type    | Description             |
| ------- | ----------------------- |
| uint256 | token ID of the KYC NFT |

### tokenParameters

```solidity
function tokenParameters(uint256 tokenId) 
    public view virtual returns (TokenParameters memory)
```

Returns the KYC parameters for a given token ID.

**Call Parameters:**

| Name      | Type    | Description |
| --------- | ------- | ----------- |
| `tokenId` | uint256 | token ID    |

**Return Value:**

| Type            | Description                 |
| --------------- | --------------------------- |
| TokenParameters | KYC parameters of the token |

### isUserKYC

```solidity
function isUserKYC(address user) external view returns (bool)
```

Returns whether or not the user has a valid NFT.

**Call Parameters:**

| Name   | Type    | Description         |
| ------ | ------- | ------------------- |
| `user` | address | address of the user |

**Return Value:**

| Type | Description                |
| ---- | -------------------------- |
| bool | `true` if the NFT is valid |

## Write Methods

### setTokenParameters

```solidity
function setTokenParameters(
    uint256 tokenId, 
    TokenParameters calldata parameters
) external
```

Allows KYC providers to edit TokenParameters of a given token ID.&#x20;

{% hint style="info" %}
This method can only be called by address with **DEFAULT\_ADMIN\_ROLE**.
{% endhint %}

**Call Parameters:**

| Name         | Type            | Description    |
| ------------ | --------------- | -------------- |
| `tokenId`    | uint256         | ID of the NFT  |
| `parameters` | TokenParameters | KYC parameters |

### mint

```solidity
function mint(address to, TokenParameters memory parameters) public
```

Mints a KYC NFT and stores the KYC Metadata.

{% hint style="info" %}
This method can only be called by address with **MINTER\_ROLE**.
{% endhint %}

**Call Parameters:**

| Name         | Type            | Description         |
| ------------ | --------------- | ------------------- |
| `to`         | address         | address of the user |
| `parameters` | TokenParameters | KYC parameters      |

### batch

```solidity
function batch(address[] memory users, TokenParameters[] memory parameters) external
```

Mints several KYC NFTs in one transaction.&#x20;

{% hint style="info" %}
This method can only be called by address with **MINTER\_ROLE**.
{% endhint %}

**Call Parameters:**

| Name         | Type               | Description             |
| ------------ | ------------------ | ----------------------- |
| `users`      | address\[]         | list of users addresses |
| `parameters` | TokenParameters\[] | list of KYC parameters  |
