Finding Rare Uniswap V3 NFTs with Sparkles!!

Whenever a new Liquidity Position is opened on Uniswap V3 an NFT is generated. Rarely these NFTs have sparkles as shown in the tweet from Uniswap Labs, check bottom right corner to to see the sparkle. In this post I’m going to explain how I found those rare NFTs held by Top 20 Liquidity Providers using Flipside Cypto’s data warehouse and Uniswap’s source code on Github.

https://twitter.com/Uniswap/status/1390034790653599746?s=20

Few Uniswap Sparkle NFTs

Here are few NFTs with Sparkles we identified and you find a big list at the bottom of the post.

Step by Step Guide to Find NFTs with Sparkles

Step 1: Query Flipside Crypto data warehouse and find the top 20 Liquidity Providers by the amount of fees they are collecting on Uniswap.

Step 2: Retrieve all liquidity positions opened by these top 20 liquidity providers from data warehouse in a JSON format. Here is the query I used

SELECT 
	concat( 
  		to_json(OBJECT_CONSTRUCT(
  		'pool_address',  pool_address,
    	'nf_token_id', nf_token_id,
    	'tx_id', tx_id,
    	'liquidity_provider', liquidity_provider,
  		'block_timestamp', block_timestamp
    	)), ','
  ) as json_string
FROM top_provider_txns
ORDER BY block_timestamp

Step 3: Download uniswap-v3-periphery from github and setup solidity environment on your machine. If you need instructions, Google Solidity Local setup and you find a bunch of articles!

Step 4: Save output of query executed in Step 2 to a JSON file, ./data/input.json, in the following format.

{
    "nfts": [
        {
            "block_timestamp": "2021-05-05 18:55:57.000",
            "liquidity_provider": "0x22fa8cc33a42320385cbd3690ed60a021891cb32",
            "nf_token_id": 234,
            "pool_address": "0x3cec6746ebd7658f58e5d786e0999118fea2905c",
            "tx_id": "0x2a1bdf0a79e9f52196ef00d3c1ed88194b77f543ae1cfedc258d5845723d9928"
        }
    ]
}

Step 5: Open the codebase and navigate to test/NFTDescriptor.spec.ts and import the ./data/input.json file.

import { nfts } from './../data/input.json';

Step 6: Remove all unit tests and add this one.

describe('#isRare', () => {
    it('find shiny uniswap nfts', async () => { 
      /* This is not an unit test, instead we are using unit testing framework to find rare NFTs */
      nftArray.forEach(async (nft)  => {           
        let isRare  = await nftDescriptor.isRare(nft.nf_token_id, nft.pool_address);        
        if(isRare){                    
          console.log(JSON.stringify(nft) + ',');
        }
      });       
    })   
  })

Step 7: Go to terminal / command prompt and execute the newly added test using the following command.

npx hardhat test test/NFTDescriptor.spec.ts

Tada! You will all NFTs listed on your console!

Lets chart the Rare NFTs!

Here is the complete list of NFTs identified during this exercise. Grab an ID or two and view them on opensea!

Leave a Reply