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/-- вот отсюда будет проще всего вытащить https://dune.com/queries/1088111/1863399--вроде даже вснужные расчеты есть, надо просто вытащить и по-другому упаковатьwith LIDO_stMATIC_staking_txns as(--staking txnsselect to as wallet,CAST(value as DOUBLE) /1e18 as amount,evt_block_time as timefrom lido_ethereum.StMATIC_evt_Transferwhere "from" = 0x0000000000000000000000000000000000000000), LIDO_stMATIC_unstaking_txns as(--unstaking txnsselect "from" as wallet,CAST(value as DOUBLE)/1e18 * -1 as amount,evt_block_time as timefrom lido_ethereum.StMATIC_evt_Transferwhere to = 0x0000000000000000000000000000000000000000),prices as --MATIC/stMATIC(selecttime,sum (price*amount) / sum(amount) as weight_avg_pricefrom(selectdate_trunc('day',evt_block_time) as time,CAST(_amount as double)/1e18 / --MATIC staked amount(select CAST(value as DOUBLE)/1e18from lido_ethereum.StMATIC_evt_Transfer l2where l2.evt_tx_hash = l1.evt_tx_hash-- and "contract_address" = '\x9ee91F9f426fA633d227f7a9b000E28b9dfd8599'and l2.to = l1._from) --stMATIC minted amountas price, --MATIC/stMATICCAST(_amount as DOUBLE) /1e18 as amount --MATIC staked amountfrom lido_ethereum.StMATIC_evt_SubmitEvent l1) ttgroup by 1),prices_with_lead as --MATIC/stMATIC(select time, lead(time, 1, date_trunc('day',now() + interval '24' hour)) over (order by time) as next_time,weight_avg_pricefrom prices),LIDO_MATIC_staking_amounts AS (SELECTt.wallet,