Skip to content

feat(lazer-protocol): Update EVM payload #2314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lazer/contracts/evm/src/PythLazerLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ library PythLazerLib {
enum PriceFeedProperty {
Price,
BestBidPrice,
BestAskPrice
BestAskPrice,
Exponent,
PublisherCount
}

enum Channel {
Expand Down Expand Up @@ -74,6 +76,24 @@ library PythLazerLib {
new_pos = pos;
}

function parseFeedValueUint16(
bytes calldata update,
uint16 pos
) public pure returns (uint16 value, uint16 new_pos) {
value = uint16(bytes2(update[pos:pos + 2]));
pos += 2;
new_pos = pos;
}

function parseFeedValueInt16(
bytes calldata update,
uint16 pos
) public pure returns (int16 value, uint16 new_pos) {
value = int16(uint16(bytes2(update[pos:pos + 2])));
pos += 2;
new_pos = pos;
}

function parseFeedValueUint8(
bytes calldata update,
uint16 pos
Expand Down
4 changes: 2 additions & 2 deletions lazer/contracts/evm/test/PythLazer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ contract PythLazerTest is Test {

function test_verify() public {
// Prepare dummy update and signer
address trustedSigner = 0xEfEf56cD66896f6799A90A4e4d512C330c094e44;
address trustedSigner = 0xb8d50f0bAE75BF6E03c104903d7C3aFc4a6596Da;
vm.prank(address(1));
pythLazer.updateTrustedSigner(trustedSigner, 3000000000000000);
bytes
memory update = hex"2a22999a577d3cc0202197939d736bc0dcf71b9dde7b9470e4d16fa8e2120c0787a1c0d744d0c39cc372af4d1ecf2d09e84160ca905f3f597d20e2eec144a446a0459ad600001c93c7d3750006240af373971c01010000000201000000000005f5e100";
memory update = hex"2a22999a9ee4e2a3df5affd0ad8c7c46c96d3b5ef197dd653bedd8f44a4b6b69b767fbc66341e80b80acb09ead98c60d169b9a99657ebada101f447378f227bffbc69d3d01003493c7d37500062cf28659c1e801010000000605000000000005f5e10002000000000000000001000000000000000003000104fff8";

uint256 fee = pythLazer.verification_fee();

Expand Down
2 changes: 1 addition & 1 deletion lazer/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-lazer-sdk",
"version": "0.3.2",
"version": "0.4.0",
"description": "Pyth Lazer SDK",
"publishConfig": {
"access": "public"
Expand Down
Loading