File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,14 @@ contract ExampleReceiver {
55
55
uint64 _price;
56
56
(_price, pos) = PythLazerLib.parseFeedValueUint64 (payload, pos);
57
57
console.log ("best ask price %d " , _price);
58
+ } else if (property == PythLazerLib.PriceFeedProperty.Exponent) {
59
+ int16 _exponent;
60
+ (_exponent, pos) = PythLazerLib.parseFeedValueInt16 (payload, pos);
61
+ console.log ("exponent %d " , _exponent);
62
+ } else if (property == PythLazerLib.PriceFeedProperty.PublisherCount) {
63
+ int16 _publisher_count;
64
+ (_publisher_count, pos) = PythLazerLib.parseFeedValueUint16 (payload, pos);
65
+ console.log ("publisher count %d " , _publisher_count);
58
66
} else {
59
67
revert ("unknown property " );
60
68
}
Original file line number Diff line number Diff line change @@ -25,14 +25,16 @@ contract ExampleReceiverTest is Test {
25
25
26
26
ExampleReceiver receiver = new ExampleReceiver (address (pythLazer));
27
27
bytes memory update =
28
- hex "2a22999a577d3cc0202197939d736bc0dcf71b9dde7b9470e4d16fa8e2120c0787a1c0d744d0c39cc372af4d1ecf2d09e84160ca905f3f597d20e2eec144a446a0459ad600001c93c7d3750006240af373971c01010000000201000000000005f5e100 " ;
28
+ hex "2a22999a9ee4e2a3df5affd0ad8c7c46c96d3b5ef197dd653bedd8f44a4b6b69b767fbc66341e80b80acb09ead98c60d169b9a99657ebada101f447378f227bffbc69d3d01003493c7d37500062cf28659c1e801010000000605000000000005f5e10002000000000000000001000000000000000003000104fff8 " ;
29
29
console.logBytes (update);
30
30
31
31
vm.prank (consumer);
32
32
receiver.updatePrice {value: 5 * fee}(update);
33
33
34
+ assertEq (receiver.timestamp (), 1738270008001000 );
34
35
assertEq (receiver.price (), 100000000 );
35
- assertEq (receiver.timestamp (), 1728479312975644 );
36
+ assertEq (receiver.exponent (), - 8 );
37
+ assertEq (receiver.publisherCount (), 1 );
36
38
37
39
assertEq (address (pythLazer).balance, fee);
38
40
assertEq (address (receiver).balance, 0 );
Original file line number Diff line number Diff line change 16
16
"author" : " " ,
17
17
"license" : " Apache-2.0" ,
18
18
"dependencies" : {
19
- "@pythnetwork/pyth-lazer-sdk" : " ^0.3.1 " ,
19
+ "@pythnetwork/pyth-lazer-sdk" : " ^0.4.0 " ,
20
20
"@solana/web3.js" : " ^1.98.0"
21
21
},
22
22
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ const main = async () => {
168
168
properties : [ "price" ] ,
169
169
chains : [ "solana" ] ,
170
170
deliveryFormat : "json" ,
171
- channel : "real_time " ,
171
+ channel : "fixed_rate@1ms " ,
172
172
jsonBinaryEncoding : "hex" ,
173
173
} ) ;
174
174
} ;
You can’t perform that action at this time.
0 commit comments