BlockTrackertotal affiliate fee
    Updated 2025-06-09
    with pools_count as (
    select
    tx_id,
    count(DISTINCT pool_name) as n_pools
    from maya.defi.fact_swaps
    group by 1
    )
    ,
    init as (
    select
    block_timestamp,
    tx_id,
    from_amount_usd,
    to_amount_usd,
    from_address,
    array_size(affiliate_addresses_array) as aff_adds_count,
    case
    when aff_adds_count > 1 and affiliate_address = '_' then affiliate_addresses_array[1]
    else affiliate_address
    end as affiliate_address,
    case
    when aff_adds_count > 1 and affiliate_address = '_' then AFFILIATE_FEE_BASIS_POINTS_ARRAY[1]
    else AFFILIATE_FEE_BASIS_POINTS end as AFFILIATE_FEE_BASIS_POINTS,
    b.n_pools
    from maya.defi.fact_swaps a
    left join pools_count b using(tx_id)
    where tx_id not in (select tx_id from maya.defi.fact_refund_events)
    )
    ,

    affiliate as (
    select
    case
    when affiliate_address = 'ts' then 'ThorSwap'
    when affiliate_address = 'wr' then 'THORWallet'
    when affiliate_address = 'dx' then 'Asgardex'
    Last run: 24 days ago
    All Time Affiliate Earning $
    30 Days Affiliate Earning $
    7 Days Affiliate Earning $
    24 Hours Affiliate Earning $
    1
    551069.443910.4641.770.61
    1
    32B
    7s