BlockTrackerLeaderboard staking seaswap based on volume
    Updated 2023-08-28
    with t_txs as(
    SELECT
    DISTINCT tx_id,
    block_timestamp
    FROM sei.core.fact_msg_attributes
    WHERE ATTRIBUTE_KEY = '_contract_address'
    AND ATTRIBUTE_VALUE = 'sei1p53uevq2yajw89fsa7h2th8jhxzjd90eatzyx5zfuml9ntcklazssrn8jr'
    )
    ,
    stake 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 = 'send'
    )
    ,
    traders as (
    SELECT
    tx_id,
    ATTRIBUTE_VALUE as trader
    FROM sei.core.fact_msg_attributes
    WHERE tx_id IN (SELECT tx_id FROM stake)
    AND ATTRIBUTE_KEY = 'from'
    )
    ,
    amounts as (
    SELECT
    tx_id,
    ATTRIBUTE_VALUE as amount
    FROM sei.core.fact_msg_attributes
    WHERE tx_id IN (SELECT tx_id FROM stake)
    AND ATTRIBUTE_KEY = 'amount' AND msg_type = 'wasm' AND msg_index = 9
    ),
    token_price as (
    SELECT
    Run a query to Download Data