Kruys-CollinsAlmost!
Updated 2024-11-11
999
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
base AS (
SELECT
block_timestamp,
tx_hash,
contract_address,
decoded_log,
event_name,
event_index,
l.address_name,
l.address
FROM
arbitrum.core.fact_decoded_event_logs ct
JOIN arbitrum.core.dim_labels l ON ct.contract_address = l.address
WHERE contract_address IN (
SELECT address
FROM arbitrum.core.dim_labels
WHERE project_name = 'beefy finance'
AND label_subtype = 'vault'
)
AND event_name = 'Transfer'
),
deduplicated_transfers AS (
SELECT DISTINCT
DATE_TRUNC('day', ct.block_timestamp) as date,
ct.tx_hash,
decoded_log:from::string as frm_address,
decoded_log:to::string as t_address,
origin_function_signature as ofs,
b.address_name,
b.contract_address,
FIRST_VALUE(amount_usd) OVER (
PARTITION BY ct.tx_hash, b.contract_address, decoded_log:value::string
ORDER BY ct.block_timestamp, b.event_index
) as amount_usd,
FIRST_VALUE(decoded_log:value::decimal(38,0)) OVER (
QueryRunArchived: QueryRun has been archived