Skip to content

Instantly share code, notes, and snippets.

@M4cs
Created February 16, 2024 04:20
Show Gist options
  • Save M4cs/3838a9f8ce4e2da2405e529a50b8b2f8 to your computer and use it in GitHub Desktop.
Save M4cs/3838a9f8ce4e2da2405e529a50b8b2f8 to your computer and use it in GitHub Desktop.
Using the Basescan Contract for Manual Staking and Rewards

How to stake your $FRAME tokens using the Contract and Basescan

Pre-requisites:

  • Must have a WETH/FRAME LP position in the 1.00% Fee Pool
  • Must be able to connect to Basescan with your wallet that owns the LP

Values for UniswapV3Staking Contract:

Incentive Key:

["0x91F45aa2BdE7393e0AF1CC674FFE75d746b93567", "0x64b74c66b9BA60ca668b781289767AE7298F37Ae", 1708027200, 1723575600, "0x7dd39E3aC366D3c031ed84343377ceFbd5A9F47F"]

Encoded Incentive Data for safeTransferFrom:

0x00000000000000000000000091f45aa2bde7393e0af1cc674ffe75d746b9356700000000000000000000000064b74c66b9ba60ca668b781289767ae7298f37ae0000000000000000000000000000000000000000000000000000000065ce6d400000000000000000000000000000000000000000000000000000000066bbad300000000000000000000000007dd39e3ac366d3c031ed84343377cefbd5a9f47f

IncentiveID for reading from UniswapV3Staker:

0xdd170fdcc46c30aed5e7d95508cb0e4be4013c445b19f58657cbc26cbd929ea9

Helpful Links:

UniswapV3Staker Basescan

UniswapV3NFT Manager Basescan

Step 1: Depositing Your LP Tokens in the Staking Contract

Find the tokenID of the LP token you want to stake. This NFT must be a UniswapV3NFT that is for the WETH/FRAME 1% Fee pool. If it is not, you will not be able to earn rewards.

You can find the token ID of your NFT by going to the Uniswap V3 Pool on Base mainnet. Clicking on your position, and then on the NFT itself, you should see the ID like so:

Take this ID and go to the Uniswap V3 NFT contract here. Click Connect to Web3 at the top, and connect with the wallet holding the Uniswap LP NFT.

VERY IMPORTANT, MUST READ: Use safeTransferFrom, do NOT use transferFrom to transfer your NFT token to the contract. If you use transferFrom, your token and the liquidity/fees attached, will be lost FOREVER!!! We will not be able to recover it for you, so don't even ask!

Call the safeTransferFrom function with the following parameters:

Parameter Value Description
from address Your address holding the LP NFT
to address 0x42bE4D6527829FeFA1493e1fb9F3676d2425C3C1 - The UniswapV3Staker contract
tokenId number Your FRAME/WETH 1% LP NFT tokenID
data bytes See below

0x00000000000000000000000091f45aa2bde7393e0af1cc674ffe75d746b9356700000000000000000000000064b74c66b9ba60ca668b781289767ae7298f37ae0000000000000000000000000000000000000000000000000000000065ce6d400000000000000000000000000000000000000000000000000000000066bbad300000000000000000000000007dd39e3ac366d3c031ed84343377cefbd5a9f47f

This data is the encoded incentive information. THIS IS OPTIONAL, BUT IT SKIPS HAVING TO STAKE YOUR TOKEN AFTER THIS STEP, AND IMMEDIATELY STARTS STAKING IT WHEN YOU DEPOSIT THE TOKEN.

This is what your function values should look like, with your address and tokenID replaced:

image

Once you click Write, you should be staked and earning $FRAME automatically.

Step 2: Unstaking and Claiming Rewards

Unstaking LP Tokens

To unstake your staked LP tokens, go to the Uniswap V3 Staking contract on Basescan and connect with the wallet that staked the LP tokens.

Open up the unstakeToken function, and for the key, use the following value:

["0x91F45aa2BdE7393e0AF1CC674FFE75d746b93567", "0x64b74c66b9BA60ca668b781289767AE7298F37Ae", 1708027200, 1723575600, "0x7dd39E3aC366D3c031ed84343377ceFbd5A9F47F"]

The tokenId should be the same one that you staked earlier.

The function should look like this before clicking Write:

image

Now your tokens are unstaked, you can re-stake them following Step 3, or you can withdraw them following Step 4.

Claiming and Viewing Rewards

To view rewards, go to the Uniswap V3 Staker contract on Basescan, and open up the rewards function.

For the first input, use the $FRAME token address: 0x91F45aa2BdE7393e0AF1CC674FFE75d746b93567

For the second input, use your address that staked the tokens.

This will give you the 18 decimal place value of your rewards. To convert them to human readable amounts, click on the number that gets returned and Basescan will convert it for you!

Take that raw number, not the formatted one, and go to the Write Contract tab, and connect your wallet that staked the LP NFT. Open the claimReward tab, and fill in the following values:

Parameter Value Description
rewardToken address 0x91F45aa2BdE7393e0AF1CC674FFE75d746b93567 - $FRAME token address
to address Your wallet address
amountRequested number Amount of $FRAME you want, in wei

The function should look like this:

image

Click Write, and boom! You've claimed your $FRAME!

Step 3: Staking or Re-Staking Tokens

Once you've deposited your tokens in the LP, if you didn't include the data in your safeTransferFrom earlier, you will have to manually stake your tokens. To do so, go to the Write Contract tab of the Uniswap V3 Staking contract, and connect your wallet that deposited the LP NFT.

Open the stakeToken function and for the key, use the following value:

["0x91F45aa2BdE7393e0AF1CC674FFE75d746b93567", "0x64b74c66b9BA60ca668b781289767AE7298F37Ae", 1708027200, 1723575600, "0x7dd39E3aC366D3c031ed84343377ceFbd5A9F47F"]

The tokenId should be the same one that you deposited earlier.

Click Write, and boom! Your token is now staked, earning $FRAME tokens immediately!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment