PotLockProject Registration Until First Donation
    Updated 2024-05-20
    -- forked from brian-terra / All Potlock Registers @ https://flipsidecrypto.xyz/brian-terra/q/_CbXCPpmisyW/all-potlock-registers

    -- forked from All Potlock Donations @ https://flipsidecrypto.xyz/edit/queries/9297bc52-b0cc-4a3c-b2bc-dcd99993c7be

    WITH txns as
    (select distinct tx_hash, transaction_fee as tx_fee
    from near.core.fact_transactions b
    where (tx_receiver = 'registry.potlock.near'
    or tx_signer = 'registry.potlock.near')
    and tx_succeeded = TRUE)
    ,
    qmain as (
    select block_timestamp,
    b.tx_hash,
    signer_id,
    --args,
    deposit / 1e24 as deposit
    from near.core.fact_actions_events_function_call b, txns
    where b.tx_hash = txns.tx_hash
    and method_name = 'register'
    ),

    txns_donate as
    (select distinct a.tx_hash, transaction_fee as tx_fee
    from near.core.fact_actions_events_function_call a, near.core.fact_transactions b
    where receiver_id = 'donate.potlock.near'
    and method_name = 'donate'
    and a.tx_hash = b.tx_hash
    and tx_succeeded = TRUE)
    ,
    qmain_donate as (
    select block_timestamp,
    b.action_name,
    signer_id,
    receiver_id,
    try_parse_json(b.action_data):"deposit"::float / 1e24 as deposit,
    QueryRunArchived: QueryRun has been archived