Query editor
WITH CurrentPrice AS (SELECTprice AS eth_priceFROM prices.usdWHEREsymbol = 'WETH'ORDER BYminute DESCLIMIT 1),bondTransactions AS (SELECTt."from",t.hash,t.value / 1e18 AS value_eth,p.eth_priceFROM ethereum.transactions AS tLEFT JOIN CurrentPrice AS pON TRUEWHEREt."to" = 0x4f4Bfa0861F62309934a5551E0B2541Ee82fdcF1 AND t.value > 0),CurrentSdPrice AS (SELECTprice AS sd_priceFROM prices.usdWHEREsymbol = 'SD'ORDER BYminute DESCLIMIT 1),bondSdTransactions AS (SELECTsd."from",sd.evt_tx_hash,sd.value / 1e18 AS value_sd,psd.sd_priceFROM erc20_ethereum.evt_Transfer AS sdLEFT JOIN CurrentSdPrice AS psdON TRUEWHEREsd."to" = 0x7af4730cc8ebad1a050dcad5c03c33d2793ee91f)SELECTCOALESCE(bt."from", bst."from") AS "from_address",SUM(bt.value_eth) AS eth_bonded,ROUND(SUM(bt.value_eth * bt.eth_price)) AS usd_bonded_eth,SUM(bst.value_sd) AS sd_bonded,ROUND(SUM(bst.value_sd * bst.sd_price)) AS usd_bonded_sdFROM bondTransactions AS btFULL OUTER JOIN bondSdTransactions AS bstON bt."from" = bst."from"GROUP BYCOALESCE(bt."from", bst."from")ORDER BYeth_bonded DESC;