SELECT
ens.ens_domain ens_name,
CASE
WHEN ens_name IS NULL THEN 'No Name'
ELSE ens_name
END AS name,
tr.origin_from_address users,
sum(ABS(amount_in_usd) + ABS(amount_out_usd)) / 2 Amount_By_User
FROM
base.defi.ez_dex_swaps tr FULL
JOIN ethereum.ens.ez_ens_domains ens ON tr.origin_from_address = ens.owner
WHERE
amount_in_usd IS NOT NULL
AND amount_out_usd IS NOT NULL
GROUP BY
1,
3
ORDER BY
4 DESC
LIMIT
10