Query editor
WITH staking_events AS (SELECTsm."to" as staker,sm.evt_tx_hash,sm.evt_block_time,sm.evt_block_number,CAST(sm.value AS DECIMAL(38,0)) / 1e18 as stprove_amount,CAST(prove_tx.value AS DECIMAL(38,0)) / 1e18 as prove_amount,CAST(ipt.value AS DECIMAL(38,0)) / 1e18 as ipt_amountFROM erc20_ethereum.evt_Transfer smJOIN erc20_ethereum.evt_Transfer ipt ON sm.evt_tx_hash = ipt.evt_tx_hashJOIN erc20_ethereum.evt_Transfer prove_tx ON sm.evt_tx_hash = prove_tx.evt_tx_hashWHERE sm.contract_address = 0x59A2d7b0421bA13F57bF012f46C58ab5a65B1d3CAND sm."from" = 0x0000000000000000000000000000000000000000AND ipt.contract_address = 0x04ece2a2c3ea68356274f37c096258c7a9e72fa1AND ipt."to" = 0x4eac32f0a25ea9d7f22d1aa40735cb761c672bd6AND prove_tx.contract_address = 0x6bef15d938d4e72056ac92ea4bdd0d76b1c4ad29AND prove_tx."to" = 0x04ece2a2c3ea68356274f37c096258c7a9e72fa1),cooldown_unstakes AS (SELECT"from" as staker,evt_tx_hash,evt_block_time,CAST(value AS DECIMAL(38,0)) / 1e18 as cooldown_amountFROM erc20_ethereum.evt_TransferWHERE contract_address = 0x59A2d7b0421bA13F57bF012f46C58ab5a65B1d3CAND "to" = 0x0000000000000000000000000000000000000000AND "from" != 0x0000000000000000000000000000000000000000),full_unstakes AS (SELECT"to" as staker,evt_tx_hash,evt_block_time,CAST(value AS DECIMAL(38,0)) / 1e18 as unstake_amountFROM erc20_ethereum.evt_TransferWHERE contract_address = 0x6bef15d938d4e72056ac92ea4bdd0d76b1c4ad29AND "from" = 0x04ece2a2c3ea68356274f37c096258c7a9e72fa1AND "to" != 0x04ece2a2c3ea68356274f37c096258c7a9e72fa1AND "to" != 0x0000000000000000000000000000000000000000),price_data AS (SELECTAVG(price) as current_priceFROM (SELECTCASEWHEN token_bought_address = 0x6bef15d938d4e72056ac92ea4bdd0d76b1c4ad29THEN amount_usd / NULLIF(token_bought_amount, 0)WHEN token_sold_address = 0x6bef15d938d4e72056ac92ea4bdd0d76b1c4ad29THEN amount_usd / NULLIF(token_sold_amount, 0)END as priceFROM dex.tradesWHERE project_contract_address IN (0x7aed0a7bf286abc736959fd42acc27d80b0507d6d3053755359ae459ac27743f, -- PROVE/USDC0xf6d500fc33e0865ff1c1c6c58a2c9e247db2e5df007c080f6664a9375f374ff1, -- PROVE/USDT0xc76cdb74d781e219e8c8855a99584dd2e4580046 -- PROVE/WETH)AND blockchain = 'ethereum'