IStateConnector
#
Interface for interacting with the State Connector.
The interface enables requests to be made to the State Connector and related data, such as round IDs and Merkle roots, to be managed.
Events#
AttestationRequest
#
event AttestationRequest(
address sender,
uint256 timestamp,
bytes data
)
Triggered after an attestation request is made. This event is used by attestation providers to start processing the requests.
Parameters | Type | Description |
---|---|---|
sender |
address |
The address that initiated the attestation request. |
timestamp |
uint256 |
The UNIX epoch time in seconds when the request was made. |
data |
bytes |
The hash of the data being attested to, including a message integrity code to ensure proper validation. |
RoundFinalised
#
event RoundFinalised(
uint256 roundId,
bytes32 merkleRoot
)
Triggered after a round of attestations is completed and the data for that round is validated and finalized.
Parameters | Type | Description |
---|---|---|
roundId |
uint256 |
The ID of the round that is finalized. |
merkleRoot |
bytes32 |
The corresponding Merkle root for the finalized round. |
Functions#
BUFFER_TIMESTAMP_OFFSET
#
function BUFFER_TIMESTAMP_OFFSET(
) external view returns (
uint256);
Retrieves the timestamp of round number 0, which serves as an offset to calculate the timestamps
of all subsequent attestation rounds. For more details, see BUFFER_WINDOW
.
Returns | Type | Description |
---|---|---|
[0] | uint256 |
The timestamp offset in seconds since the UNIX epoch. |
BUFFER_WINDOW
#
function BUFFER_WINDOW(
) external view returns (
uint256);
Retrieves the duration of attestation rounds, which is used to calculate the round ID from a given timestamp.
The calculation formula is: roundId = (timestamp - BUFFER_TIMESTAMP_OFFSET
) / BUFFER_WINDOW
.
Returns | Type | Description |
---|---|---|
[0] | uint256 |
The duration in seconds of an attestation round. |
lastFinalizedRoundId
#
function lastFinalizedRoundId(
) external view returns (
uint256 _roundId);
Retrieves the ID of the most recently finalized round, which corresponds to the last round ID that has a stored Merkle root available.
Returns | Type | Description |
---|---|---|
_roundId |
uint256 |
The ID of the last finalized round. |
requestAttestations
#
function requestAttestations(
bytes _data
) external;
Requests an attestation and emits the AttestationRequest
event.
To learn about the format of this data, see Attestation types.
Parameters | Type | Description |
---|---|---|
_data |
bytes |
The data being submitted for attestation. |