Skip to content

Instantly share code, notes, and snippets.

View medvedev1088's full-sized avatar

Evgeny Medvedev medvedev1088

View GitHub Profile
import os
import time
import uuid
from ocean_keeper.utils import get_account
from ocean_keeper.contract_handler import ContractHandler
from squid_py import Ocean, ConfigProvider, Config
from ocean_utils.agreements.service_types import ServiceTypes
from ocean_utils.agreements.service_agreement import ServiceAgreement
We can't make this file beautiful and searchable because it's too large.
spell_id,id,timestamp,transactionHash,sender,type,locked,wad
0x043c52c8ff76c088646c8d2630eddf1a8e33ba4c,ADD-0xa3844136e8b2e79d9121c982ad1f0211e57d1eecbe7c5dd1df120857d3ffd79e-171,1571014430,0xa3844136e8b2e79d9121c982ad1f0211e57d1eecbe7c5dd1df120857d3ffd79e,0x6f2a8ee9452ba7d336b3fba03cac27f7818aead6,AddAction,1850,
0x043c52c8ff76c088646c8d2630eddf1a8e33ba4c,ADD-ARRAY-0x00bccd137decd2d44d4d3fe8a55d4be2c0abd1e91575dbb065219ecd658625a7-60,1571162495,0x00bccd137decd2d44d4d3fe8a55d4be2c0abd1e91575dbb065219ecd658625a7,0x4f2161c7eb1dc40d6f0eb24db81bf4a6eb0c3f30,AddAction,3,
0x043c52c8ff76c088646c8d2630eddf1a8e33ba4c,ADD-ARRAY-0x04882faa79988f8b002d140e3b1a2d53462231264dd6fc313b8f29798440ba2c-112,1571155382,0x04882faa79988f8b002d140e3b1a2d53462231264dd6fc313b8f29798440ba2c,0x2b528c8a31dbd7c57d8b42003262300c011d044b,AddAction,10,
0x043c52c8ff76c088646c8d2630eddf1a8e33ba4c,ADD-ARRAY-0x0783b1d2ebb15df5d762964616e5d377014f3480c9a7d9bea74fd3d1e78eca16-46,1570824997,0x0783b1d2ebb15df5d762964616e5d377014f3480c9a7d9bea74fd3d1
import csv
import json
import requests
url = 'https://api.thegraph.com/subgraphs/name/protofire/makerdao-governance'
file = open("output.csv", 'w')
writer = csv.DictWriter(file, fieldnames=['spell_id', 'id', 'timestamp', 'transactionHash', 'sender', 'type', 'locked',
'wad'], extrasaction='ignore')
CREATE TEMP FUNCTION
PARSE_LOGNOTE(data STRING, topics ARRAY<STRING>)
RETURNS STRUCT<`sig` STRING, `guy` STRING, `foo` STRING, `bar` STRING, `wad` STRING, `fax` STRING>
LANGUAGE js AS """
var parsedEvent = {"anonymous": true, "inputs": [{"indexed": true, "name": "sig", "type": "bytes4"}, {"indexed": true, "name": "guy", "type": "address"}, {"indexed": true, "name": "foo", "type": "bytes32"}, {"indexed": true, "name": "bar", "type": "bytes32"}, {"indexed": false, "name": "wad", "type": "uint256"}, {"indexed": false, "name": "fax", "type": "bytes"}], "name": "lognote", "type": "event"}
return abi.decodeEvent(parsedEvent, data, topics, false);
"""
OPTIONS
( library="https://storage.googleapis.com/ethlab-183014.appspot.com/ethjs-abi.js" );
with source_table as (
select * from `your-projet.you-dataset.ages`
),
supply_table as (
select date, sum(balance) as supply
from source_table
group by date
),
wave1d_table as (
select date, sum(balance) as sum1d
CREATE TEMP FUNCTION
calc_ages(credits ARRAY<FLOAT64>, balances ARRAY<FLOAT64>)
RETURNS ARRAY<FLOAT64>
LANGUAGE js AS """
var ethdays = [];
var ages = [];
var runningEthdays = 0;
var runningAge = 0;
CREATE TEMP FUNCTION
DECODE_ERC721_TRANSFER(data STRING, topics ARRAY<STRING>)
RETURNS STRUCT<`from` STRING, `to` STRING, tokenId STRING>
LANGUAGE js AS """
var CRYPTOKITTY_TRANSFER = {"anonymous": false,"inputs": [{"indexed": false,"name": "from","type": "address"},{"indexed": false,"name": "to","type": "address"},{"indexed": false,"name": "tokenId","type": "uint256"}],"name": "Transfer","type": "event"};
var interface_instance = new ethers.utils.Interface([CRYPTOKITTY_TRANSFER]);
var parsedLog = interface_instance.parseLog({topics: topics, data: data});
return parsedLog.values;
{
"parser": {
"type": "log",
"contract_address": "0xf0ad5cad05e10572efceb849f6ff0c68f9700455",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "name",
apiVersion: apps/v1
kind: StatefulSet
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"StatefulSet","metadata":{"annotations":{},"name":"etc-prod-ss-2","namespace":"default"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"etc-prod-app-2"}},"serviceName":"etc-prod-ss-2","template":{"metadata":{"labels":{"app":"etc-prod-app-2"}},"spec":{"affinity":{"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"preference":{"matchExpressions":[{"key":"failure-domain.beta.kubernetes.io/zone","operator":"In","values":["us-central1-c"]}]},"weight":100}]}},"containers":[{"args":["--jsonrpc-interface=all","--jsonrpc-apis=all","--jsonrpc-port=8545","--tracing=on","-d /data","-l info","--pruning=archive","--db-compaction=ssd","--chain=classic"],"command":["./entrypoint.sh"],"image":"gcr.io/crypto-etl-clients/parity:v2.3.2","name":"parity","ports":[{"containerPort":8545,"name":"web-socket"},{"containerPort":8546,"name":"jsonrpc"},{"conta
projects/crypto-etl-ethereum-prod/topics/crypto_ethereum.blocks
{
"type": "block",
"number": 7713656,
"hash": "0xfbdd64e0bff8f3676bd5874a734d0523bbc6e0b122658c831366fd29de278f83",
"parent_hash": "0x2d013d43a3cba4c990138c2b84ec0cb439a2c7b38e67355a6b76c1419b93edba",
"nonce": "0x908f931c06821044",
"sha3_uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logs_bloom": "0xaa002302a240310c04c84c1ec394c03201a0880221289498d10395800841c0024882ac18200142be60516110100f020942681408182cb92141eb088004bf120a05040080a403194c0c9182c821080118180d003fd3f4204589042500140340400ccd40205b0944791408400320040c011000d800a984a40005089d954264410030222a16a804ac28122cae0380200c080964820035500d2421264800002640286b1a901751d52440e742622009488424b835c40805a2c88e6004c9401d822441f0011cb2a2520240204301001590000230106200890080090800202a0323693101376880010010004c37104944a32290714013a454024a9d6818324040700106",