IReactive
Overview
The following Solidity code defines the IReactive
interface, which is intended for use with reactive contracts designed to
receive notifications about new events that match specific criteria defined in their event subscriptions.
pragma solidity >=0.8.0;
interface IReactive {
function react(
uint256 chain_id,
address _contract,
uint256 topic_0,
uint256 topic_1,
uint256 topic_2,
uint256 topic_3,
bytes calldata data,
uint256 block_number
) external;
}
Description
The interface contains a single function called react
, which serves as the entry point for handling new event notifications.
The function is marked as external
, which means that any contract implementing the IReactive
Interface must provide a function
with identical parameters and visibility specifier that can be called from outside the implementing contract. The react
function takes several parameters:
-
chain_id
: Auint256
representing theEIP155
source chain ID for the event. -
_contract
: The address of the originating contract that emitted the event. -
topic_0
,topic_1
,topic_2
,topic_3
: The topics of the event, which areuint256
values. Depending on the event, these topics may contain specific information related to the event. -
data
: The event data encoded as a byte array. -
block_number
: The block number where the log record for the event is located in its chain of origin.