DragonSwap
  • Getting Started
    • 👋Welcome to DragonSwap
    • 💰How to Create & Connect a Wallet
    • 🪙Approving Tokens
    • 🔴Sei V2 EVM
  • Guides
    • Trading
      • 💱How to Swap
      • 🎁How to Wrap SEI
      • 🎀How to Unwrap SEI
    • Liqudity Providers
      • 🌊How to Add Liquidity
      • ☔How to Remove Liquidity
      • 🏊How to Deploy New Pools
      • 📉Understanding Impermanent Loss
      • 🫗V2: Concentrated Liquidity Pools
      • 🤖Automated Liquidity Managers (ALM)
    • Farms
      • 🥕Depositing to Farm
      • 🧑‍🌾Withdrawing from Farm
      • 🪙Claiming Rewards
      • 🚀Boosted Farms
    • Predictions
      • 🔮How to use Predictions
      • 🧞How Predictions work?
      • ❓Predictions FAQ
    • Analytics
      • 🏊Pools
      • 🥕Farms
      • 🪙Tokens
  • DragonSwap Token
    • Token & Tokenomics
    • How to Stake
    • DragonSwap Points
    • Protocol Rewards
  • Resources
    • 💻Developer Resources
      • 📄Smart Contracts
        • DragonswapV1
          • Factory
          • Pair
          • Pair(ERC-20)
          • Library
          • Router
          • Audit
        • DragonswapV2
          • Core
            • DragonswapV2Factory
            • DragonswapV2Pool
            • DragonswapV2PoolDeployer
            • Interfaces
              • IERC20Minimal
              • IDragonswapV2Factory
              • IDragonswapV2Pool
              • IDragonswapV2PoolDeployer
              • Callbacks
                • IDragonswapV2FlashCallback
                • IDragonswapV2MintCallback
                • IDragonswapV2SwapCallback
              • Pool
                • IDragonswapV2PoolActions
                • IDragonswapV2PoolDerivedState
                • IDragonswapV2PoolEvents
                • IDragonswapV2PoolImmutables
                • IDragonswapV2PoolOwnerActions
                • IDragonswapV2PoolState
            • Libraries
              • BitMath
              • FixedPoint128
              • FixedPoint96
              • FullMath
              • LiquidityMath
              • LowGasSafeMath
              • Oracle
              • Position
              • SafeCast
              • SecondsOutside
              • SqrtPriceMath
              • SwapMath
              • Tick
              • TickBitmap
              • TickMath
              • TransferHelper
              • UnsafeMath
          • Periphery
            • Base
              • BlockTimestamp
              • ERC721Permit
              • LiquidityManagement
              • Multicall
              • PeripheryImmutableState
              • PeripheryPayments
              • PeripheryPaymentsWithFee
              • PoolInitializer
              • SelfPermit
            • Interfaces
              • IERC20Metadata
              • IERC721Permit
              • IMulticall
              • INonfungiblePositionManager
              • INonfungibleTokenPositionDescriptor
              • IPeripheryImmutableState
              • IPeripheryPayments
              • IPeripheryPaymentsWithFee
              • IPoolInitializer
              • IQuoter
              • IQuoterV2
              • ISelfPermit
              • ISwapRouter
              • ITickLens
              • IV2Migrator
              • External
                • IERC1271
                • IERC20PermitAllowed
                • IWSEI
            • Lens
              • Quoter
              • QuoterV2
              • TickLens
            • Libraries
              • Base64
              • BytesLib
              • CallbackValidation
              • ChainId
              • HexStrings
              • LiquidityAmounts
              • NFTDescriptor
              • NFTSVG
              • OracleLibrary
              • Path
              • PoolAddress
              • PoolTicksCounter
              • PositionKey
              • TransferHelper
            • NonfungiblePositionManager
            • NonfungibleTokenPositionDescriptor
            • SwapRouter
            • V2Migrator
            • Error Codes
          • Staker
            • Overview
            • DragonswapV2Staker
            • Interfaces
              • IDragonswapV2Staker
            • Libraries
              • IncentiveId
              • NFTPositionInfo
              • RewardMath
          • Smart Router
            • Base
              • ApproveAndCall
              • ImmutableState
              • MulticallExtended
              • OracleSlippage
              • PeripheryPaymentsExtended
              • PeripheryPaymentsWithFeeExtended
              • PeripheryValidationExtended
            • Interfaces
              • IApproveAndCall
              • IImmutableState
              • IMixedRouteQuoterV1
              • IMulticallExtended
              • IOracleSlippage
              • IPeripheryPaymentsExtended
              • IPeripheryPaymentsWithFeeExtended
              • IQuoter
              • IQuoterV2
              • ISwapRouter02
              • ITokenValidator
              • IV1SwapRouter
              • IV2SwapRouter
            • Lens
              • MixedRouteQuoterV1
              • Quoter
              • QuoterV2
              • TokenValidator
            • Libraries
              • Constants
              • DragonswapLibrary
              • PoolTicksCounter
            • V1SwapRouter
            • V2SwapRouter
            • SwapRouter02
          • Audit
    • ❣️Marketing Resources
      • 🚩Brand Guidelines
      • 😂Meme Library
      • 🤗DragonSwap Ambassador Program
  • FAQ
    • 📲Official Links
    • 📄Contract Addresses
      • DragonswapV1
      • DragonswapV2
      • Predictions
    • ✨Roadmap
    • 📄 Token Listing Policy
    • 🏛️ToS
Powered by GitBook
On this page
  • Functions​
  • Events​
  1. Resources
  2. Developer Resources
  3. Smart Contracts
  4. DragonswapV2
  5. Staker
  6. Interfaces

IDragonswapV2Staker

PreviousInterfacesNextLibraries

Last updated 9 months ago

Allows staking nonfungible liquidity tokens in exchange for reward tokens

Functions

factory

  function factory(
  ) external view returns (contract IDragonswapV2Factory)

The DragonswapV2 Factory

nonfungiblePositionManager

  function nonfungiblePositionManager(
  ) external view returns (contract INonfungiblePositionManager)

The nonfungible position manager with which this staking contract is compatible

maxIncentiveDuration

  function maxIncentiveDuration(
  ) external view returns (uint256)

The max duration of an incentive in seconds

maxIncentiveStartLeadTime

  function maxIncentiveStartLeadTime(
  ) external view returns (uint256)

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

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

Represents a staking incentive

Name
Type
Description

incentiveId

bytes32

The ID of the incentive computed from its parameters

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

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

Returns information about a deposited NFT

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

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

Returns information about a staked liquidity NFT

Name
Type
Description

tokenId

uint256

The ID of the staked token

incentiveId

bytes32

The ID of the incentive for which the token is staked

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

  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

Name
Type
Description

rewardToken

contract IERC20Minimal

The token for which to check rewards

owner

address

The owner for which the rewards owed are checked

Name
Type
Description

rewardsOwed

uint256

The amount of the reward token claimable by the owner

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

Creates a new liquidity mining incentive program

Name
Type
Description

key

struct IDragonswapV2Staker.IncentiveKey

Details of the incentive to create

reward

uint256

The amount of reward tokens to be distributed

  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

Name
Type
Description

key

struct IDragonswapV2Staker.IncentiveKey

Details of the incentive to end

Name
Type
Description

refund

uint256

The remaining reward tokens when the incentive is ended

  function transferDeposit(
    uint256 tokenId,
    address to
  ) external

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

Name
Type
Description

tokenId

uint256

The ID of the token (and the deposit) to transfer

to

address

The new owner of the deposit

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

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

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

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

Stakes a DragonswapV2 LP token

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

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

Unstakes a DragonswapV2 LP token

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

  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

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.

Name
Type
Description

reward

uint256

The amount of reward tokens claimed

  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

Name
Type
Description

key

struct IDragonswapV2Staker.IncentiveKey

The key of the incentive

tokenId

uint256

The ID of the token

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

  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

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

  event IncentiveEnded(
    bytes32 incentiveId,
    uint256 refund
  )

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

Name
Type
Description

incentiveId

bytes32

The incentive which is ending

refund

uint256

The amount of reward tokens refunded

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

Emitted when ownership of a deposit changes

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

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

Event emitted when a DragonswapV2 LP token has been staked

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

  event TokenUnstaked(
    uint256 tokenId,
    bytes32 incentiveId
  )

Event emitted when a DragonswapV2 LP token has been unstaked

Name
Type
Description

tokenId

uint256

The unique identifier of an DragonswapV2 LP token

incentiveId

bytes32

The incentive in which the token is staking

  event RewardClaimed(
    address to,
    uint256 reward
  )

Event emitted when a reward token has been claimed

Name
Type
Description

to

address

The address where claimed rewards were sent to

reward

uint256

The amount of reward tokens claimed

incentives

Parameters:

Return Values:

deposits

Return Values:

stakes

Parameters:

Return Values:

rewards

Parameters:

Return Values:

createIncentive

Parameters:

endIncentive

Parameters:

Return Values:

transferDeposit

Parameters:

withdrawToken

Parameters:

stakeToken

Parameters:

unstakeToken

Parameters:

claimReward

Parameters:

Return Values:

getRewardInfo

Parameters:

Return Values:

Events

IncentiveCreated

Parameters:

IncentiveEnded

Parameters:

DepositTransferred

Parameters:

TokenStaked

Parameters:

TokenUnstaked

Parameters:

RewardClaimed

Parameters:

💻
📄
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​