DragonswapV2Staker

Below is the technical reference for the staker contract, DragonswapV2Staker.sol. A technical guide for interacting with this staking contract will be released soon.

Functions

stakes

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

Returns information about a staked liquidity NFT

Parameters:

Return Values:

constructor

  function constructor(
    contract IDragonswapV2Factory _factory,
    contract INonfungiblePositionManager _nonfungiblePositionManager,
    uint256 _maxIncentiveStartLeadTime,
    uint256 _maxIncentiveDuration
  ) public

Parameters:

createIncentive

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

Creates a new liquidity mining incentive program

Parameters:

endIncentive

  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:

Return Values:

onERC721Received

  function onERC721Received(
  ) external returns (bytes4)

Upon receiving a DragonswapV2 ERC721, creates the token deposit setting owner to from. Also stakes token in one or more incentives if properly formatted data has a length > 0.

Whenever an {IERC721} tokenId token is transferred to this contract via {IERC721-safeTransferFrom} by operator from from, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with IERC721.onERC721Received.selector.

transferDeposit

  function transferDeposit(
    uint256 tokenId,
    address to
  ) external

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

Parameters:

withdrawToken

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

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

Parameters:

stakeToken

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

Stakes a DragonswapV2 LP token

Parameters:

unstakeToken

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

Unstakes a DragonswapV2 LP token

Parameters:

claimReward

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

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

Parameters:

Return Values:

getRewardInfo

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

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

Parameters:

Return Values:

Last updated