Skip to content

ProofRequestLibrary

State Variables

PROOF_REQUEST_TYPE

Id is uint256 as for user defined types, the eip712 type hash uses the underlying type.

string constant PROOF_REQUEST_TYPE =
    "ProofRequest(uint256 id,Requirements requirements,string imageUrl,Input input,Offer offer)";

PROOF_REQUEST_TYPEHASH

bytes32 constant PROOF_REQUEST_TYPEHASH = keccak256(
    abi.encodePacked(
        PROOF_REQUEST_TYPE,
        CallbackLibrary.CALLBACK_TYPE,
        InputLibrary.INPUT_TYPE,
        OfferLibrary.OFFER_TYPE,
        PredicateLibrary.PREDICATE_TYPE,
        RequirementsLibrary.REQUIREMENTS_TYPE
    )
);

Functions

eip712Digest

Computes the EIP-712 digest for the given proof request.

function eip712Digest(ProofRequest memory request) internal pure returns (bytes32);
Parameters
NameTypeDescription
requestProofRequestThe proof request to compute the digest for.
Returns
NameTypeDescription
<none>bytes32The EIP-712 digest of the proof request.

validate

Validates the proof request with the intention for it to be priced. Does not check if the request is already locked or fulfilled, but does check if it has expired.

function validate(ProofRequest calldata request) internal view returns (uint64 lockDeadline, uint64 deadline);
Parameters
NameTypeDescription
requestProofRequestThe proof request to validate.
Returns
NameTypeDescription
lockDeadlineuint64The deadline for when a lock expires for the request.
deadlineuint64The deadline for the request as a whole.