Skip to content
Open
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
29 changes: 27 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,30 @@ 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 signer The address of the signer
/// @return parsedUpdate The parsed Update struct with all feeds and properties
function verifyAndParseUpdate(
bytes calldata update
)
external
payable
returns (
bytes calldata payload,
address signer,
Comment on lines +122 to +123
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a need to return these?

PythLazerStructs.Update memory parsedUpdate
)
{
(payload, signer) = 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