Skip to content

👀⬅️ Queries for surfacing information about past users of Uniswap

Notifications You must be signed in to change notification settings

dethertech/retroactive-query

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

@uniswap/retroactive-query

Run Queries

This repository contains queries that produce the tables of retroactive UNI token distributions.

The queries run in Google BigQuery against the bigquery-public-data.crypto_ethereum dataset.

Data for this dataset is extracted to Google BigQuery using blockchain-etl/ethereum-etl.

Specifications

All queries have a cutoff timestamp of 2020-09-01 00:00:00+00 GMT. Total distribution is aimed at 150_000_000 UNI.

All users

400 UNI goes to:

  • any account that directly calls a Uniswap pair or a Uniswap router contract
  • any address that transfers any liquidity provider tokens or pair tokens to a Uniswap pair or a Uniswap router contract
  • any address that holds liquidity provider tokens for a non-zero number of seconds

Liquidity providers

  • all liquidity is weighted by ETH value of liquidity / total ETH value
  • fixed reward rate per second to all LPs pro-rata
  • total rewards to liquidity providers is 150_000_000 - amount to users

SOCKS users

1000 UNI goes to:

  • every address that burns any SOCKS
  • every address that holds at least 1 SOCKS token

Reproduction

You can reproduce the results of this query by forking this repository and adding your own secrets to run in your own GCP account.

  1. Create a Google Cloud project here
  2. Find your Project ID in the Google Cloud console here
  3. Fork this repository
  4. Add the secret GCP_PROJECT_ID under Settings > Secrets containing your project ID from the GCP dashboard
  5. Add the secret GCP_SA_KEY under Settings > Secrets containing the base64 encoded JSON key of a service account
  6. Go to the actions tab of your fork
  7. Run the workflow (roughly ~20 minutes to complete)
  8. Inspect the resulting tables

Determinism notes

Note that, for floating point input types, the return result of aggregations is non-deterministic, which means you will not get the exact same result each time you aggregate floating point columns.

These queries make use of floating point numbers. However in the final all_earnings_hexadecimal table, we truncate to 6 decimal places so that the result used for production is the same across multiple runs.

See https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions for more information.

Final results

The blob containing all the proofs of the retroactive distribution can be found at mrkl.uniswap.org.

About

👀⬅️ Queries for surfacing information about past users of Uniswap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published