mo115Profit
Updated 2022-08-21Copy Reference Fork
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
33
34
35
36
›
⌄
with deposits as (
with w as((select ORIGIN_FROM_ADDRESS as depositser, count(distinct TX_HASH) as deposits, sum(RAW_AMOUNT/1e18) as amount , 'sUSD' as token
from optimism.core.fact_token_transfers
where ORIGIN_TO_ADDRESS = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and CONTRACT_ADDRESS = '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9'
and ORIGIN_FROM_ADDRESS !='0x061b87122ed14b9526a813209c8a59a633257bab'
and ( ORIGIN_FUNCTION_SIGNATURE='0x6cc5a6ff' or ORIGIN_FUNCTION_SIGNATURE='0x8875eb84')
and BLOCK_TIMESTAMP >= CURRENT_DATE-13
group by 1)
union
(select ORIGIN_FROM_ADDRESS as depositser, count(distinct TX_HASH) as deposits, sum(RAW_AMOUNT/1e6) as amount , 'USDT' as token
from optimism.core.fact_token_transfers
where ORIGIN_TO_ADDRESS = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and CONTRACT_ADDRESS = lower('0x94b008aA00579c1307B0EF2c499aD98a8ce58e58')
and ( ORIGIN_FUNCTION_SIGNATURE='0x6cc5a6ff' or ORIGIN_FUNCTION_SIGNATURE='0x8875eb84')
and BLOCK_TIMESTAMP >= CURRENT_DATE-13
group by 1)
union
(select ORIGIN_FROM_ADDRESs as depositser, count(distinct TX_HASH) as deposits, sum(RAW_AMOUNT/1e6) as amount , 'USDC' as token
from optimism.core.fact_token_transfers
where ORIGIN_TO_ADDRESS = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and CONTRACT_ADDRESS = '0x7f5c764cbc14f9669b88837ca1490cca17c31607'
and ( ORIGIN_FUNCTION_SIGNATURE='0x6cc5a6ff' or ORIGIN_FUNCTION_SIGNATURE='0x8875eb84')
and BLOCK_TIMESTAMP >= CURRENT_DATE-13
group by 1)
union
(select ORIGIN_FROM_ADDRESS as depositser, count(distinct TX_HASH) as deposits, sum(RAW_AMOUNT/1e18) as amount , 'DAI' as token
from optimism.core.fact_token_transfers
where ORIGIN_TO_ADDRESS = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and CONTRACT_ADDRESS = lower('0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1')
and ( ORIGIN_FUNCTION_SIGNATURE='0x6cc5a6ff' or ORIGIN_FUNCTION_SIGNATURE='0x8875eb84')
and BLOCK_TIMESTAMP >= CURRENT_DATE-13
group by 1))
select depositser,sum(aMOUNT) as deposited_amount , sum(deposits) as deposits
from w
group by 1
Run a query to Download Data