mariyaAstroport details TVL
    Updated 2022-03-11
    with lst_wallets_90 as (
    select tx_from[0] as wallet
    ,min(block_timestamp)::date as min_date
    from terra.transactions
    group by 1
    having min_date>=CURRENT_DATE-90
    )
    ,lst_tx_id as (
    select DISTINCT tx_id from terra.transactions
    where tx_from[0] in(select wallet from lst_wallets_90)
    )
    ,luna_bluna_price as (
    select
    date(block_timestamp) as date_block
    , symbol
    , avg(price_usd) as price_usd
    from terra.oracle_prices
    where symbol in ('LUNA', 'bLUNA')
    group by 1,2
    order by 1 desc
    ),
    price_pivoted as (
    select *
    from luna_bluna_price
    pivot(sum(price_usd) for symbol in ('bLUNA', 'LUNA'))
    as p (date_block, bLUNA, LUNA)
    order by date_block
    ),
    terraswap_withdraw as (
    -- withdraw bluna-luna pair on terraswap
    select
    event.block_timestamp,
    event.tx_id,
    -- event_attributes,
    event.event_attributes:"0_from"::string as sender,
    iff(event.event_attributes:refund_assets[0]:denom::string = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp', 'bLUNA', 'LUNA') as denom_0,
    Run a query to Download Data