messariOverall Dexalot Swaps (Avalanche) copy
    Updated 2024-12-02
    -- forked from Ali3N / Overall Dexalot Swaps (Avalanche) @ https://flipsidecrypto.xyz/Ali3N/q/trWWRV0mw9DS/overall-dexalot-swaps-avalanche

    -- forked from cloudr3n / SimpleSwap Metrics @ https://flipsidecrypto.xyz/cloudr3n/q/Rwx7F-keRLBL/simpleswap-metrics

    -- taker asset = token in
    -- updated with new contract on MAY2024

    with SimpleSwap as (
    SELECT
    block_timestamp,
    tx_hash,
    decoded_log:maker as maker,
    decoded_log:makerAsset as makerAsset,
    decoded_log:makerAmountReceived as makerAmountReceived,
    decoded_log:taker as taker,
    decoded_log:takerAsset as takerAsset,
    decoded_log:takerAmountReceived as takerAmountReceived,
    decoded_log
    FROM
    avalanche.core.ez_decoded_event_logs
    WHERE
    contract_address='0xeed3c159f3a96ab8d41c8b9ca49ee1e5071a7cdd' and event_name='SwapExecuted'
    ),

    token as (
    select * FROM
    (
    SELECT
    address as token_address, symbol, decimals
    FROM
    avalanche.core.dim_contracts
    where
    address in (select distinct (address) from (select distinct makerAsset as address from SimpleSwap union all select distinct takerAsset as address from SimpleSwap))
    )
    union all
    select '0x0000000000000000000000000000000000000000' as token_address, 'AVAX' as symbol, 18 as decimals
    QueryRunArchived: QueryRun has been archived