CryptoLionTerra delegator churn dst
    Updated 2021-08-31
    with txs as (
    select
    tx_id,
    block_timestamp,
    event_amount_usd,
    currency
    from terra.staking
    where action = 'redelegate'
    and block_timestamp >= getdate() - interval '4 months'
    and tx_status = 'SUCCEEDED'
    order by block_timestamp desc),
    flabel as (
    select
    mg.tx_id,
    mg.block_timestamp,
    msg_value:validator_dst_address as dst,
    label as dst_label,
    msg_value:validator_src_address as src,
    msg_value:delegator_address as delegator
    -- msg_value/
    from terra.msgs mg
    inner join txs on mg.tx_id = txs.tx_id
    inner join terra.validator_labels on operator_address = msg_value:validator_dst_address
    order by mg.block_timestamp desc),
    data as (
    select
    f.tx_id,
    f.block_timestamp,
    dst,
    dst_label,
    src,
    label as src_label,
    delegator,
    event_amount_usd
    from flabel f
    inner join terra.validator_labels on operator_address = src
    Run a query to Download Data