OVMClient

Git Source

Inherits: IOVMClient

THIS IS AN EXAMPLE CONTRACT WHICH USES HARDCODED VALUES FOR CLARITY. THIS EXAMPLE USES UN-AUDITED CODE. DO NOT USE THIS CODE IN PRODUCTION.

State Variables

DENOMINATOR

uint96 public constant DENOMINATOR = 10000;

_OVMGateway

address of the OVMGateway contract

address private _OVMGateway;

_pendingRequests

pending requests are requests that are not yet responded by the OVM task contract

mapping(bytes32 requestId => bool isPending) private _pendingRequests;

_specification

specification is the metadata of the OVM client

Specification private _specification;

Functions

recordResponse

Modifier to record the response of a request. It removes the pending request, emits a ResponseRecorded event, and then executes the function.

modifier recordResponse(bytes32 requestId);

Parameters

NameTypeDescription
requestIdbytes32The ID of the request to record the response for.

onlyOVMGateway

modifier onlyOVMGateway();

cancelRequest

Cancels a request by its requestId. Emits a {RequestCancelled} event.

function cancelRequest(bytes32 requestId) public virtual override;

Parameters

NameTypeDescription
requestIdbytes32The ID of the request to be cancelled.

isPendingRequest

Checks if a request is pending.

function isPendingRequest(bytes32 requestId) public view virtual override returns (bool);

Parameters

NameTypeDescription
requestIdbytes32The ID of the request.

Returns

NameTypeDescription
<none>boolisPending True if the request is pending, otherwise false.

getSpecification

Returns the specification of the contract.

function getSpecification() public view virtual override returns (Specification memory);

Returns

NameTypeDescription
<none>Specificationspecification The specification of the contract.

getOVMGatewayAddress

Get the address of the OVMGateway contract.

function getOVMGatewayAddress() public view virtual override returns (address);

Returns

NameTypeDescription
<none>addressThe address of the OVMGateway contract.

_updateSpecification

Updates the specification of the OVM client.

function _updateSpecification(Specification memory spec) internal;

Parameters

NameTypeDescription
specSpecificationThe new specification to update.

_sendRequest

Creates a request that can hold additional parameters.

function _sendRequest(address requester, uint256 payment, bool deterministic, bytes memory data)
    internal
    virtual
    returns (bytes32 requestId);

Parameters

NameTypeDescription
requesteraddressThe address to send the requester.
paymentuint256The amount of payment to send with the request.
deterministicboolWhether the request is deterministic.
databytesThe data encoded with computing params to send in the request.

Returns

NameTypeDescription
requestIdbytes32The new ID of the request.

_removePendingRequest

Removes a pending request.

function _removePendingRequest(bytes32 requestId) internal virtual;

Parameters

NameTypeDescription
requestIdbytes32The ID of the pending request to be removed.

_updateOVMGatewayAddress

Update the address of the OVMGateway contract

function _updateOVMGatewayAddress(address OVMGateway) internal;

Parameters

NameTypeDescription
OVMGatewayaddressThe address of the OVMGateway contract

_getOVMGatewayAddress

Get the address of the OVMGateway contract

function _getOVMGatewayAddress() internal view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the OVMGateway contract