Query editor
/*project start 2021-03-21Edit time filter in the swap cte for a full history*//*assuming pool creation fee is always 0.15 SOL as per the docsshould join on transfers with to_owner = account_arguments[15]NOTE: raydium_amm_call_initialize2 is not mapping accounts name correctly*/WITH prices AS (SELECT price, timestamp as dayFROM prices.dayWHERE contract_address = 0x0000000000000000000000000000000000000000and blockchain = 'solana')select'Raydium V4' as protocol, 'Dexs' as Category, date_trunc('month',call_block_time) as block_time--, call_tx_signer as user, SUM(0.15* price) as revenuefrom raydium_amm_solana.raydium_amm_call_initialize2 aLEFT JOIN prices b ON date_trunc('day',a.call_block_time) = b.daywhere 1 = 1--and call_tx_id = '2VqEgcLKd9sDzU9HHMSNzb4hMRxFKSjaGrGss6D6W6MuEcT5ijz12tor4bSo11r29e2XWYsogFjjNvBiFmMcw8qH'and call_block_date >= date '2023-03-21'GROUP BY 1,2,3union allselect'Raydium V4' as protocol, 'Dexs' as Category, date_trunc('month',block_time) as block_time--, trader_id as user/* For the AMM v4 Raydium only takes the 12% for RAY buybacks. No % for the treasury as in the CLMM */, sum(amount_usd) * 0.03 / 100 as revenuefrom dex_solana.tradeswhere 1 = 1and project_main_id = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'and block_date >= date '2021-03-21'/*remove filter below for a full history*/--and block_date >= current_date - interval '7' daygroup by 1, 2, 3