Query editor
WITHgas_usage AS (SELECTDATE_TRUNC('day', block_time) AS txn_day,"from" AS wallet,gas_used,gas_price,(gas_used * gas_price / 1e18) AS total_gas_cost_ETHFROMethereum.transactionsWHERE"from" = 0x7f3B192Ab3220940D66236792F3EBDB0e4E74138 /* Biconomy Deployer 1 */OR "from" = 0x0a4061B2511A51c240cd03a3e2f78B99dEc48553 -- Biconomy: Community Rewards And IncentivesOR "from" = 0x48d601D601eD4cde44dd688573e2235aEa333BA2 /* Biconomy: Vesting Wallet */OR "from" = 0x84a0856b038eaAd1cC7E297cF34A7e72685A8693 /* Biconomy: Forwarder */OR "from" = 0xfAAdBe5F0A19f0Ebf92AEb73534cBc96B96e2bDa /* Biconomy: Forwarder */OR "from" = 0x6781dBfdbD6a2803E1698c6e705659D3b597f643 /* Biconomy: Gas Tank */OR "from" = 0x2A5c2568b10A0E826BfA892Cf21BA7218310180b /* Biconomy: Liquidity Pool */),daily_eth_price AS (SELECTDATE_TRUNC('day', minute) AS price_day,AVG(price) AS avg_price_usd /* Averaging in case there are multiple entries per day */FROMprices.usdWHEREblockchain = 'ethereum'AND contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 --USE WETH price to reflect ETH priceGROUP BYDATE_TRUNC('day', minute))SELECTg.txn_day,p.avg_price_usd,SUM(g.gas_used) AS total_gas_used,AVG(g.gas_price) AS average_gas_price,SUM(g.total_gas_cost_ETH) AS total_spent_on_gas_ETH,(SUM(g.total_gas_cost_ETH)) * p.avg_price_usd AS total_spent_on_gas_usdFROMgas_usage AS gJOIN daily_eth_price AS p ON g.txn_day = p.price_dayGROUP BYg.txn_day,p.avg_price_usdORDER BYg.txn_day DESC