RayyykBase Code - (Volume & Fee) - ETH & Poly
    Updated 4 hours ago
    with table_1 as (select tx_hash, decoded_log, block_timestamp, event_name, contract_address, 'Ethereum' as chain
    from ethereum.core.ez_decoded_event_logs
    where event_name in ('LiFiTransferStarted', 'LiFiGenericSwapCompleted', 'FeesCollected')
    and block_timestamp >= '2023-03-10'
    union ALL
    select tx_hash, decoded_log, block_timestamp, event_name, contract_address, 'Polygon' as chain
    from polygon.core.ez_decoded_event_logs
    where event_name in ('LiFiTransferStarted', 'LiFiGenericSwapCompleted', 'FeesCollected')
    and block_timestamp >= '2023-03-10'),

    prices as (select date_trunc('day', hour) as day,
    avg(price) as price,
    decimals,
    symbol,
    iff(is_native,'0x0000000000000000000000000000000000000000', token_address) as token_address,
    'Ethereum' as chain
    from ethereum.price.ez_prices_hourly
    where hour >= '2023-03-10'
    group by 1,3,4,5
    union ALL
    select date_trunc('day', hour) as day,
    avg(price) as price,
    decimals,
    symbol,
    iff(is_native,'0x0000000000000000000000000000000000000000', token_address),
    'Polygon' as chain
    from polygon.price.ez_prices_hourly
    where hour >= '2023-03-10'
    group by 1,3,4,5),

    table_2 as (select 'Bridge' as type,
    tx_hash,
    block_timestamp,
    decoded_log:bridgeData:integrator as integrator,
    zeroifnull(b.price * decoded_log:bridgeData:minAmount / pow(10, b.decimals)) as volume_usd
    from table_1 a
    Last run: about 4 hours ago
    DATE
    INTEGRATORS
    USD_VOLUME
    CUMU_USD_VOLUME
    TOTAL_INTEGRATOR_FEE
    TOTAL_LIFI_FEE
    1
    2023-03-15 00:00:00.000Pangolin8.2761902238.2761902230.21491125320.03792551527
    2
    2023-03-19 00:00:00.000Pangolin87.16297485995.4391650822.2913977930.4043643164
    3
    2023-03-26 00:00:00.000Pangolin22.32303908117.7622041630.58684277990.1035604906
    4
    2023-04-04 00:00:00.000Pangolin22.283768325140.0459724880.58366919950.103000447
    5
    2023-04-12 00:00:00.000Pangolin15.80460232155.8505748070.42064896560.0742321704
    6
    2023-04-15 00:00:00.000Pangolin13.359432227169.2100070340.35656723240.06292362925
    7
    2023-04-17 00:00:00.000Pangolin24.264237504193.4742445380.63787428490.1125660503
    8
    2023-04-22 00:00:00.000Pangolin1.981532354195.4557768920.051882360180.00915571062
    9
    2023-04-25 00:00:00.000Pangolin4.440333642199.8961105340.11673042050.02059948597
    10
    2023-05-30 00:00:00.000Pangolin0.04424746739199.9403580010.0011548565470.0002037982142
    11
    2023-06-01 00:00:00.000Shapeshift26.64750163626.6475016360.068271025340.012047828
    12
    2023-06-12 00:00:00.000Pangolin0.3019331634200.2422911650.0081188652790.001432740932
    13
    2023-06-30 00:00:00.000Shapeshift28856.67034415128883.31784578700
    14
    2023-07-01 00:00:00.000Pangolin0.1919725278200.4342636920.0050759003990.0008957471293
    15
    2023-07-03 00:00:00.000Shapeshift10010.37911262238893.69695840900
    16
    2023-07-05 00:00:00.000Shapeshift116.39990514839010.09686355600
    17
    2023-07-06 00:00:00.000Shapeshift135.78043182439145.8772953800
    18
    2023-07-07 00:00:00.000Shapeshift551.10023218239696.97752756200
    19
    2023-07-08 00:00:00.000Pangolin1.512849938201.9471136310.039822303370.007027465301
    20
    2023-07-08 00:00:00.000Shapeshift1685.75735962841382.7348871900
    ...
    2846
    259KB
    506s