# IMaverickV2RewardFactory

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

#### createRewardsContract <a href="#createrewardscontract" id="createrewardscontract"></a>

This function creates a new MaverickV2Reward contract associated with a specific stake token contract and set of reward and voting escrow tokens.

```solidity
function createRewardsContract(
    IERC20 stakeToken,
    IERC20[] memory rewardTokens,
    IMaverickV2VotingEscrow[] memory veTokens
) external returns (IMaverickV2Reward rewardsContract);
```

**Parameters**

| Name           | Type                        | Description                                                                                               |
| -------------- | --------------------------- | --------------------------------------------------------------------------------------------------------- |
| `stakeToken`   | `IERC20`                    | Token to be staked in reward contract; e.g. a boosted position contract.                                  |
| `rewardTokens` | `IERC20[]`                  | An array of IERC20 token addresses representing the available reward tokens.                              |
| `veTokens`     | `IMaverickV2VotingEscrow[]` | An array of IMaverickV2VotingEscrow contract addresses representing the associated veTokens for boosting. |

**Returns**

| Name              | Type                | Description                                   |
| ----------------- | ------------------- | --------------------------------------------- |
| `rewardsContract` | `IMaverickV2Reward` | The newly created IMaverickV2Reward contract. |

#### boostedPositionFactory <a href="#boostedpositionfactory" id="boostedpositionfactory"></a>

This function retrieves the address of the MaverickV2BoostedPositionFactory contract.

```solidity
function boostedPositionFactory() external returns (IMaverickV2BoostedPositionFactory);
```

**Returns**

| Name     | Type                                | Description                                                            |
| -------- | ----------------------------------- | ---------------------------------------------------------------------- |
| `<none>` | `IMaverickV2BoostedPositionFactory` | factory The address of the IMaverickV2BoostedPositionFactory contract. |

#### votingEscrowFactory <a href="#votingescrowfactory" id="votingescrowfactory"></a>

This function retrieves the address of the MaverickV2VotingEscrowFactory contract.

```solidity
function votingEscrowFactory() external returns (IMaverickV2VotingEscrowFactory);
```

**Returns**

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

#### isFactoryContract <a href="#isfactorycontract" id="isfactorycontract"></a>

This function checks if a provided IMaverickV2Reward contract is a valid contract created by this factory.

```solidity
function isFactoryContract(IMaverickV2Reward reward) external returns (bool);
```

**Parameters**

| Name     | Type                | Description                              |
| -------- | ------------------- | ---------------------------------------- |
| `reward` | `IMaverickV2Reward` | The IMaverickV2Reward contract to check. |

**Returns**

| Name     | Type   | Description                                                                                         |
| -------- | ------ | --------------------------------------------------------------------------------------------------- |
| `<none>` | `bool` | isFactoryContract True if the contract is a valid factory-created reward contract, False otherwise. |

#### rewardsForStakeToken <a href="#rewardsforstaketoken" id="rewardsforstaketoken"></a>

This function retrieves a list of all MaverickV2Reward contracts associated with a specific staking token contract within a specified range.

```solidity
function rewardsForStakeToken(IERC20 stakeToken, uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2Reward[] memory rewardsContract);
```

**Parameters**

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

**Returns**

| Name              | Type                  | Description                                                                                             |
| ----------------- | --------------------- | ------------------------------------------------------------------------------------------------------- |
| `rewardsContract` | `IMaverickV2Reward[]` | An array of IMaverickV2Reward contracts associated with the BoostedPosition within the specified range. |

#### rewards <a href="#rewards" id="rewards"></a>

This function retrieves a list of all MaverickV2Reward contracts within a specified range.

```solidity
function rewards(uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2Reward[] memory rewardsContract);
```

**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                                                         |
| ----------------- | --------------------- | ------------------------------------------------------------------- |
| `rewardsContract` | `IMaverickV2Reward[]` | An array of IMaverickV2Reward contracts within the specified range. |

#### boostedPositionRewards <a href="#boostedpositionrewards" id="boostedpositionrewards"></a>

This function retrieves a list of all MaverickV2Reward contracts within a specified range that have a staking token that is a boosted position from the maverick boosted position contract.

```solidity
function boostedPositionRewards(uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2Reward[] memory);
```

**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                                                                         |
| -------- | --------------------- | ----------------------------------------------------------------------------------- |
| `<none>` | `IMaverickV2Reward[]` | rewardsContract An array of IMaverickV2Reward contracts within the specified range. |

#### nonBoostedPositionRewards <a href="#nonboostedpositionrewards" id="nonboostedpositionrewards"></a>

This function retrieves a list of all MaverickV2Reward contracts within a specified range that have a staking token that is not a boosted position from the maverick boosted position contract.

```solidity
function nonBoostedPositionRewards(uint256 startIndex, uint256 endIndex)
    external
    view
    returns (IMaverickV2Reward[] memory);
```

**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                                                                         |
| -------- | --------------------- | ----------------------------------------------------------------------------------- |
| `<none>` | `IMaverickV2Reward[]` | rewardsContract An array of IMaverickV2Reward contracts within the specified range. |

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

#### RewardFactoryNotFactoryBoostedPosition <a href="#rewardfactorynotfactoryboostedposition" id="rewardfactorynotfactoryboostedposition"></a>

```solidity
error RewardFactoryNotFactoryBoostedPosition();
```

#### RewardFactoryTooManyRewardTokens <a href="#rewardfactorytoomanyrewardtokens" id="rewardfactorytoomanyrewardtokens"></a>

```solidity
error RewardFactoryTooManyRewardTokens();
```

#### RewardFactoryRewardAndVeLengthsAreNotEqual <a href="#rewardfactoryrewardandvelengthsarenotequal" id="rewardfactoryrewardandvelengthsarenotequal"></a>

```solidity
error RewardFactoryRewardAndVeLengthsAreNotEqual();
```

#### RewardFactoryInvalidVeBaseTokenPair <a href="#rewardfactoryinvalidvebasetokenpair" id="rewardfactoryinvalidvebasetokenpair"></a>

```solidity
error RewardFactoryInvalidVeBaseTokenPair();
```
