Query editor
-- =============================================================================-- PENDLE BUYBACK---- DEFINITION-- A buyback is PENDLE that the protocol acquired with revenue and delivered-- to sPENDLE holders. Measured at DELIVERY: sPENDLE arriving at-- vePendleAirdropDistributor.---- GRAIN-- One row per delivery event.---- EXECUTION CONTEXT-- The executor buys hourly over 3-4 days, then delivers once. Buy and spend-- columns are attached to the first delivery at or after them, which is a-- join with no free parameter, not a segmentation. Rows where a protocol-- wallet delivered directly show zero buys and zero USD, because-- no executor purchasing stood behind them.---- usd_spent is USDT leaving the executor to the router. Equal to USDT-- deposited in every settled cycle (no carryover), but spend is correct for-- the trailing in-flight row where deposits overstate progress.---- The final row may have no delivery - buying underway, nothing delivered-- yet. pendle_buyback is null there by design; pendle_bought is the live view.---- SCOPE-- Ethereum mainnet only.-- =============================================================================WITH addr AS (SELECT 0x808507121B80c02388fAd14726482e061B8da827 AS pendle,0xdAC17F958D2ee523a2206206994597C13D831ec7 AS usdt,0x999999999991e178d52cd95afd4b00d066664144 AS spendle,0x888888888889758F76e7103c6CbF23ABbF58F946 AS router,0x3942F7B55094250644cFfDa7160226Caa349A38E AS distributor,0x9e08C5499f953C6297A7755BcBcEd383b606896b AS executor),-- The ledger.deliveries AS (SELECT t.evt_block_time AS t,t."from" AS staker,t.value / 1e18 AS pendle,t.evt_tx_hash AS txFROM erc20_ethereum.evt_Transfer t, addr aWHERE t.contract_address = a.spendleAND t."to" = a.distributorAND t.evt_block_date >= DATE '2026-01-01'),exec_flows AS (SELECT 'buy' AS kind, t.evt_block_time AS t, t.value / 1e18 AS amt,t.evt_tx_hash AS h, t.evt_index AS ixFROM erc20_ethereum.evt_Transfer t, addr aWHERE t.contract_address = a.pendleAND t."from" = a.router AND t."to" = a.executorAND t.evt_block_date >= DATE '2026-01-01'UNION ALLSELECT 'spend', t.evt_block_time, t.value / 1e6, t.evt_tx_hash, t.evt_index