Flipside TeamStaged Contracts copy
    Updated 2024-09-06
    -- forked from contractbrowser / Staged Contracts @ https://flipsidecrypto.xyz/contractbrowser/q/yjogMPpjP7lT/staged-contracts
    -- Visualization of valid staged contracts.
    -- Staging Events:
    -- Stage: Counted as staged.
    -- Replace: Counted as staged.
    -- Unstage: Not counted as staged.
    -- Contracts that have not historically had Stage/Replace events: Not counted as staged.
    WITH StagedContracts AS (
    SELECT
    DISTINCT event_data:contract AS contract
    FROM
    flow.core.fact_events
    WHERE
    block_timestamp > '2024-04-01'
    AND event_type ILIKE '%StagingStatusUpdated%'
    AND event_contract = 'A.56100d46aa9b0212.MigrationContractStaging'
    AND event_data:action = 'stage'
    )
    SELECT
    x.event_contract as contract,
    CASE
    WHEN x.contract_name IN (
    'FlowEpoch',
    'FlowIDTableStaking',
    'FlowQC',
    'FlowDKG',
    'FlowServiceAccount',
    'NodeVersionBeacon',
    'RandomBeaconHistory',
    'FlowStorageFees',
    'FlowStakingCollection',
    'StakingProxy',
    'LockedTokens',
    'FlowFees',
    'FlowToken',
    'FungibleToken',
    Auto-refreshes every 12 hours
    QueryRunArchived: QueryRun has been archived