> For the complete documentation index, see [llms.txt](https://alchemix-finance.gitbook.io/v2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alchemix-finance.gitbook.io/v2/alchemictokenv2.md).

# AlchemicTokenV2

This is the contract for version two alchemic tokens.

## Functions

### constructor

```solidity
    function constructor() public;
```

### setFlashFee

```solidity
    function setFlashFee(uint256 newFee) external;
```

Sets the flash minting fee.

This function reverts if `msg.sender` is not an admin.

#### Parameters:

| Name     | Type    | Description             |
| -------- | ------- | ----------------------- |
| `newFee` | uint256 | The new flash mint fee. |

### mint

```solidity
    function mint(
        address recipient,
        uint256 amount
    ) external;
```

Mints tokens to `a recipient.`

This function reverts if `msg.sender` is not whitelisted. This function reverts if `msg.sender` is paused.

#### Parameters:

| Name        | Type    | Description                        |
| ----------- | ------- | ---------------------------------- |
| `recipient` | address | The address to mint the tokens to. |
| `amount`    | uint256 | The amount of tokens to mint.      |

### setWhitelist

```solidity
    function setWhitelist(
        address minter,
        bool state
    ) external;
```

Sets `minter` as whitelisted to mint.

This function reverts if `msg.sender` is not an admin.

#### Parameters:

| Name     | Type    | Description                                             |
| -------- | ------- | ------------------------------------------------------- |
| `minter` | address | The account to permit to mint.                          |
| `state`  | bool    | A flag indicating if the minter should be able to mint. |

### setSentinel

```solidity
    function setSentinel(address sentinel) external;
```

Sets `sentinel` as a sentinel.

This function reverts if `msg.sender` is not an admin.

#### Parameters:

| Name       | Type    | Description                       |
| ---------- | ------- | --------------------------------- |
| `sentinel` | address | The address to set as a sentinel. |

### pauseMinter

```solidity
    function pauseMinter(
        address minter,
        bool state
    ) external;
```

Pauses `minter` from minting tokens.

This function reverts if `msg.sender` is not a sentinel.

#### Parameters:

| Name     | Type    | Description                                                   |
| -------- | ------- | ------------------------------------------------------------- |
| `minter` | address | The address to set as paused or unpaused.                     |
| `state`  | bool    | A flag indicating if the minter should be paused or unpaused. |

### burn

```solidity
    function burn(uint256 amount) external;
```

Burns `amount` tokens from `msg.sender`.

#### Parameters:

| Name     | Type    | Description                        |
| -------- | ------- | ---------------------------------- |
| `amount` | uint256 | The amount of tokens to be burned. |

### burnFrom

```solidity
    function burnFrom(
        address account,
        uint256 amount
    ) external;
```

Destroys `amount` tokens from `account`, deducting from the caller's allowance.

#### Parameters:

| Name      | Type    | Description                       |
| --------- | ------- | --------------------------------- |
| `account` | address | The address the burn tokens from. |
| `amount`  | uint256 | The amount of tokens to burn.     |

### setMaxFlashLoan

```solidity
    function setMaxFlashLoan(uint256 _maxFlashLoanAmount) external;
```

Adjusts the maximum flashloan amount.

#### Parameters:

| Name                  | Type    | Description                   |
| --------------------- | ------- | ----------------------------- |
| `_maxFlashLoanAmount` | uint256 | The maximum flashloan amount. |

### maxFlashLoan

```solidity
    function maxFlashLoan(address token) public returns (uint256);
```

Gets the maximum amount to be flash loaned of a token.

#### Parameters:

| Name    | Type    | Description               |
| ------- | ------- | ------------------------- |
| `token` | address | The address of the token. |

#### Return Values:

| Name  | Type    | Description                                           |
| ----- | ------- | ----------------------------------------------------- |
| `The` | uint256 | maximum amount of `token` that can be flashed loaned. |

### flashFee

```solidity
    function flashFee(
        address token,
        uint256 amount
    ) public returns (uint256);
```

Gets the flash loan fee of `amount` of `token`.

#### Parameters:

| Name     | Type    | Description                          |
| -------- | ------- | ------------------------------------ |
| `token`  | address | The address of the token.\`          |
| `amount` | uint256 | The amount of `token` to flash mint. |

#### Return Values:

| Name  | Type    | Description     |
| ----- | ------- | --------------- |
| `The` | uint256 | flash loan fee. |

### flashLoan

```solidity
    function flashLoan(
        contract IERC3156FlashBorrower receiver,
        address token,
        uint256 amount,
        bytes data
    ) external returns (bool);
```

Performs a flash mint (called flash loan to confirm with ERC3156 standard).

#### Parameters:

| Name       | Type                           | Description                                             |
| ---------- | ------------------------------ | ------------------------------------------------------- |
| `receiver` | contract IERC3156FlashBorrower | The address which will receive the flash minted tokens. |
| `token`    | address                        | The address of the token to flash mint.                 |
| `amount`   | uint256                        | How much to flash mint.                                 |
| `data`     | bytes                          | ABI encoded data to pass to the receiver.               |

#### Return Values:

| Name | Type | Description                    |
| ---- | ---- | ------------------------------ |
| `If` | bool | the flash loan was successful. |

## Events

### Paused

```solidity
event Paused(
    address minter,
    bool state
)
```

An event which is emitted when a minter is paused from minting.

#### Parameters:

| Name                   | Type    | Description                                 |
| ---------------------- | ------- | ------------------------------------------- |
| `minter`               | address | The address of the minter which was paused. |
| ## SetFlashMintFee     |         |                                             |
| \`\`\`solidity         |         |                                             |
| event SetFlashMintFee( |         |                                             |

```
uint256 fee
```

)

````
An event which is emitted when the flash mint fee is updated.



### Parameters:
| Name                           | Type          | Description                                    |
| :----------------------------- | :------------ | :--------------------------------------------- |
|`fee`| uint256 | The new flash mint fee. |
## SetMaxFlashLoan
```solidity
event SetMaxFlashLoan(
    uint256 maxFlashLoan
)
````

An event which is emitted when the max flash loan is updated.

#### Parameters:

| Name           | Type    | Description             |
| -------------- | ------- | ----------------------- |
| `maxFlashLoan` | uint256 | The new max flash loan. |
