SubscriptionConsumer
Git Source (opens in a new tab)
Inherits: BaseConsumer
Allows creating recurring subscriptions for off-chain container compute
Inherits BaseConsumer
to inherit functions to receive container compute responses and emit container inputs
Functions
constructor
Initialize new SubscriptionConsumer
constructor(address registry) BaseConsumer(registry);
Parameters
Name | Type | Description |
---|---|---|
registry | address | registry address |
_createComputeSubscription
Creates a recurring request for off-chain container compute via callback response
function _createComputeSubscription(
string memory containerId,
uint32 frequency,
uint32 period,
uint16 redundancy,
bool lazy,
address paymentToken,
uint256 paymentAmount,
address wallet,
address verifier
) internal returns (uint32);
Parameters
Name | Type | Description |
---|---|---|
containerId | string | compute container identifier(s) used by off-chain Infernet node |
frequency | uint32 | max number of times to process subscription (i.e, frequency == 1 is a one-time request) |
period | uint32 | period, in seconds, at which to progress each responding interval |
redundancy | uint16 | number of unique responding Infernet nodes |
lazy | bool | whether to lazily store subscription responses in Inbox |
paymentToken | address | If providing payment for compute, payment token address (address(0) for ETH, else ERC20 contract address) |
paymentAmount | uint256 | If providing payment for compute, payment in paymentToken per compute request fulfillment |
wallet | address | If providing payment for compute, Infernet Wallet address; this contract must be approved spender of Wallet |
verifier | address | optional verifier contract to restrict payment based on response proof verification |
Returns
Name | Type | Description |
---|---|---|
<none> | uint32 | subscription ID of newly-created subscription |
_cancelComputeSubscription
Cancels a created subscription
Can only cancel owned subscriptions (address(this) == Coordinator.subscriptions[subscriptionId].owner
)
function _cancelComputeSubscription(uint32 subscriptionId) internal;
Parameters
Name | Type | Description |
---|---|---|
subscriptionId | uint32 | ID of subscription to cancel |