Skip to content

Read the share rate now ​

Call three functions on stETH at the newest block, with no ABI given, and read what one share is worth.

cql
let stETH = ethereum:0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;

from stETH as s
| project {
    block:        $block,
    ethPerShare:  format(s.getPooledEthByShares(1e18), 18),
    pooledEther:  format(s.getTotalPooledEther(), 18),
    totalShares:  format(s.getTotalShares(), 18)
  }

Open in workbench →

blockethPerSharepooledEthertotalShares
260427071.2447109157008669029761717.1353650365619361337842557.667190094063001578

How it reads ​

The query has no at, so the source reads the newest block. It has no with { abi }, so CQL fetches the contract's verified ABI from the public verification services. stETH is a proxy whose own ABI is five functions about upgrades, so CQL follows it to the implementation and finds getPooledEthByShares there. One contract at one block is one row.

getPooledEthByShares(1e18) asks what 10^18 shares — one whole share — are worth in wei. So ethPerShare is the share rate. A share that was one ETH when stETH launched is 1.2447… ETH now. The number rises once a day, in one step, when Lido's oracle reports. pooledEther divided by totalShares is the same rate, but you compute it instead of the contract. format(x, 18) moves the point eighteen places so all three columns read as ETH rather than wei.

Variations ​

  • Give the ABI yourself when you want to be sure which interface CQL uses:

    cql
    let lido  = abi ['function getPooledEthByShares(uint256) view returns (uint256)'];
    let stETH = ethereum:0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;
    
    from stETH with { abi: lido } as s
    | project { block: $block, ethPerShare: format(s.getPooledEthByShares(1e18), 18) }

    Open in workbench →

  • The other direction. s.getSharesByPooledEth(1e18) is how many shares one ETH buys — the reciprocal.

  • Once a day instead of once. Add a range and a step — Sample a long range — and the rate rises from one day's row to the next.

See also ​