Skip to content
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?

Copy link
Member Author

Choose a reason for hiding this comment

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

not sure. following the same pattern as verifyUpdate.

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