winnie-fsLiq Flow - [24h] bridge 24h programs dist copy
    Updated 2023-06-22
    -- forked from marqu / Liq Flow - [24h] bridge 24h programs dist @ https://flipsidecrypto.xyz/marqu/q/AKOSaRUfdR85/liq-flow---24h-bridge-24h-programs-dist

    with

    wh_transfers as (

    select

    transfers.block_timestamp,
    transfers.tx_id,
    case
    when transfers.tx_from = 'GugU1tP7doLeTw9hQP51xRJyS8Da1fWxuiy2rVrnMD2m'
    then transfers.tx_to
    else transfers.tx_from
    end as user_address

    from solana.core.fact_transfers transfers
    inner join solana.core.fact_events events
    using(tx_id, block_timestamp)
    where events.succeeded
    and events.program_id = 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb'
    and transfers.amount > 0
    and transfers.tx_from = 'GugU1tP7doLeTw9hQP51xRJyS8Da1fWxuiy2rVrnMD2m'
    and transfers.block_timestamp ::date > current_date() - interval '{{months}} months'
    ),

    wh_mints as (

    select

    events.block_timestamp,
    events.tx_id,
    f_balances.value :owner ::string as user_address
    from solana.core.fact_events events
    inner join lateral flatten (input => events.inner_instruction :instructions) f_events
    Run a query to Download Data