Skip to content

Commit 0de69a0

Browse files
committed
Update enums for payload and use newer payload
1 parent 32002ec commit 0de69a0

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

lazer/contracts/evm/src/PythLazerLib.sol

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ library PythLazerLib {
88
enum PriceFeedProperty {
99
Price,
1010
BestBidPrice,
11-
BestAskPrice
11+
BestAskPrice,
12+
Exponent,
13+
PublisherCount
1214
}
1315

1416
enum Channel {
1517
Invalid,
16-
RealTime,
18+
FixedRate1,
1719
FixedRate50,
1820
FixedRate200
1921
}
@@ -74,6 +76,24 @@ library PythLazerLib {
7476
new_pos = pos;
7577
}
7678

79+
function parseFeedValueUint16(
80+
bytes calldata update,
81+
uint16 pos
82+
) public pure returns (uint16 value, uint16 new_pos) {
83+
value = uint16(bytes2(update[pos:pos + 2]));
84+
pos += 2;
85+
new_pos = pos;
86+
}
87+
88+
function parseFeedValueInt16(
89+
bytes calldata update,
90+
uint16 pos
91+
) public pure returns (int16 value, uint16 new_pos) {
92+
value = int16(uint16(bytes2(update[pos:pos + 2])));
93+
pos += 2;
94+
new_pos = pos;
95+
}
96+
7797
function parseFeedValueUint8(
7898
bytes calldata update,
7999
uint16 pos

lazer/contracts/evm/test/PythLazer.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ contract PythLazerTest is Test {
3434

3535
function test_verify() public {
3636
// Prepare dummy update and signer
37-
address trustedSigner = 0xEfEf56cD66896f6799A90A4e4d512C330c094e44;
37+
address trustedSigner = 0xb8d50f0bAE75BF6E03c104903d7C3aFc4a6596Da;
3838
vm.prank(address(1));
3939
pythLazer.updateTrustedSigner(trustedSigner, 3000000000000000);
4040
bytes
41-
memory update = hex"2a22999a577d3cc0202197939d736bc0dcf71b9dde7b9470e4d16fa8e2120c0787a1c0d744d0c39cc372af4d1ecf2d09e84160ca905f3f597d20e2eec144a446a0459ad600001c93c7d3750006240af373971c01010000000201000000000005f5e100";
41+
memory update = hex"2a22999aed58a242c6d87eb403d70e5e6fa0ea4df23ed63ce26f22f473b9dff4e90f36c80fd1b8805ea3aa341c02cb3a5a0fb57d429594fc2297aa68d722396cd94f6d0901003493c7d37500062cf1e903393801010000000505000000000000503cc5020000000000503cf7010000000000503c9303000104fff6";
4242

4343
uint256 fee = pythLazer.verification_fee();
4444

0 commit comments

Comments
 (0)