# IDragonswapV2Staker

Allows staking nonfungible liquidity tokens in exchange for reward tokens

### Functions[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#functions) <a href="#functions" id="functions"></a>

#### factory[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#factory) <a href="#factory" id="factory"></a>

```solidity
  function factory(
  ) external view returns (contract IDragonswapV2Factory)
```

The DragonswapV2 Factory

#### nonfungiblePositionManager[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#nonfungiblepositionmanager) <a href="#nonfungiblepositionmanager" id="nonfungiblepositionmanager"></a>

```solidity
  function nonfungiblePositionManager(
  ) external view returns (contract INonfungiblePositionManager)
```

The nonfungible position manager with which this staking contract is compatible

#### maxIncentiveDuration[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#maxincentiveduration) <a href="#maxincentiveduration" id="maxincentiveduration"></a>

```solidity
  function maxIncentiveDuration(
  ) external view returns (uint256)
```

The max duration of an incentive in seconds

#### maxIncentiveStartLeadTime[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#maxincentivestartleadtime) <a href="#maxincentivestartleadtime" id="maxincentivestartleadtime"></a>

```solidity
  function maxIncentiveStartLeadTime(
  ) external view returns (uint256)
```

The max amount of seconds into the future the incentive startTime can be set

#### incentives[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#incentives) <a href="#incentives" id="incentives"></a>

```solidity
  function incentives(
    bytes32 incentiveId
  ) external view returns (uint256 totalRewardUnclaimed, uint160 totalSecondsClaimedX128, uint96 numberOfStakes)
```

Represents a staking incentive

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters)

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| `incentiveId` | bytes32 | The ID of the incentive computed from its parameters |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#return-values)

| Name                      | Type    | Description                                                       |
| ------------------------- | ------- | ----------------------------------------------------------------- |
| `totalRewardUnclaimed`    | uint256 | The amount of reward token not yet claimed by users               |
| `totalSecondsClaimedX128` | uint160 | Total liquidity-seconds claimed, represented as a UQ32.128        |
| `numberOfStakes`          | uint96  | The count of deposits that are currently staked for the incentive |

#### deposits[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#deposits) <a href="#deposits" id="deposits"></a>

```
  function deposits(
  ) external view returns (address owner, uint48 numberOfStakes, int24 tickLower, int24 tickUpper)
```

Returns information about a deposited NFT

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#return-values-1)

| Name             | Type    | Description                                                      |
| ---------------- | ------- | ---------------------------------------------------------------- |
| `owner`          | address | The owner of the deposited NFT                                   |
| `numberOfStakes` | uint48  | Counter of how many incentives for which the liquidity is staked |
| `tickLower`      | int24   | The lower tick of the range                                      |
| `tickUpper`      | int24   | The upper tick of the range                                      |

#### stakes[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#stakes) <a href="#stakes" id="stakes"></a>

```
  function stakes(
    uint256 tokenId,
    bytes32 incentiveId
  ) external view returns (uint160 secondsPerLiquidityInsideInitialX128, uint128 liquidity)
```

Returns information about a staked liquidity NFT

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-1)

| Name          | Type    | Description                                           |
| ------------- | ------- | ----------------------------------------------------- |
| `tokenId`     | uint256 | The ID of the staked token                            |
| `incentiveId` | bytes32 | The ID of the incentive for which the token is staked |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#return-values-2)

| Name                                   | Type    | Description                                                                      |
| -------------------------------------- | ------- | -------------------------------------------------------------------------------- |
| `secondsPerLiquidityInsideInitialX128` | uint160 | secondsPerLiquidity represented as a UQ32.128                                    |
| `liquidity`                            | uint128 | The amount of liquidity in the NFT as of the last time the rewards were computed |

#### rewards[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#rewards) <a href="#rewards" id="rewards"></a>

```
  function rewards(
    contract IERC20Minimal rewardToken,
    address owner
  ) external view returns (uint256 rewardsOwed)
```

Returns amounts of reward tokens owed to a given address according to the last time all stakes were updated

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-2)

| Name          | Type                   | Description                                      |
| ------------- | ---------------------- | ------------------------------------------------ |
| `rewardToken` | contract IERC20Minimal | The token for which to check rewards             |
| `owner`       | address                | The owner for which the rewards owed are checked |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#return-values-3)

| Name          | Type    | Description                                           |
| ------------- | ------- | ----------------------------------------------------- |
| `rewardsOwed` | uint256 | The amount of the reward token claimable by the owner |

#### createIncentive[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#createincentive) <a href="#createincentive" id="createincentive"></a>

```
  function createIncentive(
    struct IDragonswapV2Staker.IncentiveKey key,
    uint256 reward
  ) external
```

Creates a new liquidity mining incentive program

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-3)

| Name     | Type                                    | Description                                   |
| -------- | --------------------------------------- | --------------------------------------------- |
| `key`    | struct IDragonswapV2Staker.IncentiveKey | Details of the incentive to create            |
| `reward` | uint256                                 | The amount of reward tokens to be distributed |

#### endIncentive[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#endincentive) <a href="#endincentive" id="endincentive"></a>

```
  function endIncentive(
    struct IDragonswapV2Staker.IncentiveKey key
  ) external returns (uint256 refund)
```

Ends an incentive after the incentive end time has passed and all stakes have been withdrawn

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-4)

| Name  | Type                                    | Description                     |
| ----- | --------------------------------------- | ------------------------------- |
| `key` | struct IDragonswapV2Staker.IncentiveKey | Details of the incentive to end |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#return-values-4)

| Name     | Type    | Description                                             |
| -------- | ------- | ------------------------------------------------------- |
| `refund` | uint256 | The remaining reward tokens when the incentive is ended |

#### transferDeposit[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#transferdeposit) <a href="#transferdeposit" id="transferdeposit"></a>

```
  function transferDeposit(
    uint256 tokenId,
    address to
  ) external
```

Transfers ownership of a deposit from the sender to the given recipient

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-5)

| Name      | Type    | Description                                       |
| --------- | ------- | ------------------------------------------------- |
| `tokenId` | uint256 | The ID of the token (and the deposit) to transfer |
| `to`      | address | The new owner of the deposit                      |

#### withdrawToken[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#withdrawtoken) <a href="#withdrawtoken" id="withdrawtoken"></a>

```
  function withdrawToken(
    uint256 tokenId,
    address to,
    bytes data
  ) external
```

Withdraws a DragonswapV2 LP token `tokenId` from this contract to the recipient `to`

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-6)

| Name      | Type    | Description                                                                                       |
| --------- | ------- | ------------------------------------------------------------------------------------------------- |
| `tokenId` | uint256 | The unique identifier of an DragonswapV2 LP token                                                 |
| `to`      | address | The address where the LP token will be sent                                                       |
| `data`    | bytes   | An optional data array that will be passed along to the `to` address via the NFT safeTransferFrom |

#### stakeToken[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#staketoken) <a href="#staketoken" id="staketoken"></a>

```
  function stakeToken(
    struct IDragonswapV2Staker.IncentiveKey key,
    uint256 tokenId
  ) external
```

Stakes a DragonswapV2 LP token

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-7)

| Name      | Type                                    | Description                                         |
| --------- | --------------------------------------- | --------------------------------------------------- |
| `key`     | struct IDragonswapV2Staker.IncentiveKey | The key of the incentive for which to stake the NFT |
| `tokenId` | uint256                                 | The ID of the token to stake                        |

#### unstakeToken[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#unstaketoken) <a href="#unstaketoken" id="unstaketoken"></a>

```
  function unstakeToken(
    struct IDragonswapV2Staker.IncentiveKey key,
    uint256 tokenId
  ) external
```

Unstakes a DragonswapV2 LP token

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-8)

| Name      | Type                                    | Description                                           |
| --------- | --------------------------------------- | ----------------------------------------------------- |
| `key`     | struct IDragonswapV2Staker.IncentiveKey | The key of the incentive for which to unstake the NFT |
| `tokenId` | uint256                                 | The ID of the token to unstake                        |

#### claimReward[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#claimreward) <a href="#claimreward" id="claimreward"></a>

```
  function claimReward(
    contract IERC20Minimal rewardToken,
    address to,
    uint256 amountRequested
  ) external returns (uint256 reward)
```

Transfers `amountRequested` of accrued `rewardToken` rewards from the contract to the recipient `to`

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-9)

| Name              | Type                   | Description                                                                    |
| ----------------- | ---------------------- | ------------------------------------------------------------------------------ |
| `rewardToken`     | contract IERC20Minimal | The token being distributed as a reward                                        |
| `to`              | address                | The address where claimed rewards will be sent to                              |
| `amountRequested` | uint256                | The amount of reward tokens to claim. Claims entire reward amount if set to 0. |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#return-values-5)

| Name     | Type    | Description                         |
| -------- | ------- | ----------------------------------- |
| `reward` | uint256 | The amount of reward tokens claimed |

#### getRewardInfo[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#getrewardinfo) <a href="#getrewardinfo" id="getrewardinfo"></a>

```
  function getRewardInfo(
    struct IDragonswapV2Staker.IncentiveKey key,
    uint256 tokenId
  ) external returns (uint256 reward, uint160 secondsInsideX128)
```

Calculates the reward amount that will be received for the given stake

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-10)

| Name      | Type                                    | Description              |
| --------- | --------------------------------------- | ------------------------ |
| `key`     | struct IDragonswapV2Staker.IncentiveKey | The key of the incentive |
| `tokenId` | uint256                                 | The ID of the token      |

**Return Values:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#return-values-6)

| Name                | Type    | Description                                                    |
| ------------------- | ------- | -------------------------------------------------------------- |
| `reward`            | uint256 | The reward accrued to the NFT for the given incentive thus far |
| `secondsInsideX128` | uint160 | The seconds inside the tick range                              |

### Events[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#events) <a href="#events" id="events"></a>

#### IncentiveCreated[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#incentivecreated) <a href="#incentivecreated" id="incentivecreated"></a>

```
  event IncentiveCreated(
    contract IERC20Minimal rewardToken,
    contract IDragonswapV2Pool pool,
    uint256 startTime,
    uint256 endTime,
    address refundee,
    uint256 reward
  )
```

Event emitted when a liquidity mining incentive has been created

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-11)

| Name          | Type                       | Description                                                               |
| ------------- | -------------------------- | ------------------------------------------------------------------------- |
| `rewardToken` | contract IERC20Minimal     | The token being distributed as a reward                                   |
| `pool`        | contract IDragonswapV2Pool | The DragonswapV2 pool                                                     |
| `startTime`   | uint256                    | The time when the incentive program begins                                |
| `endTime`     | uint256                    | The time when rewards stop accruing                                       |
| `refundee`    | address                    | The address which receives any remaining reward tokens after the end time |
| `reward`      | uint256                    | The amount of reward tokens to be distributed                             |

#### IncentiveEnded[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#incentiveended) <a href="#incentiveended" id="incentiveended"></a>

```
  event IncentiveEnded(
    bytes32 incentiveId,
    uint256 refund
  )
```

Event that can be emitted when a liquidity mining incentive has ended

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-12)

| Name          | Type    | Description                          |
| ------------- | ------- | ------------------------------------ |
| `incentiveId` | bytes32 | The incentive which is ending        |
| `refund`      | uint256 | The amount of reward tokens refunded |

#### DepositTransferred[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#deposittransferred) <a href="#deposittransferred" id="deposittransferred"></a>

```
  event DepositTransferred(
    uint256 tokenId,
    address oldOwner,
    address newOwner
  )
```

Emitted when ownership of a deposit changes

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-13)

| Name       | Type    | Description                                                 |
| ---------- | ------- | ----------------------------------------------------------- |
| `tokenId`  | uint256 | The ID of the deposit (and token) that is being transferred |
| `oldOwner` | address | The owner before the deposit was transferred                |
| `newOwner` | address | The owner after the deposit was transferred                 |

#### TokenStaked[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#tokenstaked) <a href="#tokenstaked" id="tokenstaked"></a>

```
  event TokenStaked(
    uint256 tokenId,
    bytes32 liquidity,
    uint128 incentiveId
  )
```

Event emitted when a DragonswapV2 LP token has been staked

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-14)

| Name          | Type    | Description                                       |
| ------------- | ------- | ------------------------------------------------- |
| `tokenId`     | uint256 | The unique identifier of an DragonswapV2 LP token |
| `liquidity`   | bytes32 | The amount of liquidity staked                    |
| `incentiveId` | uint128 | The incentive in which the token is staking       |

#### TokenUnstaked[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#tokenunstaked) <a href="#tokenunstaked" id="tokenunstaked"></a>

```
  event TokenUnstaked(
    uint256 tokenId,
    bytes32 incentiveId
  )
```

Event emitted when a DragonswapV2 LP token has been unstaked

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-15)

| Name          | Type    | Description                                       |
| ------------- | ------- | ------------------------------------------------- |
| `tokenId`     | uint256 | The unique identifier of an DragonswapV2 LP token |
| `incentiveId` | bytes32 | The incentive in which the token is staking       |

#### RewardClaimed[​](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#rewardclaimed) <a href="#rewardclaimed" id="rewardclaimed"></a>

```
  event RewardClaimed(
    address to,
    uint256 reward
  )
```

Event emitted when a reward token has been claimed

**Parameters:**[**​**](https://docs.uniswap.org/contracts/v3/reference/periphery/staker/interfaces/IUniswapV3Staker#parameters-16)

| Name     | Type    | Description                                    |
| -------- | ------- | ---------------------------------------------- |
| `to`     | address | The address where claimed rewards were sent to |
| `reward` | uint256 | The amount of reward tokens claimed            |
