Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/ci-lazer-sdk-evm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: Check build
run: forge build --sizes
- name: Run tests
run: forge test -vvv
run: forge test --ffi --via-ir -vvv
46 changes: 46 additions & 0 deletions lazer/contracts/evm/script/fetch_pyth_payload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Fetch full JSON response from Pyth Lazer API for two different feed types
# Returns combined JSON with feed3 and feed112 responses
# Usage: ./fetch_pyth_payload.sh

API_URL="https://pyth-lazer-0.dourolabs.app/v1/latest_price"
BEARER_TOKEN="MeU4sOWhImaeacZHDOzr8l6RnDlnKXWjJeH-pdmo"

# Call 1: Feed 3 (Regular price feed - WITHOUT funding properties)
response_feed3=$(curl -X GET "$API_URL" \
--header "Authorization: Bearer $BEARER_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"priceFeedIds": [3],
"properties": ["price", "bestBidPrice", "bestAskPrice", "publisherCount", "exponent", "confidence"],
"chains": ["evm"],
"channel": "fixed_rate@200ms",
"deliveryFormat": "json",
"jsonBinaryEncoding": "hex"
}' \
--silent \
--show-error)

# Call 2: Feed 112 (Funding rate feed - WITHOUT bestBidPrice, bestAskPrice, confidence)
response_feed112=$(curl -X GET "$API_URL" \
--header "Authorization: Bearer $BEARER_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"priceFeedIds": [112],
"properties": ["price", "publisherCount", "exponent", "fundingRate", "fundingTimestamp", "fundingRateInterval"],
"chains": ["evm"],
"channel": "fixed_rate@200ms",
"deliveryFormat": "json",
"jsonBinaryEncoding": "hex"
}' \
--silent \
--show-error)

# Combine into single JSON object using jq if available
if command -v jq &> /dev/null; then
jq -n --argjson feed3 "$response_feed3" --argjson feed112 "$response_feed112" \
'{feed3: $feed3, feed112: $feed112}'
else
# Fallback: manual JSON construction
echo "{\"feed3\":$response_feed3,\"feed112\":$response_feed112}"
fi
27 changes: 25 additions & 2 deletions lazer/contracts/evm/src/PythLazer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pragma solidity ^0.8.13;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {PythLazerLib} from "./PythLazerLib.sol";
import {PythLazerStructs} from "./PythLazerStructs.sol";

contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {
TrustedSignerInfo[100] internal trustedSigners;
Expand Down Expand Up @@ -69,7 +71,7 @@ contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {

function verifyUpdate(
bytes calldata update
) external payable returns (bytes calldata payload, address signer) {
) public payable returns (bytes calldata payload, address signer) {
// Require fee and refund excess
require(msg.value >= verification_fee, "Insufficient fee provided");
if (msg.value > verification_fee) {
Expand Down Expand Up @@ -105,7 +107,28 @@ contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {
}
}

/// @notice Verify signature and parse update into structured data
/// @dev Combines verifyUpdate() with parseUpdateFromPayload() for convenience and safety
/// @param update The complete update message (EVM format with signature)
/// @return payload The verified payload bytes
/// @return parsedUpdate The parsed Update struct with all feeds and properties
function verifyAndParseUpdate(
bytes calldata update
)
external
payable
returns (
bytes calldata payload,
PythLazerStructs.Update memory parsedUpdate
)
{
(payload, ) = verifyUpdate(update);

// Parse the verified payload
parsedUpdate = PythLazerLib.parseUpdateFromPayload(payload);
}

function version() public pure returns (string memory) {
return "0.1.1";
return "0.2.0";
}
}
Loading
Loading