Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/WITHadditions as (SELECTdate_trunc('minute', evt_block_time) as time,cast(value as double)/1e18 AS WETH_amount,evt_tx_hashFROM erc20_arbitrum.evt_TransferWHERE "to" = 0x0C1Cf6883efA1B496B01f654E247B9b419873054 --sushi WETH/DPX poolAND contract_address = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 --WETH_address),gas_amount AS (SELECThash,date_trunc ('minute', block_time) as time,gas_used/1E10 as gas_eth -- gas_amount in ethFROM arbitrum.transactionsWHERE hash in (SELECTevt_tx_hashFROM erc20_arbitrum.evt_TransferWHERE "to" = 0x0C1Cf6883efA1B496B01f654E247B9b419873054 --sushi WETH/DPX poolAND contract_address = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 --WETH_address)),weth_price AS (SELECTdate_trunc('minute' , minute) AS time,AVG(price) AS priceFROM prices.usdWHERE contract_address = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 AND blockchain = 'arbitrum'GROUP BY 1)SELECTa.time AS event_time,a.evt_tx_hash as hash,a.WETH_amount * p.price * 2 AS added_lp_amountinUSD,g.gas_eth*p.price AS gas_used_inUSDFROM additions aLEFT JOIN weth_price p ON a.time = p.timeLEFT JOIN gas_amount g ON a.evt_tx_hash = g.hash