winnie-fsABC/Und Staking - [abc] fp copy copy
    Updated 2023-03-09
    -- forked from f580af12-3d35-481b-ba85-0c541f4a2f35

    with

    abc_mints as (

    select instruction :accounts[5] ::string as mint
    from solana.core.fact_events
    where succeeded
    and block_timestamp ::date = '2022-08-21' ::date
    and program_id = 'cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ' -- Candy Machine Program ID
    and instruction :accounts[0] = 'Gp1MTXdKKRDLC8fDVqU3SKFQ1cGqMq47VCA2bDpnMCkb' -- Candy Machine
    and instruction :accounts[1] = 'GVkb5GuwGKydA4xXLT9PNpx63h7bhFNrDLQSxi6j5NuF' -- CM Creator
    and instruction :accounts[6] = 'CMAWeiRp4sYJVDJA7XAy4qyvX2ovLX848x4Qj5H3nK7D' -- Mint Authority
    ),

    sol_prices as (

    select

    date_trunc('day',recorded_hour) as date,
    avg(close) as price_sol

    from solana.core.fact_token_prices_hourly
    where symbol = 'SOL'
    and recorded_hour > '2022-08-21' ::date
    and recorded_hour ::date > current_date() - interval '{{months}} months'
    group by 1
    ),

    floor_prices as (

    select

    date_trunc('day',block_timestamp) as date,
    percentile_cont(0.1) within group (order by sales_amount) as floor
    Run a query to Download Data