SELECT date_trunc('day', block_timestamp) AS metric_date,
event_from
FROM gold.near_events
WHERE (event_from IN(SELECT address FROM redshift.udm_address_tags WHERE blockchain = 'near') AND event_from_label_type IS NULL)
AND event_to_label_type = 'operator'
AND metric_date >= getdate() - interval '6 months'
AND event_from IS NOT NULL
AND event_to IS NOT NULL
AND event_from != 'failed'
AND event_to != 'failed'
AND (tx_type != 'failed' OR tx_type IS NULL)