Skip to content

Instantly share code, notes, and snippets.

View askeluv's full-sized avatar
💭
🇭🇰

Alex Svanevik askeluv

💭
🇭🇰
View GitHub Profile
WITH
aggregated as (
SELECT
TIMESTAMP_SECONDS(300 * DIV(UNIX_SECONDS(block_timestamp) + 150, 300)) AS dt,
CASE
WHEN transaction_type = 2 THEN 1.0
ELSE 0.0
END as pct_1559
from `bigquery-public-data.crypto_ethereum.transactions`
SELECT SUM(CAST(value AS FLOAT64) / 1e18) AS dai
FROM `public-data-finance.crypto_polygon.token_transfers`
WHERE to_address = '0x5143e71982a2d5dc63a77f0a5611685cf13c5aaf' -- where DAI is sent in auctions
AND token_address = '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063' -- DAI
AND from_address != '0x3b7e9ea4bf300525ccbbc81c792b2bce7a13a2d6' -- exclude DAI from LP token
AND block_timestamp > '2021-06-09' -- save query costs
@askeluv
askeluv / top_self_sending_tokens.csv
Created August 21, 2020 17:07
Top Self-Sending Tokens
We can't make this file beautiful and searchable because it's too large.
token_address,symbol,name,num_tx,num_senders
0x0e69d0a2bbb30abcb7e5cfea0e4fde19c00a8d47,IOV,CarLive Chain,21401,21215
0x14409b0fc5c7f87b5dad20754fe22d29a3de8217,,,51391,16189
0x03cb0021808442ad5efb61197966aef72a1def96,coToken,coToken,978441,16029
0x5d3a536e4d6dbd6114cc1ead35777bab948e3643,cDAI,Compound Dai,53835,13184
0xf5dce57282a584d2746faf1593d3121fcac444dc,cSAI,Compound Sai,32796,12732
0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5,cETH,Compound Ether,33466,11005
0xe62e6e6c3b808faad3a54b226379466544d76ea4,LCS,Liberty Cash,143484,9003
0x39aa39c021dfbae8fac545936693ac917d5e7563,cUSDC,Compound USD Coin,37474,7976
0xab85d25a50183fa56a5a98f644aa3a0ec9024bb9,SDFT,SDF Token,110789,7849
0x016913ead5672f01de2043874e5c1cac5df608de
0xe453f4012c868cb25a0b987fa8d2a60f28300082
0xe74f306bfbff84f675fdceb770b157b70b017169
0x6f5901e3c53a51fce8edc15f6fa2b01b24226dcc
0xb66a58e0aaa66b2ef9822c75cb577d336acb00bd
0x0000000000000000000000000000018148086009
0x552804d08eb7abbf89c131e4c4b1e9e259d90751
0x8faff11fde21191e7fd50806dcbcdd49265d51a0
0x00000000000000000000000000000000000001f2
0xd5faed37a99373c218a73149f93e47ce1c983dfe
WITH
genesis AS (
SELECT to_address AS address, SUM(value / 1e18) AS genesis_amount
FROM `bigquery-public-data.crypto_ethereum.traces` AS tr
WHERE tr.trace_type = 'genesis'
GROUP BY 1
),
genesis_out AS (
SELECT
genesis.address,
@askeluv
askeluv / maker_burned.sql
Last active December 3, 2019 01:43
Calculates MKR burned
WITH
tt AS (
SELECT block_timestamp, value, to_address
FROM `bigquery-public-data.crypto_ethereum.token_transfers` AS tt
WHERE tt.token_address = '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2' -- MKR
AND tt.block_timestamp > '2017-12-18' -- to scan a bit less data
),
inc_tokens AS (
SELECT
tt.block_timestamp,

Keybase proof

I hereby claim:

  • I am askeluv on github.
  • I am asvanevik (https://keybase.io/asvanevik) on keybase.
  • I have a public key whose fingerprint is F742 5362 B5E9 79EE 404C 5749 BFD4 4E1A 52D3 FE0E

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1KPXqckFQ3HaEMQLwx8v7C4GwfZSTEGCTF https://explorer.blockstack.org/address/1KPXqckFQ3HaEMQLwx8v7C4GwfZSTEGCTF