Flipside’s API allows us to pull query results hosted on the Velocity platform.
The following function is used to import data from Velocity:
PullVelocityData <- function(endpoint.url){
raw.results <- readLines(endpoint.url)
to.return <- data.table(jsonlite::fromJSON(raw.results))
setnames(to.return, tolower(names(to.return)))
return(to.return)
}
We import our query results from Velocity.
thor.data.10k <- PullVelocityData("https://api.flipsidecrypto.com/api/v2/queries/52b8a525-3ab0-4da5-b22e-513c3f4bba5f/data/latest")
thor.data.addresses.in.pools <- PullVelocityData("https://api.flipsidecrypto.com/api/v2/queries/b8bf7811-e66c-49f8-86ff-aa64e17db61e/data/latest")
The original queries and SQL can be found here: https://app.flipsidecrypto.com/dashboard/thor-19-queries-mLaIV3
We have imported two datasets. The first includes all 347 addresses with 10,000 Rune or more. We also have a second dataset of all 557 addresses contributing to a pool today.
We combine our two datasets into a new one. It includes all addresses with 10,000 rune or more and what pool each address is contributing to (if any).
pools_10k_today <- thor.data.addresses.in.pools %>% right_join(thor.data.10k)
We arrange and group our data.
pools_10k_today_grouped <- pools_10k_today %>% group_by(pool_name)
pools_10k_today_grouped <- pools_10k_today_grouped %>% arrange(pool_name)
Finally we are ready to count the number of addresses per pool, where each address holds more than 10,000 Rune.
nb_addresses_w_10k_rune_by_pool <- pools_10k_today_grouped %>% count('pool_name')
pools_10k_today_grouped %>% count('pool_name') %>% arrange(n) %>% print(n = Inf)
## # A tibble: 22 x 3
## # Groups: pool_name [22]
## pool_name `"pool_name"` n
## <chr> <chr> <int>
## 1 BCH.BCH pool_name 1
## 2 BNB.ADA-9F4 pool_name 1
## 3 BNB.DOT-64C pool_name 1
## 4 BNB.ETH-1C9 pool_name 1
## 5 ETH.AAVE-0X7FC66500C84A76AD7E9C93437BFC5AC33E2DDAE9 pool_name 1
## 6 ETH.ALCX-0XDBDB4D16EDA451D0503B854CF79D55697F90C8DF pool_name 1
## 7 ETH.ALPHA-0XA1FAA113CBE53436DF28FF0AEE54275C13B40975 pool_name 1
## 8 ETH.HEGIC-0X584BC13C7D411C00C01A62E8019472DE68768430 pool_name 1
## 9 ETH.PERP-0XBC396689893D065F41BC2C6ECBEE5E0085233447 pool_name 1
## 10 ETH.RAZE-0X5EAA69B29F99C84FE5DE8200340B4E9B4AB38EAC pool_name 1
## 11 ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7 pool_name 1
## 12 LTC.LTC pool_name 1
## 13 BNB.AVA-645 pool_name 2
## 14 BNB.BNB pool_name 2
## 15 BNB.BTCB-1DE pool_name 2
## 16 ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48 pool_name 2
## 17 BTC.BTC pool_name 6
## 18 ETH.XRUNE-0X69FA0FEE221AD11012BAB0FDB45D444D3D2CE71C pool_name 6
## 19 BNB.BUSD-BD1 pool_name 7
## 20 ETH.ETH pool_name 7
## 21 ETH.THOR-0XA5F2211B9B8170F694421F2046281775E8468044 pool_name 18
## 22 <NA> pool_name 313
Remarks: