sarathmatic liquid staking3
    Updated 2022-09-23
    with maticprice as (select hour::date as date, avg (price) as usdprice from ethereum.core.fact_hourly_token_prices where symbol ='MATIC' group by 1),

    Ankr as (
    select 'Ankr' as platform,
    tx_hash as staketx,
    origin_from_address as staker,
    event_inputs:value/1e18 as Stake_Volume,
    event_inputs:value/1e18*usdprice as USD_Stake_Volume
    from ethereum.core.fact_event_logs t1 join maticprice t2 on t1.block_timestamp::date = t2.date
    where origin_to_address = lower('0xCfD4B4Bc15C8bF0Fd820B0D4558c725727B3ce89')
    and origin_function_signature in ('0xaa4be7f6','0x206709d6')
    --and tx_hash = '0xb7146a76476b774375d3ff4e1edc10104668ba80c8c506739bd658b2dd4b988a'
    and event_inputs:from = origin_from_address
    and event_name = 'Transfer'
    and contract_address = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'
    ),
    Claystack as (
    select 'ClayStack' as platform,
    tx_hash as staketx,
    matic_from_address as staker,
    amount as Stake_Volume,
    amount*usdprice as USD_Stake_Volume
    from polygon.core.ez_matic_transfers t1 join maticprice t2 on t1.block_timestamp::date = t2.date
    where origin_to_address = '0x376b467dff007dd8d3f24404caddff7f72257fe4'
    and origin_to_address = matic_to_address
    and amount > 0
    and origin_function_signature = '0xd0e30db0'
    --and tx_hash = '0x77671940e87b0c854e6c7df39cb72f9f8ceeb4e6c3f1525cbcd07ebd4b7736fd'
    UNION ALL
    select 'ClayStack' as platform,
    tx_hash as staketx,
    origin_from_address as staker,
    amount as Stake_Volume,
    amount_usd as USD_Stake_Volume
    from ethereum.core.ez_token_transfers
    Run a query to Download Data