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.

setNewGasLimit setNewGasLimit(uint256 newGasLimit) external

Sets gasLimit to a new value.

Requirements:

  • msg.sender must be granted CONSTANT_SETTER_ROLE.

postIncomingMessages postIncomingMessages(string fromSchainName, uint256 startingCounter, struct IMessageProxy.Message[] messages, struct IMessageProxy.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.

getContractRegisteredLength getContractRegisteredLength(bytes32 schainHash) → uint256 external

Should return length of contract registered by schainHash.

getContractRegisteredRange getContractRegisteredRange(bytes32 schainHash, uint256 from, uint256 to) → address[] contractsInRange external

Should return a range of contracts registered by schainHash.

Requirements: range should be less or equal 10 contracts

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.

initializeMessageProxy initializeMessageProxy(uint256 newGasLimit) public

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.

removeConnectedChain removeConnectedChain(string schainName) public

Allows CHAIN_CONNECTOR_ROLE to remove connected chain from this contract.

Requirements:

  • msg.sender must be granted CHAIN_CONNECTOR_ROLE.

  • schainName must be initialized.

isConnectedChain isConnectedChain(string schainName) → bool public

Checks whether chain is currently connected.

isContractRegistered isContractRegistered(bytes32 schainHash, address contractAddress) → bool public

Checks whether contract is currently registered as extra contract.

_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.

_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 IMessageProxy.Message message, uint256 counter) internal

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

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

Returns receiver of message.

_authorizeOutgoingMessageSender _authorizeOutgoingMessageSender(bytes32 targetChainHash) internal

Checks whether msg.sender is registered as custom extra contract.

_getRegistryContracts _getRegistryContracts() → mapping(bytes32 => struct EnumerableSetUpgradeable.AddressSet) internal

Returns list of registered custom extra contracts.

_hashedArray _hashedArray(struct IMessageProxy.Message[] messages, uint256 startingCounter, string fromChainName) → 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.

VersionUpdated VersionUpdated(string oldVersion, string newVersion) event

Emitted when the version was updated

ExtraContractRegistered ExtraContractRegistered(bytes32 chainHash, address contractAddress) event

Emitted when extra contract was added.

ExtraContractRemoved ExtraContractRemoved(bytes32 chainHash, address contractAddress) event

Emitted when extra contract was removed.