KaskoazulLuart Top 10 NFT Sales
    Updated 2022-02-10
    WITH
    SALES_USD AS(
    SELECT
    e.block_timestamp,
    e.tx_id,
    e.event_attributes:"price"/pow(10,6) as PRICE_USD
    FROM
    terra.msg_events e
    WHERE
    e.block_timestamp >= '2021-12-27'
    AND e.event_attributes:"0_contract_address" = 'terra1fj44gmt0rtphu623zxge7u3t85qy0jg6p5ucnk' --Luart Contract Address
    AND e.event_type = 'wasm'
    AND e.event_attributes:"order_type" = 'sell'
    AND e.event_attributes:"method" = 'execute_order'
    AND e.event_attributes:"denom" = 'uusd'
    ORDER BY PRICE_USD DESC
    LIMIT 10
    ),
    SALES_LUNA AS(
    SELECT
    e.block_timestamp,
    e.tx_id,
    e.event_attributes:"0_token_id",
    e.event_attributes:"price"/pow(10,6)*p.price_usd as PRICE_USD,
    e.event_attributes:"price"/pow(10,6) as PRICE_LUNA,
    p.price_usd as EXCHANGE
    FROM
    terra.msg_events e
    INNER JOIN terra.oracle_prices p
    ON e.block_timestamp::date = p.block_timestamp AND symbol = 'LUNA'
    WHERE
    e.block_timestamp >= '2021-12-27'
    AND e.event_attributes:"0_contract_address" = 'terra1fj44gmt0rtphu623zxge7u3t85qy0jg6p5ucnk' --Luart Contract Address
    AND e.event_type = 'wasm'
    AND e.event_attributes:"order_type" = 'sell'
    AND e.event_attributes:"method" = 'execute_order'
    Run a query to Download Data