hessbinding-amber
    Updated 2025-03-14
    with layer_base as (select block_timestamp::Date as date,
    tx_hash,
    contract_address as token_address,
    '0x' || substr(TOPIC_1,27) as null_address,
    '0x' || substr(TOPIC_2,27) as user_address,
    case when contract_address = '0xf1815bd50389c46847f0bda824ec8da914045d14' then 'USDC'
    when token_address = '0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590' then 'WETH'
    when token_address = '0x2aabea2058b5ac2d339b163c6ab6f2b6d53aabed' then 'USDF'
    when token_address = '0x674843c06ff83502ddb4d37c2e09c01cda38cbc8' then 'USDT'
    when token_address = '0xfa0e06b54986ad96de87a8c56fea76fbd8d493f8' then 'USDF'
    when token_address = '0xea3910f1c6e687b59835885904a2fd1944b51ec6' then 'TRUMP' end as token_name,
    event_index,
    TOPICS,
    livequery.utils.udf_hex_to_int(DATA) as amount_raw,
    case when contract_address = '0xf1815bd50389c46847f0bda824ec8da914045d14' then amount_raw/pow(10,6)
    when token_address = '0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590' then amount_raw/pow(10,18)
    when token_address = '0x2aabea2058b5ac2d339b163c6ab6f2b6d53aabed' then amount_raw/pow(10,6)
    when token_address = '0x674843c06ff83502ddb4d37c2e09c01cda38cbc8' then amount_raw/pow(10,6)
    when token_address = '0xfa0e06b54986ad96de87a8c56fea76fbd8d493f8' then amount_raw/pow(10,6)
    when token_address = '0xea3910f1c6e687b59835885904a2fd1944b51ec6' then amount_raw/pow(10,18) end as amount
    from flow.core_evm.fact_event_logs
    where origin_to_address = '0xa20db4ffe74a31d17fc24bd32a7dd7555441058e'
    and tx_succeeded = 'TRUE'
    having null_address = '0x0000000000000000000000000000000000000000'
    )
    ,
    price as ( select hour::Date as date,
    case when symbol = 'WETH' then '0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590' else '0xea3910f1c6e687b59835885904a2fd1944b51ec6' end as tok_address,
    avg(price) as avg_price
    from crosschain.price.ez_prices_hourly
    where token_address in ('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2','6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN')
    group by 1,2)
    ,
    final as ( select a.date,
    a.tx_hash,
    user_address,
    Last run: 24 days ago
    DATE
    TX_HASH
    USER_ADDRESS
    TOKEN_NAME
    TOKEN_ADDRESS
    AMOUNT
    AMOUNT_USD
    SEGMENTED_DATA
    SRC_CHAIN
    SOURCE_CHAIN
    1
    2025-01-21 00:00:00.0000x62f9b1983ddb84f7bcc675b875ea391bc1f38c488eb2d97cbc4412010db7e9e70x922275f9022822665cf3bd0baf6e7dd68428eae1TRUMP0xea3910f1c6e687b59835885904a2fd1944b51ec60.0010.0203625
    [ "0000000000000000000000000000000000000000000000000000000000000020", "000000000000000000000000ea3910f1c6e687b59835885904a2fd1944b51ec6", "0000000000000000000000000000000000000000000000000000000000007648", "000000000000000000000000ea3910f1c6e687b59835885904a2fd1944b51ec6", "0000000000000000000000000000000000000000000000000000000000000001", "acbc81443a0b65d7def7f192527241bb0203ad412e199d5805db0d4b738d15ff", "0000000000000000000000000000000000000000000000000000000000000100", "0000000000000000000000000000000000000000000000000000000000000160", "000000000000000000000000000000000000000000000000000000000002f1e8", "0000000000000000000000000000000000000000000000000000000000000028", "000000000000000000000000922275f9022822665cf3bd0baf6e7dd68428eae1", "00000000000003e8000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000" ]
    30280Sei
    1
    1KB
    46s