Skip to content

IBoundlessMarket

Functions

requestIsLocked

Check if the given request has been locked (i.e. accepted) by a prover.

When a request is locked, only the prover it is locked to can be paid to fulfill the job.

function requestIsLocked(RequestId requestId) external view returns (bool);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
Returns
NameTypeDescription
<none>boolTrue if the request is locked, false otherwise.

requestIsSlashed

Check if the given request resulted in the prover being slashed (i.e. request was locked in but proof was not delivered)

Note it is possible for a request to result in a slash, but still be fulfilled if for example another prover decided to fulfill the request altruistically. This function should not be used to determine if a request was fulfilled.

function requestIsSlashed(RequestId requestId) external view returns (bool);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
Returns
NameTypeDescription
<none>boolTrue if the request resulted in the prover being slashed, false otherwise.

requestIsFulfilled

Check if the given request has been fulfilled (i.e. a proof was delivered).

function requestIsFulfilled(RequestId requestId) external view returns (bool);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
Returns
NameTypeDescription
<none>boolTrue if the request is fulfilled, false otherwise.

requestLockDeadline

For a given locked request, returns when the lock expires.

If the request is not locked, this function will revert.

function requestLockDeadline(RequestId requestId) external view returns (uint64);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
Returns
NameTypeDescription
<none>uint64The expiration time of the lock on the request.

requestDeadline

For a given locked request, returns when request expires.

If the request is not locked, this function will revert.

function requestDeadline(RequestId requestId) external view returns (uint64);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
Returns
NameTypeDescription
<none>uint64The expiration time of the request.

deposit

Deposit Ether into the market to pay for proof.

Value deposited is msg.value and it is credited to the account of msg.sender.

function deposit() external payable;

withdraw

Withdraw Ether from the market.

Value is debited from msg.sender.

function withdraw(uint256 value) external;
Parameters
NameTypeDescription
valueuint256The amount to withdraw.

balanceOf

Check the deposited balance, in Ether, of the given account.

function balanceOf(address addr) external view returns (uint256);
Parameters
NameTypeDescription
addraddressThe address of the account.
Returns
NameTypeDescription
<none>uint256The balance of the account.

withdrawFromTreasury

Withdraw funds from the market's treasury.

Value is debited from the market's account.

function withdrawFromTreasury(uint256 value) external;
Parameters
NameTypeDescription
valueuint256The amount to withdraw.

withdrawFromStakeTreasury

Withdraw funds from the market' stake treasury.

Value is debited from the market's account.

function withdrawFromStakeTreasury(uint256 value) external;
Parameters
NameTypeDescription
valueuint256The amount to withdraw.

depositStake

Deposit stake into the market to pay for lockin stake.

Before calling this method, the account owner must approve the contract as an allowed spender.

function depositStake(uint256 value) external;

depositStakeWithPermit

Permit and deposit stake into the market to pay for lockin stake.

This method requires a valid EIP-712 signature from the account owner.

function depositStakeWithPermit(uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;

withdrawStake

Withdraw stake from the market.

function withdrawStake(uint256 value) external;

balanceOfStake

Check the deposited balance, in HP, of the given account.

function balanceOfStake(address addr) external view returns (uint256);

submitRequest

Submit a request such that it is publicly available for provers to evaluate and bid on. Any msg.value sent with the call will be added to the balance of msg.sender.

Submitting the transaction only broadcasts it, and is not a required step. This method does not validate the signature or store any state related to the request. Verifying the signature here is not required for protocol safety as the signature is checked when the request is locked, and during fulfillment (by the assessor).

function submitRequest(ProofRequest calldata request, bytes calldata clientSignature) external payable;
Parameters
NameTypeDescription
requestProofRequestThe proof request details.
clientSignaturebytesThe signature of the client.

lockRequest

Lock the request to the prover, giving them exclusive rights to be paid to fulfill this request, and also making them subject to slashing penalties if they fail to deliver. At this point, the price for fulfillment is also set, based on the reverse Dutch auction parameters and the time at which this transaction is processed.

This method should be called from the address of the prover.

function lockRequest(ProofRequest calldata request, bytes calldata clientSignature) external;
Parameters
NameTypeDescription
requestProofRequestThe proof request details.
clientSignaturebytesThe signature of the client.

lockRequestWithSignature

Lock the request to the prover, giving them exclusive rights to be paid to fulfill this request, and also making them subject to slashing penalties if they fail to deliver. At this point, the price for fulfillment is also set, based on the reverse Dutch auction parameters and the time at which this transaction is processed.

This method uses the provided signature to authenticate the prover.

function lockRequestWithSignature(
    ProofRequest calldata request,
    bytes calldata clientSignature,
    bytes calldata proverSignature
) external;
Parameters
NameTypeDescription
requestProofRequestThe proof request details.
clientSignaturebytesThe signature of the client.
proverSignaturebytesThe signature of the prover.

fulfill

Fulfill a request by delivering the proof for the application. If the order is locked, only the prover that locked the order may receive payment. If another prover delivers a proof for an order that is locked, this method will revert unless paymentRequired is set to false on the Fulfillment struct.

function fulfill(Fulfillment calldata fill, AssessorReceipt calldata assessorReceipt)
    external
    returns (bytes memory paymentError);
Parameters
NameTypeDescription
fillFulfillmentThe fulfillment information, including the journal and seal.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

fulfillBatch

Fulfills a batch of requests. See IBoundlessMarket.fulfill for more information.

function fulfillBatch(Fulfillment[] calldata fills, AssessorReceipt calldata assessorReceipt)
    external
    returns (bytes[] memory paymentError);
Parameters
NameTypeDescription
fillsFulfillment[]The array of fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

fulfillAndWithdraw

Fulfill a request by delivering the proof for the application and withdraw from the prover balance. If the order is locked, only the prover that locked the order may receive payment. If another prover delivers a proof for an order that is locked, this method will revert unless paymentRequired is set to false on the Fulfillment struct.

function fulfillAndWithdraw(Fulfillment calldata fill, AssessorReceipt calldata assessorReceipt)
    external
    returns (bytes memory paymentError);
Parameters
NameTypeDescription
fillFulfillmentThe fulfillment information, including the journal and seal.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

fulfillBatchAndWithdraw

Fulfills a batch of requests and withdraw from the prover balance. See IBoundlessMarket.fulfill for more information.

function fulfillBatchAndWithdraw(Fulfillment[] calldata fills, AssessorReceipt calldata assessorReceipt)
    external
    returns (bytes[] memory paymentError);
Parameters
NameTypeDescription
fillsFulfillment[]The array of fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

verifyDelivery

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

function verifyDelivery(Fulfillment calldata fill, AssessorReceipt calldata assessorReceipt) external view;
Parameters
NameTypeDescription
fillFulfillmentThe fulfillment information, including the journal and seal.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

verifyBatchDelivery

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

function verifyBatchDelivery(Fulfillment[] calldata fills, AssessorReceipt calldata assessorReceipt) external view;
Parameters
NameTypeDescription
fillsFulfillment[]The array of fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

priceRequest

Checks the validity of the request and then writes the current auction price to transient storage.

When called within the same transaction, this method can be used to fulfill a request that is not locked. This is useful when the prover wishes to fulfill a request, but does not want to issue a lock transaction e.g. because the stake is too high or to save money by avoiding the gas costs of the lock transaction.

function priceRequest(ProofRequest calldata request, bytes calldata clientSignature) external;
Parameters
NameTypeDescription
requestProofRequestThe proof request details.
clientSignaturebytesThe signature of the client.

priceAndFulfill

A combined call to IBoundlessMarket.priceRequest and IBoundlessMarket.fulfill. The caller should provide the signed request and signature for each unlocked request they want to fulfill. Payment for unlocked requests will go to the provided prover address.

function priceAndFulfill(
    ProofRequest calldata request,
    bytes calldata clientSignature,
    Fulfillment calldata fill,
    AssessorReceipt calldata assessorReceipt
) external returns (bytes memory paymentError);
Parameters
NameTypeDescription
requestProofRequestThe proof requests.
clientSignaturebytesThe client signatures.
fillFulfillmentThe fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

priceAndFulfillBatch

A combined call to IBoundlessMarket.priceRequest and IBoundlessMarket.fulfillBatch. The caller should provide the signed request and signature for each unlocked request they want to fulfill. Payment for unlocked requests will go to the provided prover address.

function priceAndFulfillBatch(
    ProofRequest[] calldata requests,
    bytes[] calldata clientSignatures,
    Fulfillment[] calldata fills,
    AssessorReceipt calldata assessorReceipt
) external returns (bytes[] memory paymentError);
Parameters
NameTypeDescription
requestsProofRequest[]The array of proof requests.
clientSignaturesbytes[]The array of client signatures.
fillsFulfillment[]The array of fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

priceAndFulfillAndWithdraw

A combined call to IBoundlessMarket.priceRequest and IBoundlessMarket.fulfillAndWithdraw. The caller should provide the signed request and signature for each unlocked request they want to fulfill. Payment for unlocked requests will go to the provided prover address.

function priceAndFulfillAndWithdraw(
    ProofRequest calldata request,
    bytes calldata clientSignature,
    Fulfillment calldata fill,
    AssessorReceipt calldata assessorReceipt
) external returns (bytes memory paymentError);
Parameters
NameTypeDescription
requestProofRequestThe proof requests.
clientSignaturebytesThe client signatures.
fillFulfillmentThe fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

priceAndFulfillBatchAndWithdraw

A combined call to IBoundlessMarket.priceRequest and IBoundlessMarket.fulfillBatchAndWithdraw. The caller should provide the signed request and signature for each unlocked request they want to fulfill. Payment for unlocked requests will go to the provided prover address.

function priceAndFulfillBatchAndWithdraw(
    ProofRequest[] calldata requests,
    bytes[] calldata clientSignatures,
    Fulfillment[] calldata fills,
    AssessorReceipt calldata assessorReceipt
) external returns (bytes[] memory paymentError);
Parameters
NameTypeDescription
requestsProofRequest[]The array of proof requests.
clientSignaturesbytes[]The array of client signatures.
fillsFulfillment[]The array of fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

submitRoot

Submit a new root to a set-verifier.

Consider using submitRootAndFulfillBatch to submit the root and fulfill in one transaction.

function submitRoot(address setVerifier, bytes32 root, bytes calldata seal) external;
Parameters
NameTypeDescription
setVerifieraddressThe address of the set-verifier contract.
rootbytes32The new merkle root.
sealbytesThe seal of the new merkle root.

submitRootAndFulfillBatch

Combined function to submit a new root to a set-verifier and call fulfillBatch.

Useful to reduce the transaction count for fulfillments.

function submitRootAndFulfillBatch(
    address setVerifier,
    bytes32 root,
    bytes calldata seal,
    Fulfillment[] calldata fills,
    AssessorReceipt calldata assessorReceipt
) external returns (bytes[] memory paymentError);
Parameters
NameTypeDescription
setVerifieraddressThe address of the set-verifier contract.
rootbytes32The new merkle root.
sealbytesThe seal of the new merkle root.
fillsFulfillment[]The array of fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

submitRootAndFulfillBatchAndWithdraw

Combined function to submit a new root to a set-verifier and call fulfillBatchAndWithdraw.

Useful to reduce the transaction count for fulfillments.

function submitRootAndFulfillBatchAndWithdraw(
    address setVerifier,
    bytes32 root,
    bytes calldata seal,
    Fulfillment[] calldata fills,
    AssessorReceipt calldata assessorReceipt
) external returns (bytes[] memory paymentError);
Parameters
NameTypeDescription
setVerifieraddressThe address of the set-verifier contract.
rootbytes32The new merkle root.
sealbytesThe seal of the new merkle root.
fillsFulfillment[]The array of fulfillment information.
assessorReceiptAssessorReceiptThe Assessor's guest fulfillment information verified to confirm the request's requirements are met.

slash

When a prover fails to fulfill a request by the deadline, this method can be used to burn the associated prover stake.

The provers stake has already been transferred to the contract when the request was locked. This method just burn the stake.

function slash(RequestId requestId) external;
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

eip712DomainSeparator

EIP 712 domain separator getter.

function eip712DomainSeparator() external view returns (bytes32);
Returns
NameTypeDescription
<none>bytes32The EIP 712 domain separator.

imageInfo

Returns the assessor imageId and its url.

function imageInfo() external view returns (bytes32, string memory);
Returns
NameTypeDescription
<none>bytes32The imageId and its url.
<none>string

STAKE_TOKEN_CONTRACT

Returns the address of the token used for stake deposits.

function STAKE_TOKEN_CONTRACT() external view returns (address);

Events

RequestSubmitted

Event logged when a new proof request is submitted by a client.

Note that the signature is not verified by the contract and should instead be verified by the receiver of the event.

event RequestSubmitted(RequestId indexed requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

RequestLocked

Event logged when a request is locked in by the given prover.

event RequestLocked(RequestId indexed requestId, address prover);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
proveraddressThe address of the prover.

RequestFulfilled

Event logged when a request is fulfilled.

event RequestFulfilled(RequestId indexed requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

ProofDelivered

Event logged when a proof is delivered that satisfies the request's requirements.

It is possible for this event to be logged multiple times for a single request. This is usually logged as part of order fulfillment, however it can also be logged by a prover sending the proof without payment.

event ProofDelivered(RequestId indexed requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

ProverSlashed

Event when a prover is slashed is made to the market.

event ProverSlashed(RequestId indexed requestId, uint256 stakeBurned, uint256 stakeTransferred, address stakeRecipient);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
stakeBurneduint256The amount of stake burned.
stakeTransferreduint256The amount of stake transferred to either the fulfilling prover or the market.
stakeRecipientaddressThe address of the stake recipient. Typically the fulfilling prover, but can be the market.

Deposit

Event when a deposit is made to the market.

event Deposit(address indexed account, uint256 value);
Parameters
NameTypeDescription
accountaddressThe account making the deposit.
valueuint256The value of the deposit.

Withdrawal

Event when a withdrawal is made from the market.

event Withdrawal(address indexed account, uint256 value);
Parameters
NameTypeDescription
accountaddressThe account making the withdrawal.
valueuint256The value of the withdrawal.

StakeDeposit

Event when a stake deposit is made to the market.

event StakeDeposit(address indexed account, uint256 value);
Parameters
NameTypeDescription
accountaddressThe account making the deposit.
valueuint256The value of the deposit.

StakeWithdrawal

Event when a stake withdrawal is made to the market.

event StakeWithdrawal(address indexed account, uint256 value);
Parameters
NameTypeDescription
accountaddressThe account making the withdrawal.
valueuint256The value of the withdrawal.

Upgraded

Event when the contract is upgraded to a new version.

event Upgraded(uint64 indexed version);
Parameters
NameTypeDescription
versionuint64The new version of the contract.

PaymentRequirementsFailed

Event emitted during fulfillment if a request was fulfilled, but payment was not transferred because at least one condition was not met. See the documentation on IBoundlessMarket.fulfillBatch for more information.

The payload of the event is an ABI encoded error, from the errors on this contract. If there is an unexpired lock on the request, the order, the prover holding the lock may still be able to receive payment by sending another transaction.

event PaymentRequirementsFailed(bytes error);
Parameters
NameTypeDescription
errorbytesThe ABI encoded error.

CallbackFailed

Event emitted when a callback to a contract fails during fulfillment

event CallbackFailed(RequestId indexed requestId, address callback, bytes error);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request that was being fulfilled
callbackaddressThe address of the callback contract that failed
errorbytesThe error message from the failed call

Errors

RequestIsLocked

Error when a request is locked when it was not required to be.

error RequestIsLocked(RequestId requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

RequestIsExpiredOrNotPriced

Error when a request is expired or not priced when it was required to be. Either locking the request, or calling the IBoundlessMarket.priceRequest function in the same transaction will satisfy this requirement.

error RequestIsExpiredOrNotPriced(RequestId requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

RequestIsNotLocked

Error when a request is not locked when it was required to be.

error RequestIsNotLocked(RequestId requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

RequestIsFulfilled

Error when a request is fulfilled when it was not required to be.

error RequestIsFulfilled(RequestId requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

RequestIsSlashed

Error when a request is slashed when it was not required to be.

error RequestIsSlashed(RequestId requestId);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.

RequestLockIsExpired

Error when a request lock is no longer valid, as the lock deadline has passed.

error RequestLockIsExpired(RequestId requestId, uint64 lockDeadline);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
lockDeadlineuint64The lock deadline of the request.

RequestIsExpired

Error when a request is no longer valid, as the deadline has passed.

error RequestIsExpired(RequestId requestId, uint64 deadline);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
deadlineuint64The deadline of the request.

RequestIsNotExpired

Error when a request is still valid, as the deadline has yet to pass.

error RequestIsNotExpired(RequestId requestId, uint64 deadline);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
deadlineuint64The deadline of the request.

InvalidRequestFulfillment

Error when request being fulfilled doesn't match the request that was locked.

This can happen if a client signs multiple requests with the same ID (i.e. multiple versions of the same request) and a prover locks one version but then tries to call fulfill using a different version.

error InvalidRequestFulfillment(RequestId requestId, bytes32 provided, bytes32 locked);
Parameters
NameTypeDescription
requestIdRequestIdThe ID of the request.
providedbytes32The provided fingerprint.
lockedbytes32The locked fingerprint.

InsufficientBalance

Error when unable to complete request because of insufficient balance.

error InsufficientBalance(address account);
Parameters
NameTypeDescription
accountaddressThe account with insufficient balance.

InvalidSignature

Error when a signature did not pass verification checks.

error InvalidSignature();

InvalidRequest

Error when a request is malformed or internally inconsistent.

error InvalidRequest();

TransferFailed

Error when transfer of funds to an external address fails.

error TransferFailed();

SelectorMismatch

Error when providing a seal with a different selector than required.

error SelectorMismatch(bytes4 required, bytes4 provided);

BatchSizeExceedsLimit

Error when the batch size exceeds the limit.

error BatchSizeExceedsLimit(uint256 batchSize, uint256 limit);