Last active
December 3, 2019 01:43
-
-
Save askeluv/5677c115894e7ef0c72f742e6a2bf627 to your computer and use it in GitHub Desktop.
Calculates MKR burned
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | |
CAST(tt.value AS FLOAT64) / 1e18 AS value | |
FROM tt | |
WHERE tt.to_address = '0x69076e44a9c70a67d5b79d95795aba299083c275' -- MKR burned address | |
) | |
SELECT | |
block_timestamp, SUM(value) OVER (ORDER BY block_timestamp) AS balance, value | |
FROM inc_tokens | |
ORDER BY block_timestamp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment