diff --git a/contracts/IMessageListener.sol b/contracts/IMessageListener.sol new file mode 100644 index 0000000..d065619 --- /dev/null +++ b/contracts/IMessageListener.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +/** + * IMessageListener.sol - SKALE Interchain Messaging Agent + * Copyright (C) 2021-Present SKALE Labs + * @author Dmytro Stebaiev + * + * SKALE IMA is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * SKALE IMA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with SKALE IMA. If not, see . + */ + +pragma solidity >=0.6.10 <0.9.0; + + +interface IMessageListener { + /** + * @dev Structure that describes message. Should contain sender of message, + * destination contract on schain that will receiver message, + * data that contains all needed info about token or ETH. + */ + struct Message { + address sender; + address destinationContract; + bytes data; + } + + /** + * @dev Structure that contains fields for bls signature. + */ + struct Signature { + uint256[2] blsSignature; + uint256 hashA; + uint256 hashB; + uint256 counter; + } + + function postIncomingMessages( + string calldata fromSchainName, + uint256 startingCounter, + Message[] calldata messages, + Signature calldata sign + ) external; + + function postOutgoingMessage( + bytes32 targetChainHash, + address targetContract, + bytes memory data + ) external; +} diff --git a/contracts/IMessageProxy.sol b/contracts/IMessageProxy.sol index 03c0109..44bc6e3 100644 --- a/contracts/IMessageProxy.sol +++ b/contracts/IMessageProxy.sol @@ -21,46 +21,15 @@ pragma solidity >=0.6.10 <0.9.0; +import { IMessageListener } from "./IMessageListener.sol"; -interface IMessageProxy { - - /** - * @dev Structure that describes message. Should contain sender of message, - * destination contract on schain that will receiver message, - * data that contains all needed info about token or ETH. - */ - struct Message { - address sender; - address destinationContract; - bytes data; - } - - /** - * @dev Structure that contains fields for bls signature. - */ - struct Signature { - uint256[2] blsSignature; - uint256 hashA; - uint256 hashB; - uint256 counter; - } +interface IMessageProxy is IMessageListener { function addConnectedChain(string calldata schainName) external; - function postIncomingMessages( - string calldata fromSchainName, - uint256 startingCounter, - Message[] calldata messages, - Signature calldata sign - ) external; function setNewGasLimit(uint256 newGasLimit) external; function registerExtraContractForAll(address extraContract) external; - function removeExtraContractForAll(address extraContract) external; + function removeExtraContractForAll(address extraContract) external; function removeConnectedChain(string memory schainName) external; - function postOutgoingMessage( - bytes32 targetChainHash, - address targetContract, - bytes memory data - ) external; function registerExtraContract(string memory chainName, address extraContract) external; function removeExtraContract(string memory schainName, address extraContract) external; function setVersion(string calldata newVersion) external; @@ -81,4 +50,4 @@ interface IMessageProxy { function getIncomingMessagesCounter(string calldata fromSchainName) external view returns (uint256); function isConnectedChain(string memory schainName) external view returns (bool); function getLastOutgoingMessageBlockId(string memory targetSchainName) external view returns (uint); -} \ No newline at end of file +} diff --git a/package.json b/package.json index b8dacd3..4438e36 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "fullCheck": "yarn lint && yarn cspell && yarn slither" }, "dependencies": { - "@skalenetwork/skale-manager-interfaces": "^3.1.0" + "@skalenetwork/skale-manager-interfaces": "^3.2.0-develop.0" }, "devDependencies": { "@types/node": "^20.4.5", diff --git a/yarn.lock b/yarn.lock index 1a5aa60..c129a60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -893,10 +893,10 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.6.0.tgz#41dd6093d34652cddb5d5bdeee04eafc33826668" integrity sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g== -"@skalenetwork/skale-manager-interfaces@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.1.0.tgz#e97750462b1dafa9eee1c347802d5405afc9474f" - integrity sha512-lVJM6nRfIrlwRy7N009jGCZa5nDJo2/QMrKN0A2nRz/sqT8wWlOQUeDKrJ1mC5Esdbzhya6T6hTiZbN2yNwcRg== +"@skalenetwork/skale-manager-interfaces@^3.2.0-develop.0": + version "3.2.0-paymaster.2" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.2.0-paymaster.2.tgz#6b114041b623a030331e0a7853a2eab136fc2daf" + integrity sha512-tmqWNkafjJxIZNVp2EmysvXor5F4G+f5A4qTMWqCZ7yMrCAvGzTETpMiHGjJJCUwSIaaqd62DjDjQi69r+BUkg== "@solidity-parser/parser@^0.18.0": version "0.18.0"