MessageProxy

onlyChainConnector onlyChainConnector() modifier

Modifier to make a function callable only if caller is granted with CHAIN_CONNECTOR_ROLE.

onlyExtraContractRegistrar onlyExtraContractRegistrar() modifier

Modifier to make a function callable only if caller is granted with EXTRA_CONTRACT_REGISTRAR_ROLE.

onlyConstantSetter onlyConstantSetter() modifier

Modifier to make a function callable only if caller is granted with CONSTANT_SETTER_ROLE.

initializeMessageProxy initializeMessageProxy(uint256 newGasLimit) public

isConnectedChain isConnectedChain(string schainName) → bool public

Checks whether schain was connected to MessageProxy.

addConnectedChain addConnectedChain(string schainName) external

Allows msg.sender to connect schain with MessageProxy for transferring messages.

removeConnectedChain removeConnectedChain(string schainName) public

Allows msg.sender to disconnect schain with MessageProxy for transferring messages.

Requirements:

  • msg.sender must be granted CHAIN_CONNECTOR_ROLE.

  • Chain must be initialized.

setNewGasLimit setNewGasLimit(uint256 newGasLimit) external

Sets gasLimit to a new value.

Requirements:

  • msg.sender must be granted CONSTANT_SETTER_ROLE.

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

Posts message from this contract to targetChainHash MessageProxy contract. This is called by a smart contract to make a cross-chain call.

Emits an OutgoingMessage event.

Requirements:

  • Target chain must be initialized.

  • Target chain must be registered as external contract.

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

Virtual function for postIncomingMessages.

registerExtraContractForAll registerExtraContractForAll(address extraContract) external

Allows msg.sender to register extra contract for all schains for being able to transfer messages from custom contracts.

Requirements:

  • msg.sender must be granted as EXTRA_CONTRACT_REGISTRAR_ROLE.

  • Passed address should be contract.

  • Extra contract must not be registered.

removeExtraContractForAll removeExtraContractForAll(address extraContract) external

Allows msg.sender to remove extra contract for all schains. Extra contract will no longer be able to send messages through MessageProxy.

Requirements:

  • msg.sender must be granted as EXTRA_CONTRACT_REGISTRAR_ROLE.

isContractRegistered isContractRegistered(string schainName, address contractAddress) → bool external

Checks whether contract is currently registered as extra contract.

getOutgoingMessagesCounter getOutgoingMessagesCounter(string targetSchainName) → uint256 external

Returns number of outgoing messages.

Requirements:

  • Target schain must be initialized.

getIncomingMessagesCounter getIncomingMessagesCounter(string fromSchainName) → uint256 external

Returns number of incoming messages.

Requirements:

  • Source schain must be initialized.

_addConnectedChain _addConnectedChain(bytes32 schainHash) internal

Allows MessageProxy to connect schain with MessageProxyOnMainnet for transferring messages.

Requirements:

  • msg.sender must be granted CHAIN_CONNECTOR_ROLE.

  • SKALE chain must not be connected.

_callReceiverContract _callReceiverContract(bytes32 schainHash, struct MessageProxy.Message message, uint256 counter) → address internal

Allows MessageProxy to send messages from schain to mainnet. Destination contract must implement postMessage method.

_getGasPayer _getGasPayer(bytes32 schainHash, struct MessageProxy.Message message, uint256 counter) → address internal

_registerExtraContract _registerExtraContract(bytes32 chainHash, address extraContract) internal

Allows MessageProxy to register extra contract for being able to transfer messages from custom contracts.

Requirements:

  • Extra contract address must be contract.

  • Extra contract must not be registered.

  • Extra contract must not be registered for all chains.

_removeExtraContract _removeExtraContract(bytes32 chainHash, address extraContract) internal

Allows MessageProxy to remove extra contract, thus extraContract will no longer be available to transfer messages from mainnet to schain.

Requirements:

  • Extra contract must be registered.

_hashedArray _hashedArray(struct MessageProxy.Message[] messages) → bytes32 internal

Returns hash of message array.

OutgoingMessage OutgoingMessage(bytes32 dstChainHash, uint256 msgCounter, address srcContract, address dstContract, bytes data) event

Emitted for every outgoing message to schain.

PostMessageError PostMessageError(uint256 msgCounter, bytes message) event

Emitted when function postMessage returns revert. Used to prevent stuck loop inside function postIncomingMessages.

GasLimitWasChanged GasLimitWasChanged(uint256 oldValue, uint256 newValue) event

Emitted when gas limit per one call of postMessage was changed.