Skip to content

BoundlessMarket

Inherits: IBoundlessMarket, Initializable, EIP712Upgradeable, Ownable2StepUpgradeable, UUPSUpgradeable

State Variables

VERSION

The version of the contract, with respect to upgrades.

uint64 public constant VERSION = 1;

requestLocks

mapping(uint256 => RequestLock) public requestLocks;

accounts

mapping(address => Account) internal accounts;

VERIFIER

Note: oz-upgrades-unsafe-allow: state-variable-immutable

IRiscZeroVerifier public immutable VERIFIER;

ASSESSOR_ID

Note: oz-upgrades-unsafe-allow: state-variable-immutable

bytes32 public immutable ASSESSOR_ID;

imageUrl

string private imageUrl;

FULFILL_MAX_GAS_FOR_VERIFY

In order to fulfill a request, the prover must provide a proof that can be verified with at most the amount of gas specified by this constant. This requirement exists to ensure the client can then post the given proof in a new transaction as part of the application.

uint256 public constant FULFILL_MAX_GAS_FOR_VERIFY = 50000;

SLASHING_BURN_FRACTION_NUMERATOR

When a prover is slashed for failing to fulfill a request, a portion of the stake is burned, and a portion is sent to the client. This fraction controls that ratio.

uint256 public constant SLASHING_BURN_FRACTION_NUMERATOR = 1;

SLASHING_BURN_FRACTION_DENOMINATOR

uint256 public constant SLASHING_BURN_FRACTION_DENOMINATOR = 1;

appnetProverLockinAllowlist

Allow list for the lock-in action for use in the appnet phase of public testing. In order to focus on application developers, public prover participation is limited. In particular, only the provers in this allow-list are able to lock-in jobs. This restriction will be lifted, and this mapping removed, during the public testnet.

mapping(address => bool) appnetProverLockinAllowlist;

MARKET_FEE_NUMERATOR

When an order is fulfilled, the market takes a fee based on the price of the order. This fraction is multiplied by the price to decide the fee.

The fee is configured as a constant to avoid accessing storage and thus paying for the gas of an SLOAD. This means the fee can only be changed by an implementation upgrade. Note that it is currently set to zero.

uint256 public constant MARKET_FEE_NUMERATOR = 0;

MARKET_FEE_DENOMINATOR

uint256 public constant MARKET_FEE_DENOMINATOR = 1;

marketBalance

Balance owned by the market contract itself. This balance is collected from fees, when the fee rate is set to a non-zero value.

uint256 internal marketBalance;

Functions

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor(IRiscZeroVerifier verifier, bytes32 assessorId);

initialize

function initialize(address initialOwner, string calldata _imageUrl) external initializer;

setImageUrl

function setImageUrl(string calldata _imageUrl) external onlyOwner;

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal override onlyOwner;

addProverToAppnetAllowlist

function addProverToAppnetAllowlist(address prover) external onlyOwner;

removeProverFromAppnetAllowlist

function removeProverFromAppnetAllowlist(address prover) external onlyOwner;

requestIsFulfilled

function requestIsFulfilled(uint256 id) external view returns (bool);

requestIsLocked

function requestIsLocked(uint256 id) external view returns (bool);

requestDeadline

function requestDeadline(uint256 id) external view returns (uint64);

eip712DomainSeparator

Domain separator for producing an EIP-712 signature to be verified by this contract.

function eip712DomainSeparator() external view returns (bytes32);

verifyRequestSignature

Internal method for verifying signatures over requests. Reverts on failure.

function verifyRequestSignature(address addr, ProofRequest calldata request, bytes calldata signature)
    public
    view
    returns (bytes32 requestDigest);

deposit

function deposit() public payable;

withdraw

function withdraw(uint256 value) public;

balanceOf

function balanceOf(address addr) public view returns (uint256);

submitRequest

function submitRequest(ProofRequest calldata request, bytes calldata clientSignature) external payable;

lockin

function lockin(ProofRequest calldata request, bytes calldata clientSignature) external;

lockinWithSig

function lockinWithSig(ProofRequest calldata request, bytes calldata clientSignature, bytes calldata proverSignature)
    external;

_validateRequestForLockin

Check that the request is valid, and not already locked or fulfilled by another prover. Returns the auction price and deadline for the request.

function _validateRequestForLockin(ProofRequest calldata request, address client, uint32 idx)
    internal
    view
    returns (uint96 price, uint64 deadline);

_lockinAuthed

function _lockinAuthed(ProofRequest calldata request, bytes32 requestDigest, address client, uint32 idx, address prover)
    internal;

priceRequest

Validates the request and records the price to transient storage such that it can be fulfilled within the same transaction without taking a lock on it.

function priceRequest(ProofRequest calldata request, bytes calldata clientSignature) public;

verifyDelivery

Verify the application and assessor receipts, ensuring that the provided fulfillment satisfies the request.

function verifyDelivery(Fulfillment calldata fill, bytes calldata assessorSeal, address prover) public view;

verifyBatchDelivery

Verify the application and assessor receipts for the batch, ensuring that the provided fulfillments satisfy the requests.

function verifyBatchDelivery(Fulfillment[] calldata fills, bytes calldata assessorSeal, address prover) public view;

fulfill

function fulfill(Fulfillment calldata fill, bytes calldata assessorSeal, address prover) external;

fulfillBatch

function fulfillBatch(Fulfillment[] calldata fills, bytes calldata assessorSeal, address prover) public;

priceAndFulfillBatch

function priceAndFulfillBatch(
    ProofRequest[] calldata requests,
    bytes[] calldata clientSignatures,
    Fulfillment[] calldata fills,
    bytes calldata assessorSeal,
    address prover
) external;

_fulfillVerified

Complete the fulfillment logic after having verified the app and assessor receipts.

function _fulfillVerified(uint256 id, bytes32 requestDigest, address assessorProver, bool requirePayment) internal;

_fulfillVerifiedLocked

function _fulfillVerifiedLocked(
    uint256 id,
    address client,
    uint32 idx,
    bytes32 requestDigest,
    bool fulfilled,
    address assessorProver
) internal returns (bytes memory paymentError);

_fulfillVerifiedUnlocked

function _fulfillVerifiedUnlocked(
    uint256 id,
    address client,
    uint32 idx,
    bytes32 requestDigest,
    bool fulfilled,
    address assessorProver
) internal returns (bytes memory paymentError);

slash

function slash(uint256 requestId) external;

imageInfo

function imageInfo() external view returns (bytes32, string memory);

submitRootAndFulfillBatch

function submitRootAndFulfillBatch(
    bytes32 root,
    bytes calldata seal,
    Fulfillment[] calldata fills,
    bytes calldata assessorSeal,
    address prover
) external;

revertWith

Internal utility function to revert with a pre-encoded error.

function revertWith(bytes memory err) internal pure;