0xHaM-dLPer Pool Count
    Updated 2024-06-01
    -- forked from LPer Pool Count @ https://flipsidecrypto.xyz/edit/queries/e8cef7e5-141d-4cdd-ad9f-cca451217a8f

    -- forked from Playwo / LPer Pool Count @ https://flipsidecrypto.xyz/Playwo/q/Bv4PRZ4tFwAi/lper-pool-count

    WITH timeframe AS (
    SELECT date_day AS date
    FROM crosschain.core.dim_dates
    WHERE date_day >= TO_DATE('{{start_date}}')
    AND date_day < CURRENT_DATE()
    ),
    levana_contracts AS (
    SELECT $1 AS contract_address, $2 AS asset, $3 AS asset_decimals
    FROM (VALUES
    ('sei1jvl8avv45sj92q9x9c84fq2ymddya6dkwv9euf7y365tkzma38zq5xldpy', 'ETH', 6),
    ('sei1zjryrejvtufeaaer7w55fxgxurqnajwlshdpuqf5lp4j00uzek8s6sktv3', 'ETH', 6),
    ('sei1rl9z38s9t853jddjfexxkqqpq5d5wpzrqudfg7ruchzymxhms7pq39j645', 'ETH', 6),
    ('sei14j7zhcj50qsk6vhu7dsa48r5e7v37nthnwwx0q8q4nd0h39udy6qhqq6dm','SEI', 6),
    ('sei1tasaxmw8axfmcmzg2m9zp24msuurfkz3m44mga2dl98eh0txcxjspw9rga','BTC', 6),
    ('sei1teg8l8lanhkdxcdffg9anrzt3hhv9d8967ajczlrq3lzdrkzczsskh6733','SOL', 6)
    )
    ),
    lp_actions AS (
    SELECT a__contract_address.tx_id, a__contract_address.block_timestamp,
    a__contract_address.attribute_value AS contract,
    a_addr.attribute_value AS user,
    a_collateral.attribute_value AS collateral,
    a_collateral_usd.attribute_value AS collateral_usd,
    a_tokens.attribute_value AS tokens,
    a_kind.attribute_value AS kind
    FROM
    sei.core.fact_msg_attributes AS a__contract_address,
    sei.core.fact_msg_attributes AS a_addr,
    sei.core.fact_msg_attributes AS a_collateral,
    sei.core.fact_msg_attributes AS a_collateral_usd,
    sei.core.fact_msg_attributes AS a_tokens,
    sei.core.fact_msg_attributes AS a_kind
    QueryRunArchived: QueryRun has been archived