# Evoq

[GitHub Code](https://github.com/evoqfinance/evoq-finance-contracts/blob/main/src/Evoq.sol)

Entrypoint of the Evoq Protocol built on top of Venus Protocol.

### Functions[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#functions) <a href="#functions" id="functions"></a>

#### supply[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#supply) <a href="#supply" id="supply"></a>

```
function supply(
    address _poolToken,
    uint256 _amount
) external;
```

Creates a supply position for the sender. `msg.sender` must have approved Evoq's contract to spend the underlying `_amount`.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters)

| Name         | Type    | Description                                                |
| ------------ | ------- | ---------------------------------------------------------- |
| `_poolToken` | address | The address of the market the user wants to interact with. |
| `_amount`    | uint256 | The amount of token (in underlying) to supply.             |

#### supply on behalf[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#supply-on-behalf) <a href="#supply-on-behalf" id="supply-on-behalf"></a>

```
function supply(
    address _poolToken,
    address _onBehalf,
    uint256 _amount
) external;
```

Creates a supply position for a given user, spending sender tokens. `msg.sender` must have approved Evoq's contract to spend the underlying `_amount`.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-1)

| Name         | Type    | Description                                                 |
| ------------ | ------- | ----------------------------------------------------------- |
| `_poolToken` | address | The address of the market the user wants to interact with.  |
| `_onBehalf`  | address | The address of the account whose positions will be updated. |
| `_amount`    | uint256 | The amount of token (in underlying) to supply.              |

#### supply on behalf with matching management[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#supply-on-behalf-with-matching-management) <a href="#supply-on-behalf-with-matching-management" id="supply-on-behalf-with-matching-management"></a>

```
function supply(
    address _poolToken,
    address _onBehalf,
    uint256 _amount,
    uint256 _maxGasForMatching
) external;
```

Creates a supply position for a given user, spending sender tokens, and controlling the gas consumed for matching. `msg.sender` must have approved Evoq's contract to spend the underlying `_amount`.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-2)

| Name                 | Type    | Description                                                 |
| -------------------- | ------- | ----------------------------------------------------------- |
| `_poolToken`         | address | The address of the market the user wants to interact with.  |
| `_onBehalf`          | address | The address of the account whose positions will be updated. |
| `_amount`            | uint256 | The amount of token (in underlying) to supply.              |
| `_maxGasForMatching` | uint256 | The gas threshold at which to stop the matching engine.     |

#### borrow[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#borrow) <a href="#borrow" id="borrow"></a>

```
function borrow(
    address _poolToken,
    uint256 _amount
) external;
```

Borrows underlying tokens from a specific market.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-3)

<table><thead><tr><th width="254">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>_poolToken</code></td><td>address</td><td>The address of the market the user wants to interact with.</td></tr><tr><td><code>_amount</code></td><td>uint256</td><td>The amount of token (in underlying) to borrow.</td></tr></tbody></table>

#### borrow[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#borrow) with borrower and receiver <a href="#borrow" id="borrow"></a>

```
function borrow(
    address _poolToken,
    uint256 _amount,
    address _borrower,
    address _receiver
) external;
```

Borrows underlying tokens from a specific market and set borrwer and receiver.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-3)

| Name         | Type    | Description                                                |
| ------------ | ------- | ---------------------------------------------------------- |
| `_poolToken` | address | The address of the market the user wants to interact with. |
| `_amount`    | uint256 | The amount of token (in underlying) to borrow.             |
| \_borrower   | address | The address of the borrower in debt.                       |
| \_receiver   | address | The address of the receiver of the borrowed asset.         |

#### borrow with matching management[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#borrow-with-matching-management) <a href="#borrow-with-matching-management" id="borrow-with-matching-management"></a>

```
function borrow(
    address _poolToken,
    uint256 _amount,
    address _borrower,
    address _receiver,
    uint256 _maxGasForMatching
) external;
```

Borrows underlying tokens from a specific market, by controlling the gas consumed for matching.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-4)

| Name                 | Type    | Description                                                |
| -------------------- | ------- | ---------------------------------------------------------- |
| `_poolToken`         | address | The address of the market the user wants to interact with. |
| `_amount`            | uint256 | The amount of token (in underlying) to borrow.             |
| \_borrower           | address | The address of the borrower in debt.                       |
| \_receiver           | address | The address of the receiver of the borrowed asset.         |
| `_maxGasForMatching` | uint256 | The gas threshold at which to stop the matching engine.    |

#### withdraw[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#withdraw) <a href="#withdraw" id="withdraw"></a>

```
function withdraw(
    address _poolToken,
    uint256 _amount
) external;
```

Withdraws underlying tokens from a specific market.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-5)

| Name         | Type    | Description                                                |
| ------------ | ------- | ---------------------------------------------------------- |
| `_poolToken` | address | The address of the market the user wants to interact with. |
| `_amount`    | uint256 | The amount of token (in underlying) to withdraw.           |

#### withdraw to a specific user[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#withdraw-to-a-specific-user) <a href="#withdraw-to-a-specific-user" id="withdraw-to-a-specific-user"></a>

```
function withdraw(
    address _poolToken,
    uint256 _amount,
    address _supplier,
    address _receiver
) external;
```

Withdraws underlying tokens from a specific market to a given user.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-6)

| Name         | Type    | Description                                                |
| ------------ | ------- | ---------------------------------------------------------- |
| `_poolToken` | address | The address of the market the user wants to interact with. |
| `_amount`    | uint256 | The amount of token (in underlying) to withdraw.           |
| \_supplier   | address | The address that supplied the tokens.                      |
| `_receiver`  | address | The address to send withdrawn tokens to.                   |

#### repay[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#repay) <a href="#repay" id="repay"></a>

```
function repay(
    address _poolToken,
    uint256 _amount
) external;
```

Repays underlying tokens from a specific market.

`msg.sender` must have approved Evoq's contract to spend the underlying `_amount`.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-7)

| Name         | Type    | Description                                                |
| ------------ | ------- | ---------------------------------------------------------- |
| `_poolToken` | address | The address of the market the user wants to interact with. |
| `_amount`    | uint256 | The amount of token (in underlying) to repay from borrow.  |

#### repay on behalf[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#repay-on-behalf) <a href="#repay-on-behalf" id="repay-on-behalf"></a>

```
function repay(
    address _poolToken,
    address _onBehalf,
    uint256 _amount
) external;
```

Repays underlying tokens from a specific market to a given user.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-8)

| Name         | Type    | Description                                                 |
| ------------ | ------- | ----------------------------------------------------------- |
| `_poolToken` | address | The address of the market the user wants to interact with.  |
| `_onBehalf`  | address | The address of the account whose positions will be updated. |
| `_amount`    | uint256 | The amount of token (in underlying) to repay from borrow.   |

#### liquidate[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#liquidate) <a href="#liquidate" id="liquidate"></a>

```
function liquidate(
    address _poolTokenBorrowed,
    address _poolTokenCollateral,
    address _borrower,
    uint256 _amount
) external;
```

Liquidates a position.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-9)

| Name                   | Type    | Description                                                             |
| ---------------------- | ------- | ----------------------------------------------------------------------- |
| `_poolTokenBorrowed`   | address | The address of the pool token the liquidator wants to repay.            |
| `_poolTokenCollateral` | address | The address of the collateral pool token the liquidator wants to seize. |
| `_borrower`            | address | The address of the borrower to liquidate.                               |
| `_amount`              | uint256 | The amount of token (in underlying) to repay.                           |

#### claimRewards[​](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#claimrewards) <a href="#claimrewards" id="claimrewards"></a>

```
function claimRewards(address[] calldata _vTokenAddresses, bool)
        external
        returns (uint256 amountOfRewards);
```

Claims rewards from the underlying pool.

This function is specific to Evoq.

**Parameters:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#parameters-10)

| Name               | Type       | Description                                         |
| ------------------ | ---------- | --------------------------------------------------- |
| `_vTokenAddresses` | address\[] | The addresses of the vTokens to claim rewards from. |

**Return values:**[**​**](https://docs.morpho.org/morpho-optimizers/contracts/morpho-optimizers-aave-compound-v2/morpho#return-values)

| Name              | Type    | Description                                       |
| ----------------- | ------- | ------------------------------------------------- |
| `amountOfRewards` | uint256 | The amount of rewards claimed (in XVS for Venus). |
