articoloquintoNumber of distinct liquidity providers - Ethereum
Updated 2022-07-23
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
›
⌄
with block_15180000 as (select avg(amount_out/amount_in) as "WETH price at block 15180000"
from ethereum.sushi.ez_swaps
where token_in = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
and token_out = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
and block_number between 15179900 and 15180000)
select count(distinct "liquidity provider") as "liquidity providers" from(
select block_number as "block number",
tx_hash as "transaction hash",
origin_from_address as "liquidity provider",
event_inputs:amount1::numeric/1e18 as "amount WETH",
event_inputs:amount0::numeric/1e6 as "amount USDC",
"amount USDC"/"amount WETH" as "WETH price",
"amount USDC"+"amount WETH"*"WETH price" as "LP value in usd",
(select "WETH price at block 15180000" from block_15180000) as "WETH price at block 15180000",
("WETH price at block 15180000"-"WETH price")/"WETH price"*100 as "WETH price change %",
sqrt(("amount WETH"*"amount USDC")/"WETH price at block 15180000")*"WETH price at block 15180000"+
sqrt(("amount WETH"*"amount USDC")*"WETH price at block 15180000") as "LP value at block 15180000",
"amount WETH"*"WETH price at block 15180000"+"amount USDC" as "value of the tokens at block 15180000",
"LP value at block 15180000"-"value of the tokens at block 15180000" as "IL at block 15180000 in usd",
"IL at block 15180000 in usd"*100/"value of the tokens at block 15180000" as "IL %"
from ethereum.core.fact_event_logs
where block_number between 14000000 and 15180000
and origin_to_address = '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f'
and contract_address = '0x397ff1542f962076d0bfe58ea045ffa2d347aca0'
and event_name = 'Mint'
and tx_status = 'SUCCESS'
and tx_hash not in ('0x0f1fde2d7a18b01b89f71b6919547405a99ff43ee76bdedf1649dc64747dce65',
'0x2e377d373233c9f9f6fc24d2c08b494c2655479a52fb1a8102081660d98b2242',
'0x7b32a324b7dc459a06c45cc3c69c5c9b222ff2e6d057d5766c4c1271cd20a2f6'))
Run a query to Download Data