WITH txns as
(select distinct tx_hash, transaction_fee as tx_fee
from near.core.fact_transactions b
where (tx_receiver = 'creatives.v1.potfactory.potlock.near'
or tx_signer = 'creatives.v1.potfactory.potlock.near')
and tx_succeeded = TRUE),
qmain as (
select block_timestamp,
b.tx_hash,
signer_id,
receiver_id,
method_name,
--args,
deposit / 1e24 as deposit
from near.core.fact_actions_events_function_call b, txns
where b.tx_hash = txns.tx_hash
),
approvied_time as (select *
from qmain
where method_name in ('is_registered')),
txns_r 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_r as ({{param_9ebR}}
select block_timestamp,
b.tx_hash,
signer_id,
--args,
deposit / 1e24 as deposit