cypherUntitled Query


    with temp as (
    select * as sum_balance
    from terra.daily_balances

    where balance > 0 and currency = 'LUNA'
    and address in (
    select
    distinct(
    CASE
    when event_attributes:from is not null then event_attributes:from
    when event_attributes:"0_borrower" is not null then event_attributes:"0_borrower"
    when event_attributes:seller is not null then event_attributes:seller
    when event_attributes:sender is not null then event_attributes:sender
    when event_attributes:minter is not null then event_attributes:minter
    when event_attributes:"0_from" is not null then event_attributes:"0_from"
    when event_attributes:"0_sender" is not null then event_attributes:"0_sender"
    when event_attributes:borrower is not null then event_attributes:borrower
    when event_attributes:owner is not null then event_attributes:owner
    when event_attributes:depositor is not null then event_attributes:depositor
    when event_attributes:voter is not null then event_attributes:voter
    end) as address
    from terra.msg_events
    where DATE_TRUNC('day',block_timestamp) >= getdate() - interval '90 days'
    and msg_type = 'wasm/MsgExecuteContract' and event_type='from_contract'
    and date = '2022-2-6'))
    order by balance desc
    limit 10


    Run a query to Download Data