Monitize AIPirate Nation retention final 1
    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('0x7613c48e0cd50e42dd9bf0f6c235063145f6f8dc')
    and FROM_ADDRESS = lower('0x543ba3e063197b3025a4b2751e9b4b6a2489fa07')
    group by 1
    order by 3 desc
    ),

    balancet as (
    SELECT
    user_address as holder,
    current_bal as Holding_Volume
    from ethereum.core.ez_current_balances
    join claims on user_address = claimant_wallet
    where CONTRACT_ADDRESS = lower('0x7613c48e0cd50e42dd9bf0f6c235063145f6f8dc')
    and current_bal > 0
    ),

    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
    where CONTRACT_ADDRESS = lower('0x7613c48e0cd50e42dd9bf0f6c235063145f6f8dc')
    and TO_ADDRESS = lower('0x6759acd57cb5ea451a3edf397734edddfc123049')
    ),

    cext as (
    select
    distinct address
    QueryRunArchived: QueryRun has been archived