Query editor
-- EtherFi frxUSD: Campaign 1 — Hold & Transact (Scroll + Optimism)-- Reward: $50 to users who maintain >= $500 avg frxUSD balance-- for 30 days (starting the day AFTER they first reach $500) AND complete >= 10 Rain payments (all-time)-- Limited to first 50 qualifying users-- Tokens: frxUSD on Scroll (0x397F939C3b91A74C321ea7129396492bA9Cdce82)-- frxUSD on Optimism (0x80Eede496655FB9047dd39d9f418d5483ED600df)-- Balances and Rain settlements are summed across both chains for the mid-2026 migration.-- Balances include frxUSD the Safe supplied to Aave v4 (ether.fi Cash Lend, Aug 2026+),-- at principal (supplied minus withdrawn), so moving funds into lending doesn't-- look like the user dropping below $500.-- Rain payments include ones paid out of Aave via the LendGateway (Aug 2026+).---- Balance methodology: end-of-day balance (forward-filled across no-event days).-- An earlier version used worst intra-day MIN (matching minBalanceUsers.ts) but-- that misfires for cross-chain holders: a Scroll<->Optimism bridge burns on one-- chain then mints on the other moments later, so the combined ledger transiently-- hits $0 between the two events. End-of-day balance is fully restored, but the-- intra-day MIN captured the $0 and dragged the 30-day average down.WITH frxusd_xfers AS (-- Union frxUSD transfers across Scroll and Optimism. evt_block_number/evt_index-- are kept for intra-day ordering; we prefix with a per-chain offset so the two-- chains' block sequences never collide for a single address.SELECTevt_block_time,evt_block_number,evt_index,evt_tx_hash,"from","to",valueFROM erc20_scroll.evt_TransferWHERE contract_address = 0x397F939C3b91A74C321ea7129396492bA9Cdce82AND evt_block_time >= TIMESTAMP '2026-01-22'UNION ALLSELECTevt_block_time,evt_block_number,evt_index,evt_tx_hash,"from","to",valueFROM erc20_optimism.evt_transferWHERE contract_address = 0x80Eede496655FB9047dd39d9f418d5483ED600dfAND evt_block_time >= TIMESTAMP '2026-01-22'),-- EtherFi Cash Factory: 0xF4e147Db314947fC1275a8CbB6Cde48c510cd8CF-- Only wallets deployed by this factory (on either chain) qualify for the campaign.-- This filters out unrelated frxUSD holders on Optimism (a more active chain).---- Source of truth: the factory's SafeCreated event (topic0 = 0x5889…d586e).-- An earlier version walked creation_traces in a two-level pattern (factory ->-- beacon -> safe), but that missed real EtherFi safes deployed via CREATE2-- minimal proxies / different intermediary shapes. The event log is emitted-- by the factory contract on every safe deployment and is authoritative.etherfi_accounts AS (SELECT BYTEARRAY_SUBSTRING(topic1, 13, 20) AS addressFROM scroll.logs