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, |
initializeAllRegisteredContracts initializeAllRegisteredContracts(bytes32 chainHash, address[] contracts) external
Allows DEFAULT_ADMIN_ROLE to initialize registered contracts Notice - this function will be executed only once during upgrade
Requirements:
msg.sender should have DEFAULT_ADMIN_ROLE
registerExtraContract registerExtraContract(string chainName, address extraContract) external
removeExtraContract removeExtraContract(string chainName, address extraContract) external
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.
postIncomingMessages postIncomingMessages(string fromChainName, uint256 startingCounter, struct IMessageProxy.Message[] messages, struct IMessageProxy.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.
setVersion setVersion(string newVersion) external
Sets new version of contracts on schain
Requirements:
-
msg.sendermust be granted DEFAULT_ADMIN_ROLE.
verifyOutgoingMessageData verifyOutgoingMessageData(struct IMessageProxyForSchain.OutgoingMessageData message) → bool isValidMessage external
Verify if the message metadata is valid.
verifySignature verifySignature(bytes32 hashedMessage, struct IMessageProxy.Signature signature) → bool external
Verify signature of hashed message
initialize initialize(contract IKeyStorage blsKeyStorage, string schainName) public
Is called once during contract deployment.
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.
_verifyMessages _verifyMessages(bytes32 hashedMessages, struct IMessageProxy.Signature signature) → bool internal
Converts calldata structure to memory structure and checks whether message BLS signature is valid. Returns true if signature is valid.
_getRegistryContracts _getRegistryContracts() → mapping(bytes32 => struct EnumerableSetUpgradeable.AddressSet) internal
_getEtherbase _getEtherbase() → contract IEtherbaseUpgradeable internal
Returns Etherbase contract