KuramaStargate - TVL avalanche
    Updated 2022-12-14
    -- usdc
    with daily_usdc as (
    select date, 'USDC' as pool, sum(amount) as total_amount from (
    select date_trunc('day',block_timestamp) as date, tx_hash,
    case when from_address = '0x1205f31718499dbf1fca446663b532ef87481fe1' then (raw_amount/pow(10,6))*(-1)
    else raw_amount/pow(10,6) end as amount
    from avalanche.core.fact_token_transfers a
    where from_address = '0x1205f31718499dbf1fca446663b532ef87481fe1' or to_address = '0x1205f31718499dbf1fca446663b532ef87481fe1'
    and contract_address = '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'
    )
    group by date, pool),


    -- usdt
    daily_usdt as (
    select date, 'USDT' as pool, sum(amount) as total_amount from (
    select date_trunc('day',block_timestamp) as date, tx_hash, case when from_address = '0x29e38769f23701a2e4a8ef0492e19da4604be62c' then (raw_amount/pow(10,6))*(-1)
    else raw_amount/pow(10,6) end as amount
    from avalanche.core.fact_token_transfers a
    where from_address = '0x29e38769f23701a2e4a8ef0492e19da4604be62c' or to_address = '0x29e38769f23701a2e4a8ef0492e19da4604be62c'
    and contract_address = '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7'
    )
    group by date, pool),


    -- frax
    daily_frax as (
    select date, 'FRAX' as pool, sum(amount) as total_amount from (
    select date_trunc('day',block_timestamp) as date, tx_hash, case when from_address = '0x1c272232df0bb6225da87f4decd9d37c32f63eea' then (raw_amount/pow(10,18))*(-1)
    else raw_amount/pow(10,18) end as amount
    from avalanche.core.fact_token_transfers a
    where from_address = '0x1c272232df0bb6225da87f4decd9d37c32f63eea' or to_address = '0x1c272232df0bb6225da87f4decd9d37c32f63eea'
    and contract_address = '0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64'
    )
    Run a query to Download Data