Skip to content

Commit 9b2c5fd

Browse files
committed
self-review update 2
1 parent fb01090 commit 9b2c5fd

File tree

4 files changed

+157
-14
lines changed

4 files changed

+157
-14
lines changed

reports/llms-report.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"startedAt": "2025-12-10T23:13:13.756Z",
2+
"startedAt": "2025-12-11T00:13:00.625Z",
33
"siteBase": "https://docs.chain.link",
44
"sections": [
55
{
@@ -39,16 +39,16 @@
3939
"pagesProcessed": 37,
4040
"outputPath": "src/content/data-feeds/llms-full.txt",
4141
"bytes": 302816,
42-
"prevBytes": 302589,
43-
"deltaBytes": 227
42+
"prevBytes": 302816,
43+
"deltaBytes": 0
4444
},
4545
{
4646
"section": "data-streams",
47-
"pagesProcessed": 55,
47+
"pagesProcessed": 56,
4848
"outputPath": "src/content/data-streams/llms-full.txt",
49-
"bytes": 477063,
49+
"bytes": 484871,
5050
"prevBytes": 477063,
51-
"deltaBytes": 0
51+
"deltaBytes": 7808
5252
},
5353
{
5454
"section": "dta-technical-standard",
@@ -123,5 +123,5 @@
123123
"deltaBytes": 0
124124
}
125125
],
126-
"finishedAt": "2025-12-10T23:13:17.715Z"
126+
"finishedAt": "2025-12-11T00:13:04.595Z"
127127
}

src/content/data-streams/concepts/calculated-streams.mdx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ import { Aside, ClickToZoom } from "@components"
2828

2929
Calculated streams are Chainlink data streams whose values are derived by applying arithmetic expressions to multiple underlying inputs.
3030

31-
All Data Streams use a [Decentralized Oracle Network (DON)](/data-streams/architecture) where nodes reach consensus and publish signed reports.
32-
33-
Traditional Data Streams aggregate market data from multiple independent providers, ensuring no single data source can compromise the stream's integrity.
31+
All Data Streams use a [Decentralized Oracle Network (DON)](/data-streams/architecture) where nodes reach consensus and publish signed reports. Traditional Data Streams aggregate market data from multiple independent providers, ensuring no single data source can compromise the stream's integrity.
3432

3533
Instead of aggregating only raw market data, calculated streams compute derived values using predefined formulas applied to various inputs, including existing data streams, onchain state, and offchain APIs. Some inputs are decentralized aggregates (for example, crypto price streams from multiple independent providers), while others may come from a single protocol or API (for example, a specific vault contract or yield provider). Because a calculated stream depends on all of these inputs, you should evaluate their dependencies and failure modes carefully before using it in a value-securing application.
3634

@@ -48,7 +46,7 @@ Instead of aggregating only raw market data, calculated streams compute derived
4846

4947
## How to identify calculated streams
5048

51-
Calculated streams are marked with a **Calculated** badge in the documentation.
49+
Calculated streams are marked with a <span style="display: inline-block; font-size: 0.75rem; padding: 2px 6px; margin-left: 4px; border-radius: 4px; background: var(--blue-100); color: var(--blue-700); font-weight: 500; vertical-align: middle;">Calculated</span> badge in the documentation.
5250

5351
## How calculated streams work
5452

@@ -97,7 +95,7 @@ Calculated streams inherit risks from their underlying inputs and introduce addi
9795

9896
### Multiple dependencies
9997

100-
If a required input becomes unavailable or unreliable, the calculated stream might not continue to reflect current conditions. Integrators should not assume any specific fallback behavior and must design their protocols to handle this scenario explicitly.
98+
If a required input becomes unavailable or unreliable, the calculated stream might stop updating or cease to reflect current conditions. Integrators should not assume any specific fallback behavior and must design their protocols to handle this scenario explicitly.
10199

102100
#### Mitigation
103101

@@ -136,7 +134,7 @@ A calculated stream for a tokenized yield-bearing vault might combine:
136134

137135
**Result**: a price per share that reflects the vault's total value including pending yield.
138136

139-
Without this stream, protocols accepting the vault token as collateral would need to query the vault contract, fetch accrued interest from the yield provider's API, perform the calculation themselves, and keep this logic synchronized across all integrators. A calculated stream ensures everyone prices the same way and updates together when the underlying formula or yield source changes.
137+
Without this stream, protocols accepting the vault token as collateral would need to query the vault contract, fetch accrued interest from the yield provider's API, perform the calculation themselves, and keep this logic synchronized across all integrators. A calculated stream helps ensure integrators apply the same pricing logic and update together when the underlying formula or yield source changes.
140138

141139
## Best practices
142140

@@ -156,4 +154,3 @@ Without this stream, protocols accepting the vault token as collateral would nee
156154

157155
- Subscribe to Chainlink release notes for formula changes
158156
- Test new streams or updated configurations in staging
159-
- Build flexibility to support stream ID updates when formulas evolve

src/content/data-streams/llms-full.txt

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,135 @@ For broader guidance around market hours and event handling, refer to the [Marke
408408

409409
---
410410

411+
# Calculated Streams
412+
Source: https://docs.chain.link/data-streams/concepts/calculated-streams
413+
414+
Calculated streams are Chainlink data streams whose values are derived by applying arithmetic expressions to multiple underlying inputs.
415+
416+
All Data Streams use a [Decentralized Oracle Network (DON)](/data-streams/architecture) where nodes reach consensus and publish signed reports. Traditional Data Streams aggregate market data from multiple independent providers, ensuring no single data source can compromise the stream's integrity.
417+
418+
Instead of aggregating only raw market data, calculated streams compute derived values using predefined formulas applied to various inputs, including existing data streams, onchain state, and offchain APIs. Some inputs are decentralized aggregates (for example, crypto price streams from multiple independent providers), while others may come from a single protocol or API (for example, a specific vault contract or yield provider). Because a calculated stream depends on all of these inputs, you should evaluate their dependencies and failure modes carefully before using it in a value-securing application.
419+
420+
<Aside type="caution" title="Important Considerations">
421+
Calculated streams introduce additional dependencies and timing considerations compared to standard streams. Before
422+
integrating a calculated stream, review the <a href="#unique-risks-and-mitigation">risks and mitigation</a> section to
423+
understand how multiple inputs and update cadences may affect your application.
424+
</Aside>
425+
426+
## Why use calculated streams?
427+
428+
- **Simpler integrations**: Consume one stream instead of implementing calculation logic in your contracts or backend
429+
- **Canonical formulas**: All integrators use the same formula and inputs, ensuring consistency across protocols
430+
- **Managed infrastructure**: Chainlink handles RPC calls, API integrations, and the calculation pipeline
431+
432+
## How to identify calculated streams
433+
434+
Calculated streams are marked with a <span style="display: inline-block; font-size: 0.75rem; padding: 2px 6px; margin-left: 4px; border-radius: 4px; background: var(--blue-100); color: var(--blue-700); font-weight: 500; vertical-align: middle;">Calculated</span> badge in the documentation.
435+
436+
## How calculated streams work
437+
438+
Calculated streams leverage existing Data Streams infrastructure. Data providers feed market data into the DON, which produces base streams. The DON then uses these base streams—along with onchain state and offchain APIs—as inputs to calculate derived values.
439+
440+
### Architecture flow
441+
442+
1. **Data collection**: The DON retrieves inputs specific to each calculated stream, which may include:
443+
- Existing Data Streams (market prices from multiple independent data providers)
444+
- Onchain state via RPC calls (vault balances, token supplies, contract data)
445+
- Offchain data via APIs (yield rates, interest components, external reference data)
446+
2. **Calculation**: The DON applies the predefined formula to combine the inputs
447+
3. **Consensus and signing**: Nodes reach consensus on the calculated value and sign the report
448+
4. **Publication**: Calculated streams are published through the Data Streams Aggregation Network
449+
450+
### Input sources
451+
452+
The inputs for a calculated stream depend on what it's computing. A stream might use:
453+
454+
#### Existing Data Streams
455+
456+
Market prices already aggregated from multiple independent sources (3+ providers). Example: using individual crypto asset prices as inputs for an index calculation.
457+
458+
#### Onchain state
459+
460+
Protocol-specific data read via RPC, such as vault balances, token supplies, or smart contract state. May come from a single protocol's contracts.
461+
462+
#### Offchain APIs
463+
464+
External data from specific trusted providers, such as yield rates or reference values. May come from a single API endpoint.
465+
466+
### Calculation and output
467+
468+
The DON executes the predefined formula (weighted averages, ratios, sums, etc.) using the latest available inputs. The calculated value is packaged into a signed report with standard metadata (timestamps, fees) and published through the Data Streams Aggregation Network. You consume these reports using the same REST APIs, WebSocket connections, and onchain verification as traditional streams.
469+
470+
***
471+
472+
## Risks and mitigation
473+
474+
Calculated streams inherit risks from their underlying inputs and introduce additional considerations due to combining multiple data sources.
475+
476+
### Multiple dependencies
477+
478+
If a required input becomes unavailable or unreliable, the calculated stream might stop updating or cease to reflect current conditions. Integrators should not assume any specific fallback behavior and must design their protocols to handle this scenario explicitly.
479+
480+
#### Mitigation
481+
482+
- Design your protocol to handle missing data gracefully (pause operations, use last-known values, or implement fallbacks based on your risk tolerance)
483+
484+
### Timing and synchronization
485+
486+
Inputs update at different frequencies and are read via separate calls, so they may reflect slightly different block heights or timestamps. The calculated value is an approximation based on the latest available data from each input, not a single-block atomic snapshot.
487+
488+
Users should expect small, transient differences between the calculated stream value and values observed on block explorers, vault dashboards, or DEX charts—especially during rapid changes such as large deposits, withdrawals, or sharp market moves. This does not necessarily indicate an issue with the stream, but is a natural consequence of combining multiple inputs with different update cadences.
489+
490+
#### Mitigation
491+
492+
- Implement max deviation checks against expected ranges
493+
- Use time-weighted averages or circuit breakers for extreme moves
494+
- Monitor trends over time rather than reacting to individual updates
495+
496+
<Aside type="note" title="Developer Responsibilities">
497+
When using calculated streams, you inherit all responsibilities associated with the underlying inputs plus additional
498+
responsibilities for monitoring calculation health and managing time-sensitivity requirements. Review the{" "}
499+
<a href="/data-streams/developer-responsibilities">Developer Responsibilities</a> page for comprehensive guidance on
500+
risk assessment and mitigation techniques.
501+
</Aside>
502+
503+
***
504+
505+
## Example: Tokenized yield product
506+
507+
A calculated stream for a tokenized yield-bearing vault might combine:
508+
509+
- **Vault balance (onchain)**: Total assets in the vault contract
510+
- **Token supply (onchain)**: Circulating supply of vault shares
511+
- **Accrued yield (offchain)**: Interest from an external API
512+
513+
**Formula:** `(vault balance + accrued yield) / token supply`
514+
515+
**Result**: a price per share that reflects the vault's total value including pending yield.
516+
517+
Without this stream, protocols accepting the vault token as collateral would need to query the vault contract, fetch accrued interest from the yield provider's API, perform the calculation themselves, and keep this logic synchronized across all integrators. A calculated stream helps ensure integrators apply the same pricing logic and update together when the underlying formula or yield source changes.
518+
519+
## Best practices
520+
521+
### Protocol design
522+
523+
- Set deviation limits to cap price changes per update or time window
524+
- Compare calculated values against market references when available (e.g., spot prices for index tokens)
525+
- Define fallback behavior if the stream stops updating or jumps beyond thresholds
526+
527+
### Monitoring
528+
529+
- Track the calculated stream value over time to establish normal behavior
530+
- Monitor key inputs independently when feasible (vault balances, token supplies) to cross-check outputs
531+
- Alert on update gaps or movements outside your safe range
532+
533+
### Handling updates
534+
535+
- Subscribe to Chainlink release notes for formula changes
536+
- Test new streams or updated configurations in staging
537+
538+
---
539+
411540
# DEX State Price Streams
412541
Source: https://docs.chain.link/data-streams/concepts/dex-state-price-streams
413542

src/features/feeds/components/Tables.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,13 @@ export const StreamsTr = ({ metadata, isMainnet }) => {
846846
// Determine if stream is deprecating
847847
const isDeprecating = !!metadata.docs?.shutdownDate
848848

849+
// Temporary calculated stream detection until proper metadata tagging is implemented
850+
// TODO: Replace with metadata.docs.isCalculated or similar once available
851+
const isCalculatedStream =
852+
metadata.docs?.productTypeCode === "ExRate" &&
853+
metadata.docs?.attributeType === "ExchangeRate" &&
854+
metadata.docs?.assetClass === "Tokenized Debt"
855+
849856
return (
850857
<tr>
851858
<td className={tableStyles.pairCol}>
@@ -860,6 +867,16 @@ export const StreamsTr = ({ metadata, isMainnet }) => {
860867
DEX State Price
861868
</a>
862869
)}
870+
{isCalculatedStream && (
871+
<a
872+
href="/data-streams/concepts/calculated-streams"
873+
target="_blank"
874+
className={tableStyles.feedVariantBadge}
875+
title="Calculated Stream"
876+
>
877+
Calculated
878+
</a>
879+
)}
863880
</div>
864881
{metadata.docs.shutdownDate && (
865882
<div className={clsx(feedList.shutDate)}>

0 commit comments

Comments
 (0)