Skip to content

Join events to state ​

For every rebase in the last three days, read the share rate at the block it happened in, beside the rate the event itself reports.

cql
let stETH = ethereum:0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;

from stETH events TokenRebased at latest-21600..latest as e
| project {
    block:       $block,
    time:        $timestamp,
    tx:          $tx,
    pre:         todecimal(e.preTotalEther) / todecimal(e.preTotalShares),
    post:        todecimal(e.postTotalEther) / todecimal(e.postTotalShares),
    ethPerShare: format(e.getPooledEthByShares(1e18), 18),
    fees:        format(e.sharesMintedAsFees, 18)
  }

Open in workbench →

blocktimetxprepostethPerSharefees
260329982026-09-22T12:22:23Z0x3c91f03dbf11863e632f49ab15667d341fa8d70fcba8475618dfedc8978fc09e1.24455806764908769007504877126384781381.24463341960208915666234892963630277031.24463341960208915652.706246205190669139
260401482026-09-23T12:22:11Z0x573bc04ffa9f9051b1984581ae4c278cbbba8278a3f2147f42984784aa944bdb1.2446334196020891566623726883624204841.24471091570086690274993853357231351941.24471091570086690254.214483995073287142
260472932026-09-24T12:23:47Z0x4732fc5cb4a1f4abe1cb35b86a5933358d6c54cd488687a8a96b5045eb3eec951.24471091570086690274995617037218777641.24478772874267957517217023619587199581.24478772874267957553.735023042916615934
ethPerShare by timeA step line of ethPerShare over time, from all 3 rows the query returned.1.244651.244701.24475ethPerShare00:002026-09-2312:0000:002026-09-2412:00time (UTC)2026-09-22T12:22:23Z ethPerShare 1.2446334196020891562026-09-23T12:22:11Z ethPerShare 1.2447109157008669022026-09-24T12:23:47Z ethPerShare 1.244787728742679575
ethPerShare by timeA step line of ethPerShare over time, from all 3 rows the query returned.1.244651.244701.24475ethPerShare2026-09-232026-09-24time (UTC)2026-09-22T12:22:23Z ethPerShare 1.2446334196020891562026-09-23T12:22:11Z ethPerShare 1.2447109157008669022026-09-24T12:23:47Z ethPerShare 1.244787728742679575

You get one row per TokenRebased in the range — three, one a day — in block order. Each row shows:

  • the block, its timestamp and its transaction
  • the share rate before and after the rebase, from the event's own arguments
  • ethPerShare, read from the contract at that block
  • the shares minted as fees

post and ethPerShare agree to eighteen places, which is the check.

How it reads ​

events TokenRebased makes this an event source, so each row is one log and e.preTotalEther, e.postTotalShares and e.sharesMintedAsFees are its arguments. CQL resolves the ABI from the address — through the proxy, as for any call — and TokenRebased is in it. Both totals are uint256, so todecimal turns them into decimals before the division. Whole-number division would truncate the rate to 1.

e.getPooledEthByShares(1e18) is a call on the event row's alias, and it answers at the row's block — the block the rebase was mined in, after it applied. That is the whole join: no second source, no key, just a call on an event row.

This is the query most people want from stETH — every rebase, with what it did to the rate. Average daily change and annualised rate gets the same rate from daily samples, without reading the events.

Variations ​

  • The rate a day earlier. with { block: $block - 7200 } on the call.
  • The change as a percentage. | extend pct = (post / pre - 1) * 100 after the project.
  • Every event the contract emits. events * and | where $event in ('TokenRebased', 'Submitted'). The arguments each event lacks are null.

See also ​