PoSQLVerifier

Description:

Proxy contract enabling upgradeable smart contract patterns. Delegates calls to an implementation contract.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "src/PoSQLVerifier.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import {IVerify} from "./query-router/interfaces/IVerify.sol";
import {IQueryRouter} from "./query-router/interfaces/IQueryRouter.sol";

contract PoSQLVerifier is IVerify {
    struct CommitmentProof {
        bytes32[] proof;
        bytes32[] r;
        bytes32[] s;
        uint8[] v;
        uint64 blockNumber;
        bool[] proofFlags;
    }

    struct ResultBody {
        bytes result;
        bytes proof;
        CommitmentProof commitmentProof;
        string[] tableNames; // should be in the same order as tableCommitments
        bytes[] tableCommitments;
    }
    /// @inheritdoc IVerify
    function verify(IQueryRouter.Query calldata queryData, bytes calldata proof)
        external
        view
        returns (bytes memory result)
    {
        ResultBody calldata queryResultStruct;
        assembly {
            queryResultStruct := add(proof.offset, 0x20)
        }

        return queryResultStruct.result;
    }
}
"
    },
    "src/query-router/interfaces/IVerify.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import {IQueryRouter} from "./IQueryRouter.sol";

/// @title IVerify
/// @author Placeholder
/// @notice Minimal verifier interface that exposes exactly the verify method
interface IVerify {
    /// @notice Verify a query result and return the extracted result bytes
    /// @param queryData The original query struct
    /// @param proof Encoded proof containing the query result and cryptographic proof
    /// @return result The query result data extracted from the proof
    function verify(IQueryRouter.Query calldata queryData, bytes calldata proof)
        external
        view
        returns (bytes memory result);
}
"
    },
    "src/query-router/interfaces/IQueryRouter.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

/// @title IQueryRouter
/// @author Placeholder
/// @notice Interface for querying external data sources with cryptographic proofs
interface IQueryRouter {
    /// @notice Query details
    /// @param version Query version identifier
    /// @param innerQuery Encoded, version-dependent query payload
    /// @param parameters Encoded parameters for the query
    /// @param metadata Encoded metadata for the query
    struct Query {
        bytes32 version;
        bytes innerQuery;
        bytes parameters;
        bytes metadata;
    }

    /// @notice Callback execution details
    /// @param maxGasPrice Max native gas price allowed for the callback
    /// @param gasLimit Gas limit forwarded to the callback contract
    /// @param callbackContract Address of the contract to call back
    /// @param selector Function selector to call on the callback contract
    /// @param callbackData Opaque callback-specific data passed to the callback
    struct Callback {
        uint256 maxGasPrice;
        uint64 gasLimit;
        address callbackContract;
        bytes4 selector;
        bytes callbackData;
    }

    /// @notice Emitted when a query is requested
    /// @param queryId Unique identifier for the query
    /// @param queryNonce Nonce used when the query was created
    /// @param requester Address that requested the query
    /// @param query Query details
    /// @param callback Callback details
    /// @param paymentAmount Amount of tokens held pending fulfillment
    /// @param timeout Timestamp after which cancellation is allowed
    event QueryRequested(
        bytes32 indexed queryId,
        uint64 indexed queryNonce,
        address indexed requester,
        Query query,
        Callback callback,
        uint256 paymentAmount,
        uint64 timeout
    );

    /// @notice Emitted when a query has been fulfilled (logical fulfillment/result)
    /// @param queryId Unique identifier for the query
    /// @param fulfiller Address that fulfilled the query
    /// @param result The query result data
    event QueryFulfilled(bytes32 indexed queryId, address indexed fulfiller, bytes result);

    /// @notice Emitted when a payout for a fulfilled query occurred (payments/refunds)
    /// @param queryId Unique identifier for the query
    /// @param fulfiller Address that fulfilled the query
    /// @param refundRecipient Address that received a refund (if any)
    /// @param fulfillerAmount Amount paid to the fulfiller for this fulfillment
    /// @param refundAmount Amount refunded to the refundRecipient (if any)
    event PayoutOccurred(
        bytes32 indexed queryId,
        address indexed fulfiller,
        address indexed refundRecipient,
        uint256 fulfillerAmount,
        uint256 refundAmount
    ); // solhint-disable-line gas-indexed-events

    /// @notice Emitted when a query is cancelled
    /// @param queryId Unique identifier for the query
    /// @param refundRecipient Address that received the refund
    /// @param refundAmount Amount refunded
    event QueryCancelled(bytes32 indexed queryId, address indexed refundRecipient, uint256 indexed refundAmount);

    /// @notice Emitted when open fulfillment is toggled
    /// @param enabled Whether open fulfillment is now enabled
    event OpenFulfillmentToggled(bool indexed enabled);

    /// @notice Emitted when the base cost used by the router is updated
    /// @param newBaseCost The new base cost value
    event BaseCostUpdated(uint256 indexed newBaseCost);

    /// @notice Emitted when a version is set
    /// @param version The string version
    /// @param versionHash The keccak256 hash of the version
    /// @param verifier The verifier contract address associated with the version
    event VersionSet(string version, bytes32 indexed versionHash, address indexed verifier);

    /// @notice Thrown when a query is not found or unauthorized cancellation is attempted
    error QueryNotFound(); // aderyn-ignore unused-error

    /// @notice Thrown when a query cancellation is attempted before the timeout
    error QueryTimeoutNotReached(); // aderyn-ignore unused-error

    /// @notice Thrown when the query version is not supported by the router
    error UnsupportedQueryVersion(); // aderyn-ignore unused-error

    /// @notice Register a verifier contract address to a version string
    /// @param version The string version to hash
    /// @param verifier The contract address to associate with the version
    function registerVerifierToVersion(string calldata version, address verifier) external;

    /// @notice Set the base cost for queries
    /// @param newBaseCost The new base cost
    function setBaseCost(uint256 newBaseCost) external;

    /// @notice Cancel a pending query and refund the payment
    /// @param queryId Unique identifier for the query to cancel
    function cancelQuery(bytes32 queryId) external;

    /// @notice Request a query to be executed.
    /// @param query Query struct containing query string, parameters, and version.
    /// @param callback Callback struct containing callback details.
    /// @param paymentAmount Amount of tokens to hold pending fulfillment.
    /// @param timeout Timestamp after which cancellation is allowed
    /// @return queryId Unique ID for this query.
    function requestQuery(Query calldata query, Callback calldata callback, uint256 paymentAmount, uint64 timeout)
        external
        returns (bytes32 queryId);

    /// @notice Fulfill a query by providing its data and proof.
    /// @param query Query struct for the original request.
    /// @param callback Callback struct for the original request.
    /// @param queryNonce Nonce used when the query was created.
    /// @param proof Encoded proof containing the query result and cryptographic proof.
    function fulfillQuery(Query calldata query, Callback calldata callback, uint64 queryNonce, bytes calldata proof)
        external;

    /// @notice Toggle open fulfillment on or off
    /// @param enabled True to allow anyone to fulfill, false to restrict to FULFILLER_ROLE
    function setOpenFulfillment(bool enabled) external;

    /// @notice Verify a query result without executing its callback.
    /// @param query Query struct for the original request.
    /// @param proof Encoded proof containing the query result and cryptographic proof.
    /// @return result The query result data extracted from the proof.
    function verifyQuery(Query calldata query, bytes calldata proof) external view returns (bytes memory result);
}
"
    }
  },
  "settings": {
    "remappings": [
      "@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.2.0/",
      "forge-std/=dependencies/forge-std-1.9.7/",
      "smartcontractkit-chainlink-evm-1.5.0/=dependencies/smartcontractkit-chainlink-evm-1.5.0/",
      "sxt-proof-of-sql/=dependencies/sxt-proof-of-sql-0.123.10/",
      "@chainlink-contracts-0.8.0/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/@chainlink-contracts-0.8.0/src/v0.6/vendor/@arbitrum/nitro-contracts/src/",
      "@chainlink/contracts/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/@chainlink-contracts-0.8.0/",
      "@openzeppelin-contracts-5.2.0/=dependencies/@openzeppelin-contracts-5.2.0/",
      "@openzeppelin-contracts-upgradeable-5.2.0/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/@openzeppelin-contracts-upgradeable-5.2.0/",
      "@openzeppelin-contracts/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/@openzeppelin-contracts-5.2.0/",
      "@openzeppelin/contracts-upgradeable/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/@openzeppelin-contracts-upgradeable-5.2.0/",
      "forge-std-1.9.6/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/forge-std-1.9.6/src/",
      "forge-std-1.9.7/=dependencies/forge-std-1.9.7/src/",
      "openzeppelin-foundry-upgrades-0.4.0/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/openzeppelin-foundry-upgrades-0.4.0/src/",
      "openzeppelin-foundry-upgrades/=dependencies/sxt-zkpay-contracts-1.0.0/dependencies/openzeppelin-foundry-upgrades-0.4.0/src/",
      "sxt-proof-of-sql-0.123.10/=dependencies/sxt-proof-of-sql-0.123.10/src/",
      "sxt-zkpay-contracts-1.0.0/=dependencies/sxt-zkpay-contracts-1.0.0/"
    ],
    "optimizer": {
      "enabled": true,
      "runs": 4294967295
    },
    "metadata": {
      "useLiteralContent": false,
      "bytecodeHash": "ipfs",
      "appendCBOR": true
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "cancun",
    "viaIR": true
  }
}}

Tags:
Proxy, Upgradeable, Factory, Oracle|addr:0x2ae06748abd0e29e251f5314c40194381ca250a4|verified:true|block:23741085|tx:0xfee92e3f0c6a9c62b263ec888ba7965149bfa1ccba8bbfe83e12cf921dac620c|first_check:1762442331

Submitted on: 2025-11-06 16:18:52

Comments

Log in to comment.

No comments yet.