# IMaverickV2IncentiveMatcherFactory

### Functions <a href="#functions" id="functions"></a>

#### incentiveMatcherParameters <a href="#incentivematcherparameters" id="incentivematcherparameters"></a>

```solidity
function incentiveMatcherParameters()
    external
    view
    returns (IERC20 baseToken, IMaverickV2VotingEscrow veToken, IMaverickV2RewardFactory factory);
```

#### veFactory <a href="#vefactory" id="vefactory"></a>

This function retrieves the address of the MaverickV2VotingEscrowFactory contract.

```solidity
function veFactory() external view returns (IMaverickV2VotingEscrowFactory);
```

**Returns**

| Name     | Type                             | Description                                                |
| -------- | -------------------------------- | ---------------------------------------------------------- |
| `<none>` | `IMaverickV2VotingEscrowFactory` | The address of the MaverickV2VotingEscrowFactory contract. |

#### rewardFactory <a href="#rewardfactory" id="rewardfactory"></a>

This function retrieves the address of the MaverickV2RewardFactory contract.

```solidity
function rewardFactory() external view returns (IMaverickV2RewardFactory);
```

**Returns**

| Name     | Type                       | Description                                          |
| -------- | -------------------------- | ---------------------------------------------------- |
| `<none>` | `IMaverickV2RewardFactory` | The address of the MaverickV2RewardFactory contract. |

#### isFactoryIncentiveMatcher <a href="#isfactoryincentivematcher" id="isfactoryincentivematcher"></a>

This function checks if the current contract is a factory contract for IncentiveMatchers.

```solidity
function isFactoryIncentiveMatcher(IMaverickV2IncentiveMatcher incentiveMatcher)
    external
    view
    returns (bool isFactoryContract);
```

**Parameters**

| Name               | Type                          | Description                                                 |
| ------------------ | ----------------------------- | ----------------------------------------------------------- |
| `incentiveMatcher` | `IMaverickV2IncentiveMatcher` | The address of the corresponding IncentiveMatcher contract. |

**Returns**

| Name                | Type   | Description                                                  |
| ------------------- | ------ | ------------------------------------------------------------ |
| `isFactoryContract` | `bool` | True if the contract is a factory contract, False otherwise. |

#### incentiveMatcherForVe <a href="#incentivematcherforve" id="incentivematcherforve"></a>

This function retrieves the address of the IncentiveMatcher contract associated with the current veToken.

```solidity
function incentiveMatcherForVe(IMaverickV2VotingEscrow veToken)
    external
    view
    returns (IMaverickV2IncentiveMatcher incentiveMatcher);
```

**Parameters**

| Name      | Type                      | Description                         |
| --------- | ------------------------- | ----------------------------------- |
| `veToken` | `IMaverickV2VotingEscrow` | The voting escrow token to look up. |

**Returns**

| Name               | Type                          | Description                                                 |
| ------------------ | ----------------------------- | ----------------------------------------------------------- |
| `incentiveMatcher` | `IMaverickV2IncentiveMatcher` | The address of the corresponding IncentiveMatcher contract. |

#### createIncentiveMatcher <a href="#createincentivematcher" id="createincentivematcher"></a>

This function creates a new IncentiveMatcher contract for a given base token. The basetoken is required to have a deployed ve token before incentive matcher can be created. If no ve token exists, this function will revert. A ve token can be created with the ve token factory: `veFactory()`.

```solidity
function createIncentiveMatcher(IERC20 baseToken)
    external
    returns (IMaverickV2VotingEscrow veToken, IMaverickV2IncentiveMatcher incentiveMatcher);
```

**Parameters**

| Name        | Type     | Description                                  |
| ----------- | -------- | -------------------------------------------- |
| `baseToken` | `IERC20` | The base token for the new IncentiveMatcher. |

**Returns**

| Name               | Type                          | Description                                                 |
| ------------------ | ----------------------------- | ----------------------------------------------------------- |
| `veToken`          | `IMaverickV2VotingEscrow`     | The voting escrow token for the IncentiveMatcher.           |
| `incentiveMatcher` | `IMaverickV2IncentiveMatcher` | The address of the newly created IncentiveMatcher contract. |

#### incentiveMatchers <a href="#incentivematchers" id="incentivematchers"></a>

This function retrieves a list of existing IncentiveMatcher contracts.

```solidity
function incentiveMatchers(uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2IncentiveMatcher[] memory returnElements);
```

**Parameters**

| Name         | Type      | Description                                 |
| ------------ | --------- | ------------------------------------------- |
| `startIndex` | `uint256` | The starting index of the list to retrieve. |
| `endIndex`   | `uint256` | The ending index of the list to retrieve.   |

**Returns**

| Name             | Type                            | Description                                                        |
| ---------------- | ------------------------------- | ------------------------------------------------------------------ |
| `returnElements` | `IMaverickV2IncentiveMatcher[]` | An array of IncentiveMatcher contracts within the specified range. |

#### incentiveMatchersLength <a href="#incentivematcherslength" id="incentivematcherslength"></a>

This function returns the total number of existing IncentiveMatcher contracts.

```solidity
function incentiveMatchersLength() external view returns (uint256 length);
```

#### incentiveMatcherAddress <a href="#incentivematcheraddress" id="incentivematcheraddress"></a>

This function retrieves the address of the IncentiveMatcher contract associated with a given veToken.

```solidity
function incentiveMatcherAddress(IMaverickV2VotingEscrow veToken)
    external
    view
    returns (IMaverickV2IncentiveMatcher incentiveMatcher);
```

**Parameters**

| Name      | Type                      | Description                                                                       |
| --------- | ------------------------- | --------------------------------------------------------------------------------- |
| `veToken` | `IMaverickV2VotingEscrow` | The voting escrow token for which to retrieve the corresponding IncentiveMatcher. |

**Returns**

| Name               | Type                          | Description                                                               |
| ------------------ | ----------------------------- | ------------------------------------------------------------------------- |
| `incentiveMatcher` | `IMaverickV2IncentiveMatcher` | The address of the IncentiveMatcher contract associated with the veToken. |

### Errors <a href="#errors" id="errors"></a>

#### VotingEscrowTokenDoesNotExists <a href="#votingescrowtokendoesnotexists" id="votingescrowtokendoesnotexists"></a>

```solidity
error VotingEscrowTokenDoesNotExists(IERC20 baseToken);
```

### Structs <a href="#structs" id="structs"></a>

#### IncentiveMatcherParameters <a href="#incentivematcherparameters-1" id="incentivematcherparameters-1"></a>

```solidity
struct IncentiveMatcherParameters {
    IERC20 baseToken;
    IMaverickV2VotingEscrow veToken;
    IMaverickV2RewardFactory factory;
}
```

<br>
