Comprehensive guide for staking with Uniswap V3 part 1

By Markely

Table of Contents

Comprehensive guide for staking with Uniswap V3

Introduction

As a part of the third version of the protocol ( Uniswap V3 ) features, Uniswap has introduced a Staking as a Service set of smart contracts to enable protocols to launch liquidity mining programs. These programs aim to boost the liquidity provided within the Uniswap V3 pair pool and reward the stakers. While the smart contracts have been up and running for more than 6 months, Uniswap has not provided an interface to launch, manage or stake the tokens. In this guide, we will walk you through the entire process, so you and your team can launch a staking program today. For reference, you can also read the Uniswap’s high-level overview of the staking program so you can be familiar with the terms.

Short about Uniswap V3

Like we all know, in V3 of Uniswap the concept of liquidity pools remained the same. What has changed, is that Liquidity providers will not receive LP tokens in proportion to the provided liquidity. Instead, they introduced a new concept where the information about liquidity is stored in an NFT position (ERC721) token that is minted upon deposit. This NFT stores information about how much liquidity has been deposited, who is the owner and what are the lower and upper price ticks. If you’d like to know more about it, make sure to check the introduction article by Uniswap.

Staking Uniswap V3 liquidity tokens (NFTs)

When browsing over the internet for ways to use their Staking contracts, you will most likely find their own guide for developers . But, as stated by the Uniswap themselves, “A technical guide for interacting with this staking contract will be released soon”. Instead of waiting for their guide, the Holdex team has prepared its own Uniswap V3 staking guide, based on our team’s experience and best practices.

Important notes: The links and contract addresses in this guide are for the Rinkeby network. You might need to browse for Mainnet addresses in the Uniswap repository.

Before proceeding with staking, you must provide liquidity to your pair pool and receive the NFT position. To do it, head to the Uniswap application . If you don’t have a pool yet, Uniswap will automatically create one for you when you provide liquidity for the first time.

Incentive program

What is an incentive program?

The entire Uniswap V3 stake revolves around incentive programs. It represents your liquidity mining program or staking instance inside their smart-contracts. Incentive program is like a pool with a limited amount of tokens to distribute in which staking takes place.

Deploying incentive program

You won't have to build your own interface to deploy an incentive program or conclude it. Since these are just administrator actions, the Etherscan’s interface will be sufficient to cover creation of the program.

Note: You can’t create multiple Incentive Programs for the same Uniswap V3 Pool Pair. To create a new one, you will have to wait for the other to end.

To deploy an incentive program, you will need the following things prepared:

  1. Your ERC20 tokens address - rewardToken
  2. Uniswap V3 pair pool address - pool
  3. Start date in Unix timestamp - startTime
  4. End date in Unix timestamp - endTime
  5. Refundee address - refundee
  6. Tokens on your wallet that you will transfer in your Incentive program for distribution.
  7. Approve the amount of tokens you are about to transfer into Staker contract.

How to find your Uniswap V3 pair pool address?

1. Find the transaction responsible for the Uniswap V3 pool creation

2. Open the logs tab and search the following information

3. Open the Uniswap V3 PoolFactory contract in a new tab and switch to Read contract

4. Copy the information from Step 2 into the getPool tab

5. Click Query and view the pool address

How to approve token transfer

Before you can create your Incentive program, you must approve the token transfer into the Staker contract. Otherwise, the createIncentive transaction will fail.

  1. Open your token contract in Etherscan and switch to Write Contract tab
  2. Connect your wallet
  3. Find the approve transaction and complete the following information
  4. _spender - the Staker contract address
  5. _value - the amount of token you want to use for the incentive program in Wei.
  6. Click Write and submit the transaction. Once successfully executed, you can proceed with the next step.

Create incentive

Back to the Incentive program, you’ll need to follow the next steps for successful deployment:

  1. Open Uniswap V3 Staker contract in Etherscan and switch to Write contract
  2. Connect your wallet
  3. Find the createIncentive tab and write the addresses you prepared in the beginning of this guide, in the following order

["REWARD_TOKEN_ADDRESS","POOL_ADDRESS",START_DATE,END_DATE,"REFUNDEE_ADDRESS"]

Make sure the addresses are written between quotation marks.

  1. In the reward input write the amount of tokens you want to distribute. The value must be written in Wei depending on your token decimals. Use this handy Unit Converter to convert from regular numbers into Wei.
  2. Click Write and follow the instructions in your wallet.

Example:

Congrats! You have successfully deployed your Incentive program.

Contact Us

We’d love to hear from you on discussing potential projects, intriguing ideas, and new opportunities.