How to create a Uniswap V3 staking program

8

uniswap v3 staking guide

As a part of the third version of the protocol, the Uniswap team has introduced Staking as a Service. This Uniswap staking is a set of already deployed smart contracts which enable anyone to launch liquidity mining programs. These programs help to incentivize liquidity providers and eventually boost the provision of additional liquidity inside the Uniswap v3 pools.

While the smart contracts have been up and running for more than 6 months, the Uniswap team has not provided any user interface to launch, manage or stake LP tokens. This is why in this article we have decided to share our experience of launching the Uniswap Staking program and we are happy to walk you through these steps, so you can launch your own staking program today.

Short about Uniswap V3 🦄

As we know, the concept of Uniswap v3 liquidity pools has remained the same as in Uniswap v2. What has changed is that liquidity providers do not receive ERC20 tokens anymore. Instead, the Uniswap team has introduced a new concept where the information about liquidity is stored in NFT (ERC721) token, which is minted upon liquidity provision. The instance of this NFT token 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 learn more about Uniswap v3 liquidity tokens, make sure to check the Uniswap v3 introduction article.

Staking Uniswap v3 liquidity tokens (NFTs)

Before you begin

The links and contract addresses in this guide are for the Rinkeby network. When going into production, you will have to use Mainnet addresses.

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. You can also use Remix if you are familiar with it.

ℹ️ 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 existing one to end.

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

  1. rewardToken - your ERC20 tokens address
  2. pool - Uniswap V3 pair pool address
  3. startTime - start date in Unix timestamp
  4. endTime - end date in Unix timestamp
  5. refundee - refundee address
  6. reward - 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 the Staker contract.

How to find your Uniswap V3 pair pool address?

1. In the Etherscan find the Uniswap v3 pool creation transaction

uniswap v3 pool etherscan

2. Open the logs tab and search the following information

uniswap v3 pool creation transaction logs

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

find uniswap v3 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. Should be identical to reward amount from earlier.
  6. Click Write and submit the transaction. Once successfully executed, you can proceed with the next step.
approve ERC20 token spending

Create incentive

Moving forward 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 transaction 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.

4. 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.

5. Click Write and follow the instructions in your wallet.

Example:

create uniswap v3 staking incentive

Congrats! 🎉 If you have followed our guide closely, you have successfully deployed your Incentive program.

📬 Coming up next

In our next article, we are going to walk you through the staking process. You will learn how to query the information from the blockchain, what information the user interface should include and what are the criteria to claim rewards.

8

Reply
Popular In order Chat mode

No replies yet

Be the first one to reply to Holdex

Joined discussion
0
0
0