freemartianCumulative LP Users
    Updated 2023-06-22
    with stake AS (
    SELECT
    date_trunc('day', block_timestamp::date) AS time,
    count(distinct from_address) AS staking_user
    FROM optimism.core.fact_token_transfers
    WHERE to_address = '0xd5a8f233cbddb40368d55c3320644fb36e597002'
    AND contract_address = '0x7f5c764cbc14f9669b88837ca1490cca17c31607'
    --AND origin_to_address = '0xd5a8f233cbddb40368d55c3320644fb36e597002'
    GROUP BY time),

    unstake AS (
    SELECT
    date_trunc('day', block_timestamp::date) AS time,
    count(distinct to_address) AS unstaking_user
    FROM optimism.core.fact_token_transfers
    WHERE from_address = '0xd5a8f233cbddb40368d55c3320644fb36e597002'
    AND contract_address = '0x7f5c764cbc14f9669b88837ca1490cca17c31607'
    --AND origin_to_address = '0xd5a8f233cbddb40368d55c3320644fb36e597002'
    GROUP BY time)

    SELECT
    s.time,
    sum(staking_user) over(ORDER BY s.time) AS Liquidity_Provider_users,
    sum(unstaking_user) over(ORDER BY s.time) AS Liquidity_Remover_users
    FROM stake s INNER JOIN unstake u on s.time = u.time
    Run a query to Download Data