klawRecurring Donors
    Updated 2024-03-29
    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,
    signer_id,
    receiver_id,
    try_parse_json(b.action_data):"deposit"::float / 1e24 as deposit,
    txns_donate.tx_fee::float / 1e24 as tx_fee
    from near.core.fact_actions_events b, txns_donate
    where b.tx_hash = txns_donate.tx_hash
    and b.action_name = 'Transfer'
    and b.receiver_id <> b.signer_id
    and receiver_id <> 'impact.sputnik-dao.near'
    QueryRunArchived: QueryRun has been archived