BlockTrackerTop Users by the Volume of Net Deposit (total deposit - total withdraw) copy
    Updated 2023-08-28
    SELECT *
    FROM (
    with t_txs as(
    SELECT
    DISTINCT tx_id ,
    block_timestamp
    FROM sei.core.fact_msg_attributes
    WHERE ATTRIBUTE_KEY = '_contract_address'
    AND ATTRIBUTE_VALUE = 'sei1d9fgdm2vgcknz5prdumkg5apml0vv3lfulkfd0gn07uesysek74sn34hjw'
    )
    ,
    add_liquidity as (
    SELECT
    tx_id
    FROM sei.core.fact_msg_attributes
    WHERE tx_id IN (SELECT tx_id FROM t_txs)
    AND ATTRIBUTE_KEY = 'action' AND ATTRIBUTE_VALUE = 'mint'
    )
    ,
    tokens as (
    SELECT
    tx_id,
    ATTRIBUTE_VALUE as token
    FROM sei.core.fact_msg_attributes
    WHERE ATTRIBUTE_KEY = 'amount' AND msg_type = 'transfer' AND msg_index = 8
    AND tx_id IN (SELECT tx_id FROM add_liquidity)
    ),
    trader as (
    SELECT
    tx_id,
    ATTRIBUTE_VALUE as user
    FROM sei.core.fact_msg_attributes
    WHERE tx_id IN (SELECT tx_id FROM add_liquidity)
    AND ATTRIBUTE_KEY = 'sender' AND msg_type = 'message'
    ),
    liqudity_recieved as (
    Run a query to Download Data