Skip to content

Commit 031ea71

Browse files
committed
comment proto file
1 parent 1bcbe45 commit 031ea71

File tree

2 files changed

+57
-21
lines changed

2 files changed

+57
-21
lines changed
Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,55 @@
11
syntax = "proto3";
22

3+
import "google/protobuf/timestamp.proto";
4+
35
package pyth_lazer_transaction;
46

7+
// PublisherUpdate contains an array of individual updates and a timestamp
58
message PublisherUpdate {
9+
// Array of updates, each of which target a single feed
610
repeated FeedUpdate updates = 1;
7-
uint64 batch_timestamp_us = 2;
11+
12+
// Timestamp when this message was created
13+
optional google.protobuf.Timestamp publisher_timestamp = 2;
814
}
915

16+
// Update to a feed. May contain different types of data depending on what kind of update it is
1017
message FeedUpdate {
18+
// Feed which the update should be applied to
19+
// Should match a feed id recognized by PythLazer
20+
optional uint32 feed_id = 1;
21+
22+
// Timestamp when this data was first acquired or generated
23+
optional google.protobuf.Timestamp source_timestamp = 2;
24+
25+
// one of the valid updates allowed by publishers for a lazer feed
1126
oneof update {
12-
PriceUpdateV1 price_update_v1 = 1;
13-
FundingRateUpdateV1 funding_rate_update_v1 = 2;
14-
}
27+
PriceUpdate price_update = 3;
28+
FundingRateUpdate funding_rate_update = 4;
29+
};
1530
}
1631

17-
message PriceUpdateV1 {
18-
uint32 feed_id = 1;
19-
uint64 source_timestamp_us = 2;
20-
uint64 publisher_timestamp_us = 3;
21-
optional int64 price = 4;
22-
optional int64 best_bid_price = 5;
23-
optional int64 best_ask_price = 6;
32+
message PriceUpdate {
33+
// Price for the symbol as an integer
34+
// Should be produced with a matching exponent to the configured exponent value in PythLazer
35+
// May be missing if no price data is available
36+
optional int64 price = 1;
37+
38+
// Best Bid Price for the symbol as an integer
39+
// Should be produced with a matching exponent to the configured exponent value in PythLazer
40+
// May be missing if no data is available
41+
optional int64 best_bid_price = 2;
42+
43+
// Best Ask Price for the symbol as an integer
44+
// Should be produced with a matching exponent to the configured exponent value in PythLazer
45+
// May be missing if no data is available
46+
optional int64 best_ask_price = 3;
2447
}
2548

26-
message FundingRateUpdateV1 {
27-
uint32 feed_id = 1;
28-
uint64 source_timestamp_us = 2;
29-
uint64 publisher_timestamp_us = 3;
30-
optional int64 price = 4;
31-
optional int64 rate = 5;
49+
message FundingRateUpdate {
50+
// Price for which the funding rate applies to
51+
optional int64 price = 1;
52+
53+
// Perpetual Future funding rate
54+
optional int64 rate = 2;
3255
}

lazer/sdk/proto/pyth_lazer_transaction.proto

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,31 @@ package pyth_lazer_transaction;
44

55
import "publisher_update.proto";
66

7+
// Types of Signatures allowed for signing Lazer Transactions
78
enum TransactionSignatureType {
9+
// signature is 64 bytes long
810
ed25519 = 0;
911
}
1012

13+
// Signed lazer transaction payload
14+
// This is what Pyth Lazer expects as input to the system
1115
message SignedLazerTransaction {
12-
TransactionSignatureType signature_type = 1;
13-
bytes signature = 2;
14-
bytes transaction = 3;
16+
// Type and signature should match
17+
optional TransactionSignatureType signature_type = 1;
18+
19+
// Signature derived by signing payload with private key
20+
optional bytes signature = 2;
21+
22+
// a LazerTransaction message which is already encoded with protobuf as bytes
23+
// The encoded bytes are what should be signed
24+
optional bytes payload = 3;
1525
}
1626

27+
// Transaction contianing one of the valid Lazer Transactions
1728
message LazerTransaction {
1829
oneof payload {
19-
PublisherUpdate publisher_updates = 1;
30+
// Expected transaction sent by Publishers
31+
// May contain many individual updates to various feeds
32+
PublisherUpdate publisher_update = 1;
2033
}
2134
}

0 commit comments

Comments
 (0)