OVMClient
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
Name | Type | Description |
---|---|---|
requestId | bytes32 | The 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
Name | Type | Description |
---|---|---|
requestId | bytes32 | The 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
Name | Type | Description |
---|---|---|
requestId | bytes32 | The ID of the request. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isPending 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
Name | Type | Description |
---|---|---|
<none> | Specification | specification The specification of the contract. |
getOVMGatewayAddress
Get the address of the OVMGateway contract.
function getOVMGatewayAddress() public view virtual override returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the OVMGateway contract. |
_updateSpecification
Updates the specification of the OVM client.
function _updateSpecification(Specification memory spec) internal;
Parameters
Name | Type | Description |
---|---|---|
spec | Specification | The 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
Name | Type | Description |
---|---|---|
requester | address | The address to send the requester. |
payment | uint256 | The amount of payment to send with the request. |
deterministic | bool | Whether the request is deterministic. |
data | bytes | The data encoded with computing params to send in the request. |
Returns
Name | Type | Description |
---|---|---|
requestId | bytes32 | The new ID of the request. |
_removePendingRequest
Removes a pending request.
function _removePendingRequest(bytes32 requestId) internal virtual;
Parameters
Name | Type | Description |
---|---|---|
requestId | bytes32 | The ID of the pending request to be removed. |
_updateOVMGatewayAddress
Update the address of the OVMGateway contract
function _updateOVMGatewayAddress(address OVMGateway) internal;
Parameters
Name | Type | Description |
---|---|---|
OVMGateway | address | The address of the OVMGateway contract |
_getOVMGatewayAddress
Get the address of the OVMGateway contract
function _getOVMGatewayAddress() internal view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the OVMGateway contract |