Popex404#3 Trisolaris swaps 2022 vs 2023
Updated 2024-03-12
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
›
⌄
-- forked from #10 Aurora Helth - Txs Growth @ https://flipsidecrypto.xyz/edit/queries/6ad6de2d-1d89-4423-a488-736c7e0b8e0d
--Query from Frodo
-- https://flipsidecrypto.xyz/Frodo/q/3HvF6GaRblji/trisolaris---swaps-overview
-- With my own Changes
-- added eth price for usd gas fees
with base as (
select
BLOCK_TIMESTAMP,
TX_HASH,
FROM_ADDRESS as swapper,
ORIGIN_FUNCTION_SIGNATURE,
case
when ORIGIN_FUNCTION_SIGNATURE in ('0x38ed1739','0x5c11d795','0x18cbafe5') then concat('0x' , substr(input_data, (64*6)+35,40))
when ORIGIN_FUNCTION_SIGNATURE in ('0x8803dbee','0x4a25d94a','0x791ac947') then concat('0x' , substr(input_data, (64*6)+35,40))
when ORIGIN_FUNCTION_SIGNATURE in ('0x7ff36ab5','0xfb3bdb41','0xb6f9de95') then concat('0x' , substr(input_data, (64*5)+35,40))
end as swap_from_token,
case
when ORIGIN_FUNCTION_SIGNATURE in ('0x38ed1739','0x5c11d795','0x18cbafe5','0x791ac947') then ethereum.public.udf_hex_to_int (substr(INPUT_DATA,((64*0)+11),64))
when ORIGIN_FUNCTION_SIGNATURE in ('0x8803dbee','0x4a25d94a') then ethereum.public.udf_hex_to_int (substr(INPUT_DATA,((64*1)+11),64))
when ORIGIN_FUNCTION_SIGNATURE in ('0x7ff36ab5','0xfb3bdb41','0xb6f9de95') then (value * pow(10,18))
end as swap_from_token_amount,
case
when ORIGIN_FUNCTION_SIGNATURE in ('0x38ed1739','0x5c11d795','0x18cbafe5') then concat('0x' , substr(input_data, (64*7)+35,40))
when ORIGIN_FUNCTION_SIGNATURE in ('0x8803dbee') then concat('0x' , substr(input_data, (64*7)+35,40))
when ORIGIN_FUNCTION_SIGNATURE in ('0xb6f9de95','0x7ff36ab5','0xfb3bdb41') then concat('0x' , substr(input_data, (64*6)+35,40))
when ORIGIN_FUNCTION_SIGNATURE in ('0x4a25d94a','0x791ac947') then concat('0x' , substr(input_data, (64*7)+35,40))
end as swap_to,
case
when ORIGIN_FUNCTION_SIGNATURE in ('0x38ed1739','0x5c11d795','0x18cbafe5','0x791ac947') then ethereum.public.udf_hex_to_int (substr(INPUT_DATA,((64*1)+11),64))
when ORIGIN_FUNCTION_SIGNATURE in ('0x8803dbee','0x4a25d94a','0xb6f9de95') then ethereum.public.udf_hex_to_int (substr(INPUT_DATA,((64*0)+11),64))
when ORIGIN_FUNCTION_SIGNATURE in ('0x7ff36ab5','0xfb3bdb41') then ethereum.public.udf_hex_to_int (substr(INPUT_DATA,((64*0)+11),64))
end as swap_to_amount
from aurora.core.fact_transactions
where to_address = lower('0x2CB45Edb4517d5947aFdE3BEAbF95A582506858B')
QueryRunArchived: QueryRun has been archived