Pine Analyticssilky-scarlet copy
    Updated 2025-01-23
    -- forked from silky-scarlet @ https://flipsidecrypto.xyz/studio/queries/6fc6ef3e-9a45-4dc5-aa5e-a34df5dec0b2

    WITH log_data AS (
    SELECT
    signers[0] as wallet,
    tx_id as tx
    FROM
    eclipse.core.fact_transactions t,
    TABLE(FLATTEN(log_messages)) f
    WHERE SUCCEEDED
    AND value in ('Program log: Instruction: SwapV2', 'Program log: Instruction: TwoHopSwapV2')
    ), tab1 as (
    SELECT
    tx_id,
    block_timestamp,
    wallet,
    mint as mint_out,
    amount/power(10, decimal) as out_amount
    from eclipse.core.fact_transfers
    left outer join log_data
    on tx = tx_id
    where tx_id in (SELECT tx from log_data)
    and wallet = tx_to
    ), tab2 as (
    SELECT
    tx_id as tx,
    mint as mint_in,
    amount/power(10, decimal) as in_amount
    from eclipse.core.fact_transfers
    left outer join log_data
    on tx = tx_id
    where tx_id in (SELECT tx from log_data)
    and wallet = tx_from
    ), tab3 as (
    Last run: 2 months ago
    SWAP_VOLUME_GROUP
    WALLETS
    SWAP_VOLUME
    1
    f/ 100K+306383586467.943594
    2
    b/ 10-100847203485933.9351479
    3
    a/ Below 1067485257028.982850417
    4
    e/ 10K-100K4534103841846.406395
    5
    d/ 1K-10K2550676941123.0179269
    6
    c/ 100-1K8092026896819.6271506
    6
    222B
    520s