Skip to content

Commit 92a312d

Browse files
committed
merge from docs private
1 parent 98ec244 commit 92a312d

31 files changed

+365
-266
lines changed

public/samples/DataStreams/ClientReportsVerifier.sol

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,17 @@ contract ClientReportsVerifier {
100100
}
101101

102102
/**
103-
* @dev Data Streams report schema v4 (RWA streams).
103+
* @dev Data Streams report schema v8 (RWA streams).
104104
*/
105-
struct ReportV4 {
105+
struct ReportV8 {
106106
bytes32 feedId;
107107
uint32 validFromTimestamp;
108108
uint32 observationsTimestamp;
109109
uint192 nativeFee;
110110
uint192 linkFee;
111111
uint32 expiresAt;
112-
int192 price;
112+
uint64 lastUpdateTimestamp;
113+
int192 midPrice;
113114
uint32 marketStatus;
114115
}
115116

@@ -140,11 +141,11 @@ contract ClientReportsVerifier {
140141
// ----------------- Public API -----------------
141142

142143
/**
143-
* @notice Verify a Data Streams report (schema v3 or v4).
144+
* @notice Verify a Data Streams report (schema v3 or v8).
144145
*
145146
* @dev Steps:
146147
* 1. Decode the unverified report to get `reportData`.
147-
* 2. Read the first two bytes → schema version (`0x0003` or `0x0004`).
148+
* 2. Read the first two bytes → schema version (`0x0003` or `0x0008`).
148149
* - Revert if the version is unsupported.
149150
* 3. Fee handling:
150151
* - Query `s_feeManager()` on the proxy.
@@ -155,7 +156,7 @@ contract ClientReportsVerifier {
155156
* 5. Decode the verified report into the correct struct and emit the price.
156157
*
157158
* @param unverifiedReport Full payload returned by Streams Direct.
158-
* @custom:reverts InvalidReportVersion when schema ≠ v3/v4.
159+
* @custom:reverts InvalidReportVersion when schema ≠ v3/v8.
159160
*/
160161
function verifyReport(bytes memory unverifiedReport) external {
161162
// ─── 1. & 2. Extract reportData and schema version ──
@@ -166,7 +167,7 @@ contract ClientReportsVerifier {
166167

167168
uint16 reportVersion = (uint16(uint8(reportData[0])) << 8) |
168169
uint16(uint8(reportData[1]));
169-
if (reportVersion != 3 && reportVersion != 4)
170+
if (reportVersion != 3 && reportVersion != 8)
170171
revert InvalidReportVersion(reportVersion);
171172

172173
// ─── 3. Fee handling ──
@@ -204,7 +205,7 @@ contract ClientReportsVerifier {
204205
lastDecodedPrice = price;
205206
emit DecodedPrice(price);
206207
} else {
207-
int192 price = abi.decode(verified, (ReportV4)).price;
208+
int192 price = abi.decode(verified, (ReportV8)).midPrice;
208209
lastDecodedPrice = price;
209210
emit DecodedPrice(price);
210211
}

src/config/sidebar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
321321
children: [
322322
{
323323
title: "Report Schema v3",
324-
url: "data-streams/reference/report-schema",
324+
url: "data-streams/reference/report-schema-v3",
325325
},
326326
],
327327
},
@@ -330,8 +330,8 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
330330
url: "data-streams/rwa-streams",
331331
children: [
332332
{
333-
title: "Report Schema v4",
334-
url: "data-streams/reference/report-schema-v4",
333+
title: "Report Schema v8",
334+
url: "data-streams/reference/report-schema-v8",
335335
},
336336
],
337337
},

src/content/data-streams/architecture.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ whatsnext:
1010
"Learn more about the Standard API Implementation": "/data-streams/tutorials/api-go",
1111
"Learn more about the Streams Trade Implementation": "/data-streams/streams-trade",
1212
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
13-
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
13+
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
14+
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
1415
}
1516
---
1617

src/content/data-streams/billing.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ whatsnext:
1010
{
1111
"Learn the basics about how to retrieve Data Streams reports in the Getting Started guide.": "/data-streams/getting-started",
1212
"Find the list of available Stream IDs.": "/data-streams/crypto-streams",
13-
"Find the schema of data to expect from Data Streams reports.": "/data-streams/reference/report-schema",
13+
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
14+
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
1415
}
1516
---
1617

src/content/data-streams/concepts/liquidity-weighted-prices.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ metadata:
88
whatsnext:
99
{
1010
"Find the list of available Stream IDs.": "/data-streams/crypto-streams",
11-
"Find the schema of data to expect from Data Streams reports.": "/data-streams/reference/report-schema",
11+
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
12+
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
1213
}
1314
---
1415

1516
import DataStreams from "@features/data-streams/common/DataStreams.astro"
1617

1718
<DataStreams section="dsNotes" />
1819

19-
Chainlink Data Streams provides [reports](/data-streams/reference/report-schema) with a _Mid_ and _Liquidity-Weighted Bid and Ask (LWBA)_ prices. These three prices form a pricing spread that offers protocols insight into market activity based on the current state of the order books.
20+
Chainlink Data Streams provides [reports](/data-streams/reference/report-schema-v3) with a _Mid_ and _Liquidity-Weighted Bid and Ask (LWBA)_ prices. These three prices form a pricing spread that offers protocols insight into market activity based on the current state of the order books.
2021

2122
**Note**: At the moment, only [Crypto streams](/data-streams/crypto-streams) provide LWBA prices.
2223

src/content/data-streams/developer-responsibilities.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ metadata:
88
whatsnext:
99
{
1010
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
11-
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
11+
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
12+
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
1213
"Learn the basics about how to retrieve Data Streams reports using the Streams Trade implementation": "/data-streams/getting-started",
1314
"Learn how to fetch and decode Data Streams reports using the Data Streams API": "/data-streams/tutorials/api-go",
1415
}

src/content/data-streams/index.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ whatsnext:
1010
{
1111
"Learn how to fetch and decode Data Streams reports with the API": "/data-streams/tutorials/api-go",
1212
"Find the list of available Stream IDs": "/data-streams/crypto-streams",
13-
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
13+
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
14+
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
1415
}
1516
---
1617

@@ -85,7 +86,7 @@ Access data directly through REST APIs or WebSocket connections using our SDKs:
8586

8687
1. Understand the Architecture: Review the [system components and data flow](/data-streams/architecture) to understand how Data Streams works.
8788

88-
1. Explore Available Data: Browse [available Stream IDs](/data-streams/crypto-streams) and [report schemas](/data-streams/reference/report-schema) to see what data is available.
89+
1. Explore Available Data: Browse [available Stream IDs](/data-streams/crypto-streams) and [report schemas](/data-streams/reference/report-schema-v3) to see what data is available.
8990

9091
1. Try the API: Follow our [hands-on tutorial](/data-streams/tutorials/api-go) to fetch and decode your first report.
9192

src/content/data-streams/market-hours.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ whatsnext:
1010
{
1111
"Find the list of available Crypto streams": "/data-streams/crypto-streams",
1212
"Find the list of available RWA streams": "/data-streams/rwa-streams",
13-
"Find the schema of data to expect from Data Streams reports": "/data-streams/reference/report-schema",
13+
"Find the schema of data to expect from Data Streams reports: Crypto": "/data-streams/reference/report-schema-v3",
14+
"Find the schema of data to expect from Data Streams reports: RWA": "/data-streams/reference/report-schema-v8",
1415
}
1516
---
1617

@@ -26,4 +27,4 @@ Markets for several assets are actively traded only during certain hours. Listed
2627

2728
## Real World Asset market status
2829

29-
Reports for Real World Asset (RWA) streams include the `marketStatus` value, which reflects the DON'S consensus on whether the market is currently open. For additional information, refer to the [RWA report schema](/data-streams/reference/report-schema-v4) page.
30+
Reports for Real World Asset (RWA) streams include the `marketStatus` value, which reflects the DON'S consensus on whether the market is currently open. For additional information, refer to the [RWA report schema](/data-streams/reference/report-schema-v8) page.

src/content/data-streams/reference/go-sdk.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Where `ID` is the unique identifier for the stream.
267267

268268
#### `FeedVersion` uint16
269269

270-
Represents the stream [report schema](/data-streams/reference/report-schema) version.
270+
Represents the stream [report schema](/data-streams/reference/report-schema-v3) version.
271271

272272
```go
273273
type FeedVersion uint16
@@ -329,7 +329,7 @@ import report "github.com/smartcontractkit/data-streams-sdk/go/report"
329329

330330
```go
331331
type Data interface {
332-
v1.Data | v2.Data | v3.Data | v4.Data
332+
v1.Data | v2.Data | v3.Data | v4.Data | v8.Data | v9.Data
333333
Schema() abi.Arguments
334334
}
335335
```

src/content/data-streams/reference/report-schema.mdx renamed to src/content/data-streams/reference/report-schema-v3.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ import { PageTabs } from "@components"
1616

1717
<PageTabs
1818
pages={[
19+
1920
{
2021
name: "Cryptocurrency Report Schema (v3)",
21-
url: "/data-streams/reference/report-schema",
22+
url: "/data-streams/reference/report-schema-v3",
2223
},
2324
{
24-
name: "Real World Asset (RWA) Report Schema (v4)",
25-
url: "/data-streams/reference/report-schema-v4",
25+
name: "RWA Report Schema (v8)",
26+
url: "/data-streams/reference/report-schema-v8",
2627
},
27-
]}
28-
headerTitle="Available Report Schemas"
29-
headerDescription="Choose the schema version you want to explore."
28+
29+
]}
30+
headerTitle="Available Report Schemas"
31+
headerDescription="Choose the schema version you want to explore."
3032
/>
3133

3234
Cryptocurrency streams adhere to the report schema outlined below.
@@ -41,7 +43,7 @@ Cryptocurrency streams adhere to the report schema outlined below.
4143
| `nativeFee` | `uint192` | Verification cost in native blockchain tokens |
4244
| `linkFee` | `uint192` | Verification cost in LINK tokens |
4345
| `expiresAt` | `uint32` | Timestamp when this report expires |
44-
| `price` | `int192` | DON consensus median price (18 decimal places) |
46+
| `price` | `int192` | DON consensus median price |
4547
| `bid` | `int192` | Simulated buy impact price at X% liquidity depth |
4648
| `ask` | `int192` | Simulated sell impact price at X% liquidity depth |
4749

0 commit comments

Comments
 (0)