IBaseStateRegistry

Git Source

Author: ZeroPoint Labs

Is the crosschain interaction point. Send, store & process crosschain messages

Functions

dispatchPayload

allows core contracts to send payload to a destination chain.

function dispatchPayload(
    address srcSender_,
    uint8[] memory ambIds_,
    uint64 dstChainId_,
    bytes memory message_,
    bytes memory extraData_
)
    external
    payable;

Parameters

NameTypeDescription
srcSender_addressis the caller of the function (used for gas refunds).
ambIds_uint8[]is the identifier of the arbitrary message bridge to be used
dstChainId_uint64is the internal chainId used throughtout the protocol
message_bytesis the crosschain payload to be sent
extraData_bytesdefines all the message bridge realted overrides NOTE: dstChainId_ is mapped to message bridge's destination id inside it's implementation contract NOTE: ambIds_ are superform assigned unique identifier for arbitrary message bridges

receivePayload

allows state registry to receive messages from message bridge implementations

function receivePayload(uint64 srcChainId_, bytes memory message_) external;

Parameters

NameTypeDescription
srcChainId_uint64is the superform chainId from which the payload is dispatched/sent
message_bytesis the crosschain payload received NOTE: Only {IMPLEMENTATION_CONTRACT} role can call this function.

processPayload

allows previlaged actors to process cross-chain payloads

function processPayload(uint256 payloadId_) external payable;

Parameters

NameTypeDescription
payloadId_uint256is the identifier of the cross-chain payload NOTE: Only {CORE_STATE_REGISTRY_PROCESSOR_ROLE} role can call this function NOTE: this should handle reverting the state on source chain in-case of failure (or) can implement scenario based reverting like in coreStateRegistry

payloadsCount

allows users to read the total payloads received by the registry

function payloadsCount() external view returns (uint256);

payloadTracking

allows user to read the payload state uint256 payloadId_ is the unique payload identifier allocated on the destiantion chain

function payloadTracking(uint256 payloadId_) external view returns (PayloadState payloadState_);

payloadBody

allows users to read the bytes payload_ stored per payloadId_

function payloadBody(uint256 payloadId_) external view returns (bytes memory payloadBody_);

Parameters

NameTypeDescription
payloadId_uint256is the unqiue payload identifier allocated on the destination chain

Returns

NameTypeDescription
payloadBody_bytesthe crosschain data received

payloadHeader

allows users to read the uint256 payloadHeader stored per payloadId_

function payloadHeader(uint256 payloadId_) external view returns (uint256 payloadHeader_);

Parameters

NameTypeDescription
payloadId_uint256is the unqiue payload identifier allocated on the destination chain

Returns

NameTypeDescription
payloadHeader_uint256the crosschain header received

msgAMB

allows users to read the amb that delivered the payload

function msgAMB(uint256 payloadId_) external view returns (uint8 ambId_);

Parameters

NameTypeDescription
payloadId_uint256is the unqiue payload identifier allocated on the destination chain

Returns

NameTypeDescription
ambId_uint8is the amb that delivered the payload

getProofAMB

allows users to read the amb that delivered the proof

function getProofAMB(bytes32 proof_) external view returns (uint8[] memory ambIds_);

Parameters

NameTypeDescription
proof_bytes32is the bytes32 proof

Returns

NameTypeDescription
ambIds_uint8[]is the identifier of ambs that delivered the proof

Events

PayloadReceived

is emitted when a cross-chain payload is received in the state registry

event PayloadReceived(uint64 srcChainId, uint64 dstChainId, uint256 payloadId);

ProofReceived

is emitted when a cross-chain proof is received in the state registry NOTE: comes handy if quorum required is more than 0

event ProofReceived(bytes proof);

PayloadUpdated

is emitted when a payload id gets updated

event PayloadUpdated(uint256 payloadId);

PayloadProcessed

is emitted when a payload id gets processed

event PayloadProcessed(uint256 payloadId);

SuperRegistryUpdated

is emitted when the super registry address is updated

event SuperRegistryUpdated(address indexed superRegistry);