Monitize AIWell retention final
    Updated 2024-07-15
    WITH claims AS (
    SELECT
    distinct TO_ADDRESS as claimant_wallet,
    min(Block_timestamp::date) as claimed_date,
    sum(amount) as Claimed_Amount
    from ethereum.core.ez_token_transfers
    where CONTRACT_ADDRESS = lower('0x63696Fc66795B51d02c1590b536484A41fbDDF9a')
    and FROM_ADDRESS in ('0x3db08a08434bfb774271e46d277468f8da0da144')
    and ORIGIN_FUNCTION_SIGNATURE = '0xf0fd1084'
    group by 1
    ),

    cext as (
    select
    distinct address
    FROM ethereum.core.ez_token_transfers
    join ethereum.core.dim_labels on TO_ADDRESS = address
    WHERE contract_address = lower('0x63696Fc66795B51d02c1590b536484A41fbDDF9a')
    and LABEL_TYPE = 'cex'
    and LABEL_SUBTYPE = 'hot_wallet'
    ),

    dext as (
    select
    distinct TX_HASH
    from ethereum.defi.ez_dex_swaps
    where token_in = lower('0x63696Fc66795B51d02c1590b536484A41fbDDF9a')
    ),

    stakert as (
    select
    distinct FROM_ADDRESS as staker,
    TX_HASH as stake_tx,
    BLOCK_TIMESTAMP as stake_date,
    AMOUNT as stake_amount
    from ethereum.core.ez_token_transfers
    QueryRunArchived: QueryRun has been archived