CryptoLionTerra Governance Proposals
    Updated 2021-08-23
    with counts as (select
    date_trunc('month',block_timestamp) as month,
    sum(case when proposal_type like '%Text%' then 1 else 0 end) as text_porposals,
    sum(case when proposal_type not like '%Text%' then 1 else 0 end) as param_proposals,
    -- sum(case when proposal_type like '%Text%' then deposit_amount_usd else 0 end) as text_deposits,
    -- sum(case when proposal_type not like '%Text%' then deposit_amount_usd else 0 end) as param_deposits,
    count(distinct proposer) as proposers
    from terra.gov_submit_proposal
    group by 1),
    delegates as (
    select
    date_trunc('month',block_timestamp) as month,
    count(distinct delegator_address) as delegators,
    sum(case when action = 'delegate' then event_amount_usd else 0 end) as volume,
    sum(volume) over (order by month) as running_volume
    from terra.staking
    group by 1
    order by 1 desc),
    transactions as (
    select
    date_trunc('month',block_timestamp) as month,
    count(distinct tx_id) as transactions,
    lag(transactions) ignore nulls over (order by month) as l_transactions,
    (transactions-l_transactions)/l_transactions*100 as percentage_change
    from terra.transactions
    group by 1
    order by 1 desc
    )
    select
    d.month,
    delegators,
    volume,
    running_volume,
    text_porposals,
    param_proposals,
    proposers,
    Run a query to Download Data