hessWeekly Transfer BTC
    Updated 2023-03-15
    select trunc(block_timestamp,'week') as weekly, 'Ethereum' as chain, count(distinct(origin_from_address)) as total_user, count(DISTINCT(tx_hash)) as total_tx,
    sum(raw_amount/pow(10,8)) as total_btc, avg(raw_amount/pow(10,8)) as avg_amount, sum(total_tx) over (order by weekly asc) as cum_tx,
    sum(total_btc) over (order by weekly asc) as cum_btc
    from ethereum.core.fact_token_transfers
    where contract_address like lower('0x2297aEbD383787A160DD0d9F71508148769342E3')
    and to_address = '0x0000000000000000000000000000000000000000'
    and block_timestamp >= CURRENT_DATE - 180
    group by 1,2
    UNION
    select trunc(block_timestamp,'week') as weekly, 'Optimism' as chain, count(distinct(origin_from_address)) as total_user, count(DISTINCT(tx_hash)) as total_tx,
    sum(raw_amount/pow(10,8)) as total_btc, avg(raw_amount/pow(10,8)) as avg_amount, sum(total_tx) over (order by weekly asc) as cum_tx,
    sum(total_btc) over (order by weekly asc) as cum_btc
    from optimism.core.fact_token_transfers
    where contract_address like lower('0x2297aEbD383787A160DD0d9F71508148769342E3')
    and to_address = '0x0000000000000000000000000000000000000000'
    and block_timestamp >= CURRENT_DATE - 180
    group by 1,2
    UNION
    select trunc(block_timestamp,'week') as weekly, 'Arbitrum' as chain, count(distinct(origin_from_address)) as total_user, count(DISTINCT(tx_hash)) as total_tx,
    sum(raw_amount/pow(10,8)) as total_btc, avg(raw_amount/pow(10,8)) as avg_amount, sum(total_tx) over (order by weekly asc) as cum_tx,
    sum(total_btc) over (order by weekly asc) as cum_btc
    from arbitrum.core.fact_token_transfers
    where contract_address like lower('0x2297aEbD383787A160DD0d9F71508148769342E3')
    and to_address = '0x0000000000000000000000000000000000000000'
    and block_timestamp >= CURRENT_DATE - 180
    group by 1,2
    UNION
    select trunc(block_timestamp,'week') as weekly, 'Polygon' as chain, count(distinct(origin_from_address)) as total_user, count(DISTINCT(tx_hash)) as total_tx,
    sum(raw_amount/pow(10,8)) as total_btc, avg(raw_amount/pow(10,8)) as avg_amount, sum(total_tx) over (order by weekly asc) as cum_tx,
    sum(total_btc) over (order by weekly asc) as cum_btc
    from polygon.core.fact_token_transfers
    where contract_address like lower('0x2297aEbD383787A160DD0d9F71508148769342E3')
    and to_address = '0x0000000000000000000000000000000000000000'
    and block_timestamp >= CURRENT_DATE - 180
    group by 1,2
    UNION
    Run a query to Download Data