Appearance
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)
}| block | ethPerShare | pooledEther | totalShares |
|---|---|---|---|
| 26042707 | 1.244710915700866902 | 9761717.135365036561936133 | 7842557.667190094063001578 |
How it reads
No at, so the source reads the newest block; 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, and the number steps up once a day when Lido's oracle reports. pooledEther divided by totalShares is the same rate computed by you 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 is used:
cqllet 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) }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 steps up from one day's row to the next.