Query editor
-- ============================================================================-- Treehouse | TREE staking by DOR panelist-- ------------------------------------------------------------------------------ Contract: DorStaking, ERC1967 proxy 0x478bf562b2a39ff8530ee41ff0dfb39d8bdd2192-- implementation 0xC1B6a630Ae2252eac7b0B8c7F4A174B4d7f51023-- NOT decoded on Dune, so events are decoded manually from ethereum.logs.---- Event layouts (verified against the deployed ABI):-- DelegatorStaked(address idx delegator, address idx panelist,-- uint256 amount, uint256 newActiveStake)-- 0x905da5706ac3468f40ede65e8b1662bdea927681946dad066d47da2b9d5c1a50-- topic1=delegator, topic2=panelist, data = amount || newActiveStake-- PanelistStaked(address idx panelist, uint256 amount, uint256 newActiveStake)-- 0xa33c81e77010693bbdd48d99373844615c42af8f5073596c745feb9fcf0847f8-- topic1=panelist, data = amount || newActiveStake-- RedemptionRequested(address idx user, bool isPanelist, address idx panelist,-- uint256 amount, uint256 claimableAt)-- 0xb286a066f2bc3141da5990f5ce561eb9dedf4a5833062b5a59742a3c205d8fc1-- topic1=user, topic2=panelist, data = isPanelist || amount || claimableAt-- PanelistRegistered(address idx panelist)-- 0x921720d6f940d36891266254882d4c79440493bf7c260630d2286535e88ce384-- PanelistDeactivated(address idx panelist, uint256 claimableAt)-- 0x9bd4aff27d1f649385ed2b6f414e2a51f70740a2859228a67890aa65afa63bb5---- ACTIVE STAKE = staked - redemption requested. A redemption request removes-- stake immediately (it enters a REDEMPTION_PERIOD before it can be claimed),-- so requests are netted off rather than claims. Netting claims instead would-- double count stake still in the cooldown queue.---- NOTE: stakeAsPanelist() has never been called on this contract. Panelist-- active stake therefore comes entirely from operator-side registration-- rather than panelists staking their own TREE. If that changes, the-- PanelistStaked leg below will start populating automatically.-- ============================================================================WITH del_flows AS (SELECT bytearray_substring(topic1, 13, 20) AS delegator,bytearray_substring(topic2, 13, 20) AS panelist,CAST(bytearray_to_uint256(bytearray_substring(data, 1, 32)) AS DOUBLE) / 1e18 AS amtFROM ethereum.logsWHERE contract_address = 0x478bf562b2a39ff8530ee41ff0dfb39d8bdd2192AND block_date >= DATE '2026-04-01'AND topic0 = 0x905da5706ac3468f40ede65e8b1662bdea927681946dad066d47da2b9d5c1a50UNION ALLSELECT bytearray_substring(topic1, 13, 20),bytearray_substring(topic2, 13, 20),-CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18FROM ethereum.logsWHERE contract_address = 0x478bf562b2a39ff8530ee41ff0dfb39d8bdd2192AND block_date >= DATE '2026-04-01'AND topic0 = 0xb286a066f2bc3141da5990f5ce561eb9dedf4a5833062b5a59742a3c205d8fc1AND bytearray_to_uint256(bytearray_substring(data, 1, 32)) = UINT256 '0' -- isPanelist = false),del_net AS (SELECT delegator, panelist, SUM(amt) AS stakeFROM del_flowsGROUP BY 1, 2