Query editor
/* Payment cards — master monthly volume across all providers + chains.Bare-bones showcase query. Mirrors the 11 verification query bodies(CUR2-2118) and unions them into one shape. Will be replaced by`payments.card_transactions` once prod deploy is wired. */withgnosis_pay_raw as (select * from (values(0xcb444e90d8198415266c6a2724b7900fb12fc56e, 'EURe', date '2022-11-01', date '2024-08-25'),(0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430, 'EURe', date '2024-08-25', cast(null as date)),(0x5cb9073902f2035222b9749f8fb0c9bfe5527108, 'GBPe', date '2022-11-01', date '2024-08-25'),(0x8e34bfec4f6eb781f9743d9b4af99cd23f9b7053, 'GBPe', date '2024-08-25', cast(null as date)),(0x2a22f9c3b484c3629090feed35f17ff8f88f76f0, 'USDCe', date '2024-03-21', cast(null as date))) as t (contract_address, symbol, start_dt, end_dt)),gnosis_pay_fx as (select date as block_date, base_currency, exchange_ratefrom prices.fx_exchange_rateswhere target_currency = 'USD' and base_currency in ('EUR', 'GBP')),gnosis_pay_monthly as (selectdate_trunc('month', tr.block_date) as month,'gnosis_pay' as card_provider,'gnosis' as blockchain,count(*) as n_transactions,count(distinct tr."from") as unique_users,sum(coalesce(tr.amount_usd,case when tk.symbol = 'USDCe' then tr.amountwhen tk.symbol in ('EURe', 'GBPe') then tr.amount * fx.exchange_rate end)) as volume_usdfrom tokens_gnosis.transfers trinner join gnosis_pay_raw tkon tr.contract_address = tk.contract_addressand tr.block_date >= tk.start_dtand (tk.end_dt is null or tr.block_date <= tk.end_dt)left join gnosis_pay_fx fxon tr.block_date = fx.block_dateand case when tk.symbol = 'EURe' then 'EUR' when tk.symbol = 'GBPe' then 'GBP' end = fx.base_currencywhere tr."to" = 0x4822521e6135cd2599199c83ea35179229a172eeand tr."from" not in (0x2b33c1ab1fcd2b5f29bb7306ca5f1919ae06fa39, 0x9995bf91e32dce9c3d4608334451562b3ef8cc7f,0x9f6e8dec954873afc3dd3ab66c3617b5208dcf41, 0x3f4126bd41ca0d0f23bf9428bef08f3df416c402,0x514d3248b123ff9f0990aeaa2f3ccecdc0fd1453, 0x0c6eeb232800fb86215438c4f7ae032b5463586c)and tr.block_month >= date_trunc('month', date '2023-12-13')and tr.block_date >= date '2023-12-13'group by 1, 2, 3),cypher_transfers as (select 'arbitrum' as blockchain, block_date, amount_usd, "from" as senderfrom tokens_arbitrum.transferswhere "to" in (0xcfdAb76b36B33dA54c08314A9F265588B67170dc, 0xcCCd218A58B53C67fC17D8C87Cb90d83614e35fD,0x3cb7367aC1E6a439dA1f1717f8055f02E3C9d56e, 0x154E719D0513B015194b8C6977e524508bb35276,0x3fe1f351d4ba5f2e641325cdf73799868c13a085)and "from" not in (0xcfdAb76b36B33dA54c08314A9F265588B67170dc, 0xcCCd218A58B53C67fC17D8C87Cb90d83614e35fD,0x3cb7367aC1E6a439dA1f1717f8055f02E3C9d56e, 0x154E719D0513B015194b8C6977e524508bb35276,0x3fe1f351d4ba5f2e641325cdf73799868c13a085)and block_month >= date_trunc('month', date '2023-11-21') and block_date >= date '2023-11-21'union all