How to create a Uniswap V3 staking program

How to create a Uniswap V3 staking program

Learn how to configure and deploy your own Uniswap V3 staking program

By Mark Curchin

Have a suggestion?

Edit Article

While the smart contracts have been up and running since the summer 2021, the Uniswap team has not provided any user interface to launch, manage or stake LP tokens. This is why we have decided to share our experience of launching the Uniswap Staking program. In this article we will walk you through the steps necessary to launch your own Uniswap v3 staking program.

Before you begin

All the examples in this guide are made using Rinkeby testnet. If you want to play directly on the Mainnet, you will need to use the Mainnet addresses listed in the Uniswap repository.

Before proceeding with staking, you must provide liquidity to your liquidity 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 the Uniswap Staking incentive program?

The entire Uniswap v3 stake revolves around incentive programs. It represents your liquidity mining program or staking instance inside their smart contracts. An 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, Etherscan’s interface will be sufficient to cover the 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 current program to end.

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

  1. rewardToken - y our ERC20 tokens address
  2. pool - Uniswap v3 pair pool address
  3. startTime - s tart date in Unix timestamp
  4. endTime - e nd date in Unix timestamp
  5. refundee - refundee address
  6. t okens on your wallet that you will transfer to 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
  1. Open the logs tab and search the following information
  1. Open the Uniswap v3 PoolFactory contract in a new tab and switch to the Read the contract
  2. Copy the information from Step 2 into the getPool tab
  3. 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
    1. _spender - the Staker contract address
    2. _value - the amount of token you want to use for the incentive program in Wei.
  4. 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! 🎉 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 an interface for the users should include, and what is required to claim rewards.

Next: holdex.io/c/learn/...

#guide

Contact Us

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