MessageProxyForSchain

Entry point for messages that come from mainnet or other SKALE chains and contract that emits messages for mainnet or other SKALE chains.

Messages are submitted by IMA-agent and secured with threshold signature.

IMA-agent monitors events of MessageProxyForSchain and sends messages to other chains.

16 Agents Synchronize time with time.nist.gov Every agent checks if it is their time slot Time slots are in increments of 5 minutes At the start of their slot each agent: For each connected schain: Read incoming counter on the dst chain Read outgoing counter on the src chain Calculate the difference outgoing - incoming Call postIncomingMessages function passing (un)signed message array ID of this schain, Chain 0 represents ETH mainnet,
Modifiers
Events

registerExtraContract registerExtraContract(string chainName, address extraContract) external

removeExtraContract removeExtraContract(string chainName, address extraContract) external

initialize initialize(contract KeyStorage blsKeyStorage, string schainName) public

Is called once during contract deployment.

addConnectedChain addConnectedChain(string chainName) external

Link external chain.

Mainnet is linked automatically.

Requirements:

  • Function caller has to be granted with {CHAIN_CONNECTOR_ROLE}.

  • Target chain must be different from the current.

removeConnectedChain removeConnectedChain(string chainName) public

Unlink external SKALE chain.

Requirements:

  • Function caller has to be granted with {CHAIN_CONNECTOR_ROLE}.

  • Target chain must be different from Mainnet.

postOutgoingMessage postOutgoingMessage(bytes32 targetChainHash, address targetContract, bytes data) public

This function is called by a smart contract that wants to make a cross-chain call.

Requirements:

  • Destination chain has to be registered.

  • Sender contract has to be registered.

postIncomingMessages postIncomingMessages(string fromChainName, uint256 startingCounter, struct MessageProxy.Message[] messages, struct MessageProxy.Signature signature) external

Entry point for incoming messages. This function is called by IMA-agent to deliver incoming messages from external chains.

Requirements:

  • Origin chain has to be registered.

  • Amount of messages must be no more than {MESSAGES_LENGTH}.

  • Messages batch has to be signed with threshold signature. by super majority of current SKALE chain nodes.

  • All previous messages must be already delivered.

verifyOutgoingMessageData verifyOutgoingMessageData(struct MessageProxyForSchain.OutgoingMessageData message) → bool isValidMessage external

Verify if the message metadata is valid.

_verifyMessages _verifyMessages(bytes32 hashedMessages, struct MessageProxy.Signature signature) → bool internal

Converts calldata structure to memory structure and checks whether message BLS signature is valid. Returns true if signature is valid.