From 3aed53a2973bf348ff367645c399905bbf448a7e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 4 Oct 2024 18:07:53 +0300 Subject: [PATCH 01/17] Add ExecutionManager --- .solhint.json | 4 ++- contracts/DomainTypes.sol | 24 ++++++++++++++ contracts/IGasReimbursable.sol | 4 +-- contracts/IMessageListener.sol | 2 +- contracts/IMessageProxy.sol | 2 +- contracts/IMessageReceiver.sol | 4 +-- ...IERC721ReferenceMintAndMetadataMainnet.sol | 4 +-- .../IERC721ReferenceMintAndMetadataSchain.sol | 4 +-- .../DepositBoxes/IDepositBoxERC1155.sol | 4 +-- .../mainnet/DepositBoxes/IDepositBoxERC20.sol | 4 +-- .../DepositBoxes/IDepositBoxERC721.sol | 4 +-- .../mainnet/DepositBoxes/IDepositBoxEth.sol | 4 +-- contracts/mainnet/ICommunityPool.sol | 21 +++++++----- contracts/mainnet/IDepositBox.sol | 4 +-- contracts/mainnet/ILinker.sol | 4 +-- contracts/mainnet/IMessageProxyForMainnet.sol | 4 +-- contracts/mainnet/ISkaleManagerClient.sol | 4 +-- contracts/mainnet/ITwin.sol | 4 +-- contracts/schain/ICommunityLocker.sol | 12 ++++--- contracts/schain/IExecutionManager.sol | 32 +++++++++++++++++++ contracts/schain/IKeyStorage.sol | 4 +-- contracts/schain/IMessageProxyForSchain.sol | 2 +- contracts/schain/ITokenManager.sol | 4 +-- contracts/schain/ITokenManagerLinker.sol | 4 +-- .../TokenManagers/ITokenContractManager.sol | 4 +-- .../TokenManagers/ITokenManagerERC1155.sol | 4 +-- .../TokenManagers/ITokenManagerERC20.sol | 4 +-- .../TokenManagers/ITokenManagerERC721.sol | 4 +-- .../schain/TokenManagers/ITokenManagerEth.sol | 4 +-- contracts/schain/bls/IFieldOperations.sol | 4 +-- contracts/schain/tokens/IERC1155OnChain.sol | 4 +-- contracts/schain/tokens/IERC20OnChain.sol | 4 +-- contracts/schain/tokens/IERC721OnChain.sol | 4 +-- contracts/schain/tokens/IEthErc20.sol | 4 +-- cspell.json | 1 + package.json | 2 +- yarn.lock | 8 ++--- 37 files changed, 141 insertions(+), 73 deletions(-) create mode 100644 contracts/DomainTypes.sol create mode 100644 contracts/schain/IExecutionManager.sol diff --git a/.solhint.json b/.solhint.json index 50a2b89..a92abb0 100644 --- a/.solhint.json +++ b/.solhint.json @@ -1,7 +1,9 @@ { "extends": "solhint:all", "rules": { - "compiler-version": ["error","^0.6.10"], + "foundry-test-functions": "off", + + "compiler-version": ["error","^0.8.8"], "state-visibility": "error", "no-empty-blocks": "error", "check-send-result": "error", diff --git a/contracts/DomainTypes.sol b/contracts/DomainTypes.sol new file mode 100644 index 0000000..056330a --- /dev/null +++ b/contracts/DomainTypes.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +/** + * DomainTypes.sol - SKALE Interchain Messaging Agent + * Copyright (C) 2024-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.8.8 <0.9.0; + + +type SchainHash is bytes32; diff --git a/contracts/IGasReimbursable.sol b/contracts/IGasReimbursable.sol index e6c8f19..e5413cc 100644 --- a/contracts/IGasReimbursable.sol +++ b/contracts/IGasReimbursable.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./IMessageReceiver.sol"; @@ -32,4 +32,4 @@ interface IGasReimbursable is IMessageReceiver { ) external returns (address); -} \ No newline at end of file +} diff --git a/contracts/IMessageListener.sol b/contracts/IMessageListener.sol index d065619..14fc900 100644 --- a/contracts/IMessageListener.sol +++ b/contracts/IMessageListener.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IMessageListener { diff --git a/contracts/IMessageProxy.sol b/contracts/IMessageProxy.sol index 44bc6e3..943d37d 100644 --- a/contracts/IMessageProxy.sol +++ b/contracts/IMessageProxy.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import { IMessageListener } from "./IMessageListener.sol"; diff --git a/contracts/IMessageReceiver.sol b/contracts/IMessageReceiver.sol index ee9ed4f..0f84e59 100644 --- a/contracts/IMessageReceiver.sol +++ b/contracts/IMessageReceiver.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IMessageReceiver { @@ -29,4 +29,4 @@ interface IMessageReceiver { bytes calldata data ) external; -} \ No newline at end of file +} diff --git a/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol b/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol index 295d7da..9cdacb9 100644 --- a/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol +++ b/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol @@ -19,9 +19,9 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IERC721ReferenceMintAndMetadataMainnet { function setSenderContractOnSchain(address newSenderContractOnSchain) external; -} \ No newline at end of file +} diff --git a/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol b/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol index 2a17413..88ce779 100644 --- a/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol +++ b/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IERC721ReferenceMintAndMetadataSchain { @@ -32,4 +32,4 @@ interface IERC721ReferenceMintAndMetadataSchain { external pure returns (bytes memory data); -} \ No newline at end of file +} diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol index 866f3cc..43c7eea 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IDepositBox.sol"; @@ -64,4 +64,4 @@ interface IDepositBoxERC1155 is IDepositBox { external view returns (address[] memory); -} \ No newline at end of file +} diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol index c26eee0..852451e 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IDepositBox.sol"; @@ -63,4 +63,4 @@ interface IDepositBoxERC20 is IDepositBox { function getTimeDelay(bytes32 schainHash) external view returns (uint256); function getTrustedReceiver(string calldata schainName, uint256 index) external view returns (address); function getTrustedReceiversAmount(bytes32 schainHash) external view returns (uint256); -} \ No newline at end of file +} diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol index 8fb7386..385e24c 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IDepositBox.sol"; @@ -44,4 +44,4 @@ interface IDepositBoxERC721 is IDepositBox { external view returns (address[] memory); -} \ No newline at end of file +} diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol b/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol index 28bda7f..3fa0871 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IDepositBox.sol"; @@ -32,4 +32,4 @@ interface IDepositBoxEth is IDepositBox { function getFunds(string calldata schainName, address payable receiver, uint amount) external; function enableActiveEthTransfers(string calldata schainName) external; function disableActiveEthTransfers(string calldata schainName) external; -} \ No newline at end of file +} diff --git a/contracts/mainnet/ICommunityPool.sol b/contracts/mainnet/ICommunityPool.sol index 118a7b8..a6b68c3 100644 --- a/contracts/mainnet/ICommunityPool.sol +++ b/contracts/mainnet/ICommunityPool.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; @@ -35,17 +35,22 @@ interface ICommunityPool is ITwin { ILinker linker, IMessageProxyForMainnet messageProxyValue ) external; - function refundGasByUser(bytes32 schainHash, address payable node, address user, uint gas) external returns (uint); + function refundGasByUser( + bytes32 schainHash, + address payable node, + address user, + uint256 gas + ) external returns (uint256); function rechargeUserWallet(string calldata schainName, address user) external payable; - function withdrawFunds(string calldata schainName, uint amount) external; - function setMinTransactionGas(uint newMinTransactionGas) external; - function setMultiplier(uint newMultiplierNumerator, uint newMultiplierDivider) external; + function withdrawFunds(string calldata schainName, uint256 amount) external; + function setMinTransactionGas(uint256 newMinTransactionGas) external; + function setMultiplier(uint256 newMultiplierNumerator, uint256 newMultiplierDivider) external; function refundGasBySchainWallet( bytes32 schainHash, address payable node, - uint gas + uint256 gas ) external returns (bool); - function getBalance(address user, string calldata schainName) external view returns (uint); + function getBalance(address user, string calldata schainName) external view returns (uint256); function checkUserBalance(bytes32 schainHash, address receiver) external view returns (bool); function getRecommendedRechargeAmount(bytes32 schainHash, address receiver) external view returns (uint256); -} \ No newline at end of file +} diff --git a/contracts/mainnet/IDepositBox.sol b/contracts/mainnet/IDepositBox.sol index dafcbd0..24eedeb 100644 --- a/contracts/mainnet/IDepositBox.sol +++ b/contracts/mainnet/IDepositBox.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; @@ -39,4 +39,4 @@ interface IDepositBox is ITwin, IMessageReceiver, IGasReimbursable { function enableWhitelist(string memory schainName) external; function disableWhitelist(string memory schainName) external; function isWhitelisted(string memory schainName) external view returns (bool); -} \ No newline at end of file +} diff --git a/contracts/mainnet/ILinker.sol b/contracts/mainnet/ILinker.sol index 8215b77..506353f 100644 --- a/contracts/mainnet/ILinker.sol +++ b/contracts/mainnet/ILinker.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./ITwin.sol"; @@ -33,4 +33,4 @@ interface ILinker is ITwin { function isNotKilled(bytes32 schainHash) external view returns (bool); function hasMainnetContract(address mainnetContract) external view returns (bool); function hasSchain(string calldata schainName) external view returns (bool connected); -} \ No newline at end of file +} diff --git a/contracts/mainnet/IMessageProxyForMainnet.sol b/contracts/mainnet/IMessageProxyForMainnet.sol index d90bdf6..624be7a 100644 --- a/contracts/mainnet/IMessageProxyForMainnet.sol +++ b/contracts/mainnet/IMessageProxyForMainnet.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IMessageProxy.sol"; import "./ICommunityPool.sol"; @@ -44,4 +44,4 @@ interface IMessageProxyForMainnet is IMessageProxy { external view returns (address[] memory contractsInRange); -} \ No newline at end of file +} diff --git a/contracts/mainnet/ISkaleManagerClient.sol b/contracts/mainnet/ISkaleManagerClient.sol index fc0d05d..da134fd 100644 --- a/contracts/mainnet/ISkaleManagerClient.sol +++ b/contracts/mainnet/ISkaleManagerClient.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; @@ -28,4 +28,4 @@ interface ISkaleManagerClient { function initialize(IContractManager newContractManagerOfSkaleManager) external; function isSchainOwner(address sender, bytes32 schainHash) external view returns (bool); function isAgentAuthorized(bytes32 schainHash, address sender) external view returns (bool); -} \ No newline at end of file +} diff --git a/contracts/mainnet/ITwin.sol b/contracts/mainnet/ITwin.sol index 28b3802..2602916 100644 --- a/contracts/mainnet/ITwin.sol +++ b/contracts/mainnet/ITwin.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./ISkaleManagerClient.sol"; @@ -28,4 +28,4 @@ interface ITwin is ISkaleManagerClient { function removeSchainContract(string calldata schainName) external; function hasSchainContract(string calldata schainName) external view returns (bool); function getSchainContract(bytes32 schainHash) external view returns (address); -} \ No newline at end of file +} diff --git a/contracts/schain/ICommunityLocker.sol b/contracts/schain/ICommunityLocker.sol index 5fc14af..7197bdf 100644 --- a/contracts/schain/ICommunityLocker.sol +++ b/contracts/schain/ICommunityLocker.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IMessageReceiver.sol"; @@ -35,6 +35,10 @@ interface ICommunityLocker is IMessageReceiver { address newCommunityPool ) external; function checkAllowedToSendMessage(bytes32 chainHash, address receiver) external; - function setTimeLimitPerMessage(string memory chainName, uint newTimeLimitPerMessage) external; - function setGasPrice(uint gasPrice, uint timestamp, IMessageProxyForSchain.Signature memory signature) external; -} \ No newline at end of file + function setTimeLimitPerMessage(string memory chainName, uint256 newTimeLimitPerMessage) external; + function setGasPrice( + uint256 gasPrice, + uint256 timestamp, + IMessageProxyForSchain.Signature memory signature + ) external; +} diff --git a/contracts/schain/IExecutionManager.sol b/contracts/schain/IExecutionManager.sol new file mode 100644 index 0000000..d535fb4 --- /dev/null +++ b/contracts/schain/IExecutionManager.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +/** + * IExecutionManager - SKALE Interchain Messaging Agent + * Copyright (C) 2024-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.8.8 <0.9.0; + +import {IMessageReceiver} from "../IMessageReceiver.sol"; +import {IMessageProxyForSchain} from "./IMessageProxyForSchain.sol"; +import {SchainHash} from "../DomainTypes.sol"; + + +interface IExecutionManager is IMessageReceiver { + function initialize(IMessageProxyForSchain messageProxyAddress) external; + function testSend(SchainHash targetChainHash, string calldata message) external; +} diff --git a/contracts/schain/IKeyStorage.sol b/contracts/schain/IKeyStorage.sol index ac5d310..25b6733 100644 --- a/contracts/schain/IKeyStorage.sol +++ b/contracts/schain/IKeyStorage.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./bls/IFieldOperations.sol"; @@ -27,4 +27,4 @@ import "./bls/IFieldOperations.sol"; interface IKeyStorage { function initialize() external; function getBlsCommonPublicKey() external view returns (IFieldOperations.G2Point memory); -} \ No newline at end of file +} diff --git a/contracts/schain/IMessageProxyForSchain.sol b/contracts/schain/IMessageProxyForSchain.sol index 6ad8298..5709917 100644 --- a/contracts/schain/IMessageProxyForSchain.sol +++ b/contracts/schain/IMessageProxyForSchain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IMessageProxy.sol"; import "./IKeyStorage.sol"; diff --git a/contracts/schain/ITokenManager.sol b/contracts/schain/ITokenManager.sol index b0ee59b..930ac49 100644 --- a/contracts/schain/ITokenManager.sol +++ b/contracts/schain/ITokenManager.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../IMessageReceiver.sol"; @@ -29,4 +29,4 @@ interface ITokenManager is IMessageReceiver { function addTokenManager(string calldata schainName, address newTokenManager) external; function removeTokenManager(string calldata schainName) external; function hasTokenManager(string calldata schainName) external view returns (bool); -} \ No newline at end of file +} diff --git a/contracts/schain/ITokenManagerLinker.sol b/contracts/schain/ITokenManagerLinker.sol index 1610b31..a4bf54c 100644 --- a/contracts/schain/ITokenManagerLinker.sol +++ b/contracts/schain/ITokenManagerLinker.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./IMessageProxyForSchain.sol"; import "./ITokenManager.sol"; @@ -33,4 +33,4 @@ interface ITokenManagerLinker { function removeTokenManager(ITokenManager tokenManagerAddress) external; function hasSchain(string calldata schainName) external view returns (bool connected); function hasTokenManager(address tokenManager) external view returns (bool); -} \ No newline at end of file +} diff --git a/contracts/schain/TokenManagers/ITokenContractManager.sol b/contracts/schain/TokenManagers/ITokenContractManager.sol index 1b7a159..1dbfd6c 100644 --- a/contracts/schain/TokenManagers/ITokenContractManager.sol +++ b/contracts/schain/TokenManagers/ITokenContractManager.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../ICommunityLocker.sol"; import "../IMessageProxyForSchain.sol"; @@ -34,4 +34,4 @@ interface ITokenContractManager is ITokenManager { ICommunityLocker newCommunityLocker, address newDepositBox ) external; -} \ No newline at end of file +} diff --git a/contracts/schain/TokenManagers/ITokenManagerERC1155.sol b/contracts/schain/TokenManagers/ITokenManagerERC1155.sol index 7fc1226..1a5ed55 100644 --- a/contracts/schain/TokenManagers/ITokenManagerERC1155.sol +++ b/contracts/schain/TokenManagers/ITokenManagerERC1155.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./ITokenContractManager.sol"; @@ -52,4 +52,4 @@ interface ITokenManagerERC1155 is ITokenContractManager { address erc1155OnMainnet, address erc1155OnSchain ) external; -} \ No newline at end of file +} diff --git a/contracts/schain/TokenManagers/ITokenManagerERC20.sol b/contracts/schain/TokenManagers/ITokenManagerERC20.sol index 945e134..00f018f 100644 --- a/contracts/schain/TokenManagers/ITokenManagerERC20.sol +++ b/contracts/schain/TokenManagers/ITokenManagerERC20.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./ITokenContractManager.sol"; @@ -38,4 +38,4 @@ interface ITokenManagerERC20 is ITokenContractManager { address erc20OnMainnet, address erc20OnSchain ) external; -} \ No newline at end of file +} diff --git a/contracts/schain/TokenManagers/ITokenManagerERC721.sol b/contracts/schain/TokenManagers/ITokenManagerERC721.sol index ba52996..19f3a56 100644 --- a/contracts/schain/TokenManagers/ITokenManagerERC721.sol +++ b/contracts/schain/TokenManagers/ITokenManagerERC721.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "./ITokenContractManager.sol"; @@ -35,4 +35,4 @@ interface ITokenManagerERC721 is ITokenContractManager { address erc721OnMainnet, address erc721OnSchain ) external; -} \ No newline at end of file +} diff --git a/contracts/schain/TokenManagers/ITokenManagerEth.sol b/contracts/schain/TokenManagers/ITokenManagerEth.sol index dce9c63..f9ce7a0 100644 --- a/contracts/schain/TokenManagers/ITokenManagerEth.sol +++ b/contracts/schain/TokenManagers/ITokenManagerEth.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; import "../tokens/IEthErc20.sol"; import "../ICommunityLocker.sol"; @@ -39,4 +39,4 @@ interface ITokenManagerEth is ITokenManager { ) external; function setEthErc20Address(IEthErc20 newEthErc20Address) external; function exitToMain(uint256 amount) external; -} \ No newline at end of file +} diff --git a/contracts/schain/bls/IFieldOperations.sol b/contracts/schain/bls/IFieldOperations.sol index 7c1dca3..f126b96 100644 --- a/contracts/schain/bls/IFieldOperations.sol +++ b/contracts/schain/bls/IFieldOperations.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IFieldOperations { @@ -39,4 +39,4 @@ interface IFieldOperations { Fp2Point x; Fp2Point y; } -} \ No newline at end of file +} diff --git a/contracts/schain/tokens/IERC1155OnChain.sol b/contracts/schain/tokens/IERC1155OnChain.sol index 2927793..a9d71bc 100644 --- a/contracts/schain/tokens/IERC1155OnChain.sol +++ b/contracts/schain/tokens/IERC1155OnChain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IERC1155OnChain { @@ -35,4 +35,4 @@ interface IERC1155OnChain { uint256[] memory amounts, bytes memory data ) external; -} \ No newline at end of file +} diff --git a/contracts/schain/tokens/IERC20OnChain.sol b/contracts/schain/tokens/IERC20OnChain.sol index 3b7e991..d7f2495 100644 --- a/contracts/schain/tokens/IERC20OnChain.sol +++ b/contracts/schain/tokens/IERC20OnChain.sol @@ -19,9 +19,9 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IERC20OnChain { function mint(address account, uint256 value) external; -} \ No newline at end of file +} diff --git a/contracts/schain/tokens/IERC721OnChain.sol b/contracts/schain/tokens/IERC721OnChain.sol index d2a7e5a..7b3174c 100644 --- a/contracts/schain/tokens/IERC721OnChain.sol +++ b/contracts/schain/tokens/IERC721OnChain.sol @@ -19,10 +19,10 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IERC721OnChain { function setTokenURI(uint256 tokenId, string calldata tokenUri) external returns (bool); function mint(address account, uint256 tokenId) external; -} \ No newline at end of file +} diff --git a/contracts/schain/tokens/IEthErc20.sol b/contracts/schain/tokens/IEthErc20.sol index aeb8236..3c4506b 100644 --- a/contracts/schain/tokens/IEthErc20.sol +++ b/contracts/schain/tokens/IEthErc20.sol @@ -19,11 +19,11 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.8 <0.9.0; interface IEthErc20 { function mint(address account, uint256 amount) external; function forceBurn(address account, uint256 amount) external; function initialize(address tokenManagerEthAddress) external; -} \ No newline at end of file +} diff --git a/cspell.json b/cspell.json index 67238e1..9a10dc8 100644 --- a/cspell.json +++ b/cspell.json @@ -4,6 +4,7 @@ "ignorePaths": [ "yarn-error.log", ".gitignore", + ".solhint.json", "cspell.json", "dictionaries/**/*", "cache/**/*", diff --git a/package.json b/package.json index d6e0d5b..a42b231 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "fullCheck": "yarn lint && yarn cspell && yarn slither" }, "dependencies": { - "@skalenetwork/skale-manager-interfaces": "^3.2.0-develop.0" + "@skalenetwork/skale-manager-interfaces": "^3.2.0-execution-layer.0" }, "devDependencies": { "@types/node": "^22.5.0", diff --git a/yarn.lock b/yarn.lock index d7be74d..758e488 100644 --- a/yarn.lock +++ b/yarn.lock @@ -909,10 +909,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.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== +"@skalenetwork/skale-manager-interfaces@^3.2.0-execution-layer.0": + version "3.2.0-execution-layer.0" + resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.2.0-execution-layer.0.tgz#4e189a23a6b3128b804317e6a86f17655be0bb3c" + integrity sha512-QV/3/QFQEsTMFXZaJzNRXfHtHznf9jq4hsLGUJwTmYPEF6O0WVhDiwfUgwMAah2hgpxxJcdLnWyh3YOA5Kf1Tw== "@solidity-parser/parser@^0.18.0": version "0.18.0" From 0f9c780a3e6daeaff01d787c2854e4c7fc110e18 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 4 Oct 2024 18:34:00 +0300 Subject: [PATCH 02/17] Update message listener --- contracts/IMessageListener.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/IMessageListener.sol b/contracts/IMessageListener.sol index 14fc900..91c7c98 100644 --- a/contracts/IMessageListener.sol +++ b/contracts/IMessageListener.sol @@ -21,6 +21,8 @@ pragma solidity >=0.8.8 <0.9.0; +import {SchainHash} from "./DomainTypes.sol"; + interface IMessageListener { /** @@ -52,7 +54,7 @@ interface IMessageListener { ) external; function postOutgoingMessage( - bytes32 targetChainHash, + SchainHash targetChainHash, address targetContract, bytes memory data ) external; From 37715a914846d76a4d30acfb51c5c3b7e7ce17f9 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 7 Oct 2024 17:54:43 +0300 Subject: [PATCH 03/17] Add == operator --- contracts/DomainTypes.sol | 15 ++++++++++++++- contracts/IGasReimbursable.sol | 2 +- contracts/IMessageListener.sol | 2 +- contracts/IMessageProxy.sol | 2 +- contracts/IMessageReceiver.sol | 2 +- .../IERC721ReferenceMintAndMetadataMainnet.sol | 2 +- .../IERC721ReferenceMintAndMetadataSchain.sol | 2 +- .../mainnet/DepositBoxes/IDepositBoxERC1155.sol | 2 +- .../mainnet/DepositBoxes/IDepositBoxERC20.sol | 2 +- .../mainnet/DepositBoxes/IDepositBoxERC721.sol | 2 +- contracts/mainnet/DepositBoxes/IDepositBoxEth.sol | 2 +- contracts/mainnet/ICommunityPool.sol | 2 +- contracts/mainnet/IDepositBox.sol | 2 +- contracts/mainnet/ILinker.sol | 2 +- contracts/mainnet/IMessageProxyForMainnet.sol | 2 +- contracts/mainnet/ISkaleManagerClient.sol | 2 +- contracts/mainnet/ITwin.sol | 2 +- contracts/schain/ICommunityLocker.sol | 2 +- contracts/schain/IExecutionManager.sol | 2 +- contracts/schain/IKeyStorage.sol | 2 +- contracts/schain/IMessageProxyForSchain.sol | 2 +- contracts/schain/ITokenManager.sol | 2 +- contracts/schain/ITokenManagerLinker.sol | 2 +- .../TokenManagers/ITokenContractManager.sol | 2 +- .../schain/TokenManagers/ITokenManagerERC1155.sol | 2 +- .../schain/TokenManagers/ITokenManagerERC20.sol | 2 +- .../schain/TokenManagers/ITokenManagerERC721.sol | 2 +- .../schain/TokenManagers/ITokenManagerEth.sol | 2 +- contracts/schain/bls/IFieldOperations.sol | 2 +- contracts/schain/tokens/IERC1155OnChain.sol | 2 +- contracts/schain/tokens/IERC20OnChain.sol | 2 +- contracts/schain/tokens/IERC721OnChain.sol | 2 +- contracts/schain/tokens/IEthErc20.sol | 2 +- hardhat.config.ts | 2 +- slither.config.json | 4 ++-- 35 files changed, 49 insertions(+), 36 deletions(-) diff --git a/contracts/DomainTypes.sol b/contracts/DomainTypes.sol index 056330a..0629f3e 100644 --- a/contracts/DomainTypes.sol +++ b/contracts/DomainTypes.sol @@ -18,7 +18,20 @@ * You should have received a copy of the GNU Affero General Public License * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; type SchainHash is bytes32; + +using { + _schainHashEquals as == +} for SchainHash global; + +// Operators are used by the library users +// slither-disable-start dead-code + +function _schainHashEquals(SchainHash left, SchainHash right) pure returns (bool result) { + return SchainHash.unwrap(left) == SchainHash.unwrap(right); +} + +// slither-disable-end dead-code diff --git a/contracts/IGasReimbursable.sol b/contracts/IGasReimbursable.sol index e5413cc..6d45f9b 100644 --- a/contracts/IGasReimbursable.sol +++ b/contracts/IGasReimbursable.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./IMessageReceiver.sol"; diff --git a/contracts/IMessageListener.sol b/contracts/IMessageListener.sol index 91c7c98..00f310d 100644 --- a/contracts/IMessageListener.sol +++ b/contracts/IMessageListener.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import {SchainHash} from "./DomainTypes.sol"; diff --git a/contracts/IMessageProxy.sol b/contracts/IMessageProxy.sol index 943d37d..10db969 100644 --- a/contracts/IMessageProxy.sol +++ b/contracts/IMessageProxy.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import { IMessageListener } from "./IMessageListener.sol"; diff --git a/contracts/IMessageReceiver.sol b/contracts/IMessageReceiver.sol index 0f84e59..2da4c9f 100644 --- a/contracts/IMessageReceiver.sol +++ b/contracts/IMessageReceiver.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IMessageReceiver { diff --git a/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol b/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol index 9cdacb9..112fc8a 100644 --- a/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol +++ b/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IERC721ReferenceMintAndMetadataMainnet { diff --git a/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol b/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol index 88ce779..04c3c2d 100644 --- a/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol +++ b/contracts/extensions/IERC721ReferenceMintAndMetadataSchain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IERC721ReferenceMintAndMetadataSchain { diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol index 43c7eea..a62a34b 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IDepositBox.sol"; diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol index 852451e..bb54561 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IDepositBox.sol"; diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol index 385e24c..b8ff38d 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IDepositBox.sol"; diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol b/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol index 3fa0871..068a394 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxEth.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IDepositBox.sol"; diff --git a/contracts/mainnet/ICommunityPool.sol b/contracts/mainnet/ICommunityPool.sol index a6b68c3..077a29e 100644 --- a/contracts/mainnet/ICommunityPool.sol +++ b/contracts/mainnet/ICommunityPool.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; diff --git a/contracts/mainnet/IDepositBox.sol b/contracts/mainnet/IDepositBox.sol index 24eedeb..c7318bd 100644 --- a/contracts/mainnet/IDepositBox.sol +++ b/contracts/mainnet/IDepositBox.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; diff --git a/contracts/mainnet/ILinker.sol b/contracts/mainnet/ILinker.sol index 506353f..f1b3316 100644 --- a/contracts/mainnet/ILinker.sol +++ b/contracts/mainnet/ILinker.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./ITwin.sol"; diff --git a/contracts/mainnet/IMessageProxyForMainnet.sol b/contracts/mainnet/IMessageProxyForMainnet.sol index 624be7a..4531342 100644 --- a/contracts/mainnet/IMessageProxyForMainnet.sol +++ b/contracts/mainnet/IMessageProxyForMainnet.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IMessageProxy.sol"; import "./ICommunityPool.sol"; diff --git a/contracts/mainnet/ISkaleManagerClient.sol b/contracts/mainnet/ISkaleManagerClient.sol index da134fd..2e5b6dc 100644 --- a/contracts/mainnet/ISkaleManagerClient.sol +++ b/contracts/mainnet/ISkaleManagerClient.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; diff --git a/contracts/mainnet/ITwin.sol b/contracts/mainnet/ITwin.sol index 2602916..eaa2a41 100644 --- a/contracts/mainnet/ITwin.sol +++ b/contracts/mainnet/ITwin.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./ISkaleManagerClient.sol"; diff --git a/contracts/schain/ICommunityLocker.sol b/contracts/schain/ICommunityLocker.sol index 7197bdf..593d6ca 100644 --- a/contracts/schain/ICommunityLocker.sol +++ b/contracts/schain/ICommunityLocker.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IMessageReceiver.sol"; diff --git a/contracts/schain/IExecutionManager.sol b/contracts/schain/IExecutionManager.sol index d535fb4..5b24fd1 100644 --- a/contracts/schain/IExecutionManager.sol +++ b/contracts/schain/IExecutionManager.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import {IMessageReceiver} from "../IMessageReceiver.sol"; import {IMessageProxyForSchain} from "./IMessageProxyForSchain.sol"; diff --git a/contracts/schain/IKeyStorage.sol b/contracts/schain/IKeyStorage.sol index 25b6733..c591843 100644 --- a/contracts/schain/IKeyStorage.sol +++ b/contracts/schain/IKeyStorage.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./bls/IFieldOperations.sol"; diff --git a/contracts/schain/IMessageProxyForSchain.sol b/contracts/schain/IMessageProxyForSchain.sol index 5709917..465d6a7 100644 --- a/contracts/schain/IMessageProxyForSchain.sol +++ b/contracts/schain/IMessageProxyForSchain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IMessageProxy.sol"; import "./IKeyStorage.sol"; diff --git a/contracts/schain/ITokenManager.sol b/contracts/schain/ITokenManager.sol index 930ac49..d378388 100644 --- a/contracts/schain/ITokenManager.sol +++ b/contracts/schain/ITokenManager.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IMessageReceiver.sol"; diff --git a/contracts/schain/ITokenManagerLinker.sol b/contracts/schain/ITokenManagerLinker.sol index a4bf54c..6323210 100644 --- a/contracts/schain/ITokenManagerLinker.sol +++ b/contracts/schain/ITokenManagerLinker.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./IMessageProxyForSchain.sol"; import "./ITokenManager.sol"; diff --git a/contracts/schain/TokenManagers/ITokenContractManager.sol b/contracts/schain/TokenManagers/ITokenContractManager.sol index 1dbfd6c..67594cb 100644 --- a/contracts/schain/TokenManagers/ITokenContractManager.sol +++ b/contracts/schain/TokenManagers/ITokenContractManager.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../ICommunityLocker.sol"; import "../IMessageProxyForSchain.sol"; diff --git a/contracts/schain/TokenManagers/ITokenManagerERC1155.sol b/contracts/schain/TokenManagers/ITokenManagerERC1155.sol index 1a5ed55..b0c37fc 100644 --- a/contracts/schain/TokenManagers/ITokenManagerERC1155.sol +++ b/contracts/schain/TokenManagers/ITokenManagerERC1155.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./ITokenContractManager.sol"; diff --git a/contracts/schain/TokenManagers/ITokenManagerERC20.sol b/contracts/schain/TokenManagers/ITokenManagerERC20.sol index 00f018f..fcbb1f2 100644 --- a/contracts/schain/TokenManagers/ITokenManagerERC20.sol +++ b/contracts/schain/TokenManagers/ITokenManagerERC20.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./ITokenContractManager.sol"; diff --git a/contracts/schain/TokenManagers/ITokenManagerERC721.sol b/contracts/schain/TokenManagers/ITokenManagerERC721.sol index 19f3a56..a63dc13 100644 --- a/contracts/schain/TokenManagers/ITokenManagerERC721.sol +++ b/contracts/schain/TokenManagers/ITokenManagerERC721.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./ITokenContractManager.sol"; diff --git a/contracts/schain/TokenManagers/ITokenManagerEth.sol b/contracts/schain/TokenManagers/ITokenManagerEth.sol index f9ce7a0..b02ea6d 100644 --- a/contracts/schain/TokenManagers/ITokenManagerEth.sol +++ b/contracts/schain/TokenManagers/ITokenManagerEth.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../tokens/IEthErc20.sol"; import "../ICommunityLocker.sol"; diff --git a/contracts/schain/bls/IFieldOperations.sol b/contracts/schain/bls/IFieldOperations.sol index f126b96..42b2d2c 100644 --- a/contracts/schain/bls/IFieldOperations.sol +++ b/contracts/schain/bls/IFieldOperations.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IFieldOperations { diff --git a/contracts/schain/tokens/IERC1155OnChain.sol b/contracts/schain/tokens/IERC1155OnChain.sol index a9d71bc..d3be284 100644 --- a/contracts/schain/tokens/IERC1155OnChain.sol +++ b/contracts/schain/tokens/IERC1155OnChain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IERC1155OnChain { diff --git a/contracts/schain/tokens/IERC20OnChain.sol b/contracts/schain/tokens/IERC20OnChain.sol index d7f2495..6412bbe 100644 --- a/contracts/schain/tokens/IERC20OnChain.sol +++ b/contracts/schain/tokens/IERC20OnChain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IERC20OnChain { diff --git a/contracts/schain/tokens/IERC721OnChain.sol b/contracts/schain/tokens/IERC721OnChain.sol index 7b3174c..7b8f29c 100644 --- a/contracts/schain/tokens/IERC721OnChain.sol +++ b/contracts/schain/tokens/IERC721OnChain.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IERC721OnChain { diff --git a/contracts/schain/tokens/IEthErc20.sol b/contracts/schain/tokens/IEthErc20.sol index 3c4506b..ccdb667 100644 --- a/contracts/schain/tokens/IEthErc20.sol +++ b/contracts/schain/tokens/IEthErc20.sol @@ -19,7 +19,7 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.8.8 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; interface IEthErc20 { diff --git a/hardhat.config.ts b/hardhat.config.ts index 15de234..5e62f92 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,7 +1,7 @@ import { HardhatUserConfig } from "hardhat/config"; const config: HardhatUserConfig = { - solidity: "0.8.9", + solidity: "0.8.27", }; export default config; diff --git a/slither.config.json b/slither.config.json index fcfc6e9..23991e9 100644 --- a/slither.config.json +++ b/slither.config.json @@ -1,4 +1,4 @@ { "detectors_to_exclude": "solc-version", - "filter_paths": "" -} \ No newline at end of file + "filter_paths": "node_modules" +} From a2f2db51d64d0cadcd0ff3172526064d81f4d29d Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 7 Oct 2024 17:59:35 +0300 Subject: [PATCH 04/17] Downgrade skale-manager-interfaces --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a42b231..d6e0d5b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "fullCheck": "yarn lint && yarn cspell && yarn slither" }, "dependencies": { - "@skalenetwork/skale-manager-interfaces": "^3.2.0-execution-layer.0" + "@skalenetwork/skale-manager-interfaces": "^3.2.0-develop.0" }, "devDependencies": { "@types/node": "^22.5.0", diff --git a/yarn.lock b/yarn.lock index 758e488..d7be74d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -909,10 +909,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.2.0-execution-layer.0": - version "3.2.0-execution-layer.0" - resolved "https://registry.yarnpkg.com/@skalenetwork/skale-manager-interfaces/-/skale-manager-interfaces-3.2.0-execution-layer.0.tgz#4e189a23a6b3128b804317e6a86f17655be0bb3c" - integrity sha512-QV/3/QFQEsTMFXZaJzNRXfHtHznf9jq4hsLGUJwTmYPEF6O0WVhDiwfUgwMAah2hgpxxJcdLnWyh3YOA5Kf1Tw== +"@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" From 7850f504dd120ce40317444f3e215b5649e76f66 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 7 Oct 2024 18:05:03 +0300 Subject: [PATCH 05/17] Update checkAllowedToSendMessage --- contracts/schain/ICommunityLocker.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/schain/ICommunityLocker.sol b/contracts/schain/ICommunityLocker.sol index 593d6ca..3f34045 100644 --- a/contracts/schain/ICommunityLocker.sol +++ b/contracts/schain/ICommunityLocker.sol @@ -21,6 +21,7 @@ pragma solidity >=0.8.19 <0.9.0; +import {SchainHash} from "../DomainTypes.sol"; import "../IMessageReceiver.sol"; import "./IMessageProxyForSchain.sol"; @@ -34,7 +35,7 @@ interface ICommunityLocker is IMessageReceiver { ITokenManagerLinker newTokenManagerLinker, address newCommunityPool ) external; - function checkAllowedToSendMessage(bytes32 chainHash, address receiver) external; + function checkAllowedToSendMessage(SchainHash chainHash, address receiver) external; function setTimeLimitPerMessage(string memory chainName, uint256 newTimeLimitPerMessage) external; function setGasPrice( uint256 gasPrice, From 5cddebfecfb86e8593584ac37c2f5aec17634aa0 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 7 Oct 2024 18:15:11 +0300 Subject: [PATCH 06/17] Add operator != --- contracts/DomainTypes.sol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contracts/DomainTypes.sol b/contracts/DomainTypes.sol index 0629f3e..635b8fa 100644 --- a/contracts/DomainTypes.sol +++ b/contracts/DomainTypes.sol @@ -24,7 +24,8 @@ pragma solidity >=0.8.19 <0.9.0; type SchainHash is bytes32; using { - _schainHashEquals as == + _schainHashEquals as ==, + _schainHashNotEquals as != } for SchainHash global; // Operators are used by the library users @@ -34,4 +35,8 @@ function _schainHashEquals(SchainHash left, SchainHash right) pure returns (bool return SchainHash.unwrap(left) == SchainHash.unwrap(right); } +function _schainHashNotEquals(SchainHash left, SchainHash right) pure returns (bool result) { + return SchainHash.unwrap(left) != SchainHash.unwrap(right); +} + // slither-disable-end dead-code From fc2ff10d434aeb70a03eb232465d652c31a1af77 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 9 Oct 2024 17:27:01 +0300 Subject: [PATCH 07/17] Update ILinker --- contracts/mainnet/ILinker.sol | 2 +- contracts/mainnet/ISkaleManagerClient.sol | 4 +++- contracts/mainnet/ITwin.sol | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/contracts/mainnet/ILinker.sol b/contracts/mainnet/ILinker.sol index f1b3316..c0013bc 100644 --- a/contracts/mainnet/ILinker.sol +++ b/contracts/mainnet/ILinker.sol @@ -30,7 +30,7 @@ interface ILinker is ITwin { function connectSchain(string calldata schainName, address[] calldata schainContracts) external; function kill(string calldata schainName) external; function disconnectSchain(string calldata schainName) external; - function isNotKilled(bytes32 schainHash) external view returns (bool); + function isNotKilled(SchainHash schainHash) external view returns (bool); function hasMainnetContract(address mainnetContract) external view returns (bool); function hasSchain(string calldata schainName) external view returns (bool connected); } diff --git a/contracts/mainnet/ISkaleManagerClient.sol b/contracts/mainnet/ISkaleManagerClient.sol index 2e5b6dc..032e1e2 100644 --- a/contracts/mainnet/ISkaleManagerClient.sol +++ b/contracts/mainnet/ISkaleManagerClient.sol @@ -23,9 +23,11 @@ pragma solidity >=0.8.19 <0.9.0; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; +import {SchainHash} from "../DomainTypes.sol"; + interface ISkaleManagerClient { function initialize(IContractManager newContractManagerOfSkaleManager) external; - function isSchainOwner(address sender, bytes32 schainHash) external view returns (bool); + function isSchainOwner(address sender, SchainHash schainHash) external view returns (bool); function isAgentAuthorized(bytes32 schainHash, address sender) external view returns (bool); } diff --git a/contracts/mainnet/ITwin.sol b/contracts/mainnet/ITwin.sol index eaa2a41..b85b526 100644 --- a/contracts/mainnet/ITwin.sol +++ b/contracts/mainnet/ITwin.sol @@ -27,5 +27,5 @@ interface ITwin is ISkaleManagerClient { function addSchainContract(string calldata schainName, address contractReceiver) external; function removeSchainContract(string calldata schainName) external; function hasSchainContract(string calldata schainName) external view returns (bool); - function getSchainContract(bytes32 schainHash) external view returns (address); + function getSchainContract(SchainHash schainHash) external view returns (address); } From eb22baae62f7b00547f7f8a559be867cdff9ac4a Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 9 Oct 2024 17:32:14 +0300 Subject: [PATCH 08/17] Update IMessageProxy --- contracts/IMessageProxy.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/IMessageProxy.sol b/contracts/IMessageProxy.sol index 10db969..76e7c63 100644 --- a/contracts/IMessageProxy.sol +++ b/contracts/IMessageProxy.sol @@ -21,7 +21,7 @@ pragma solidity >=0.8.19 <0.9.0; -import { IMessageListener } from "./IMessageListener.sol"; +import { IMessageListener, SchainHash } from "./IMessageListener.sol"; interface IMessageProxy is IMessageListener { @@ -34,7 +34,7 @@ interface IMessageProxy is IMessageListener { function removeExtraContract(string memory schainName, address extraContract) external; function setVersion(string calldata newVersion) external; function isContractRegistered( - bytes32 schainHash, + SchainHash schainHash, address contractAddress ) external view returns (bool); function getContractRegisteredLength(bytes32 schainHash) external view returns (uint256); From 5a560de263f540a47701d352a570ba9cfaf87420 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 9 Oct 2024 17:46:38 +0300 Subject: [PATCH 09/17] Update IMessageProxyForSchain --- contracts/schain/IMessageProxyForSchain.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/schain/IMessageProxyForSchain.sol b/contracts/schain/IMessageProxyForSchain.sol index 465d6a7..f1add85 100644 --- a/contracts/schain/IMessageProxyForSchain.sol +++ b/contracts/schain/IMessageProxyForSchain.sol @@ -26,7 +26,7 @@ import "./IKeyStorage.sol"; interface IMessageProxyForSchain is IMessageProxy { struct OutgoingMessageData { - bytes32 dstChainHash; // destination chain + SchainHash dstChainHash; // destination chain uint256 msgCounter; // message counter address srcContract; // origin address dstContract; // receiver From e8f3296d3ac79af24ca270ada4c5f971642fe930 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 9 Oct 2024 17:54:55 +0300 Subject: [PATCH 10/17] Update IMessageReceiver --- contracts/IMessageReceiver.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/IMessageReceiver.sol b/contracts/IMessageReceiver.sol index 2da4c9f..a0788f7 100644 --- a/contracts/IMessageReceiver.sol +++ b/contracts/IMessageReceiver.sol @@ -21,10 +21,12 @@ pragma solidity >=0.8.19 <0.9.0; +import {SchainHash} from "./DomainTypes.sol"; + interface IMessageReceiver { function postMessage( - bytes32 schainHash, + SchainHash schainHash, address sender, bytes calldata data ) From 531651657290cd3ab8e5552b215369548eee09c2 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Wed, 9 Oct 2024 18:05:16 +0300 Subject: [PATCH 11/17] Update ICommunityPool --- contracts/mainnet/ICommunityPool.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/mainnet/ICommunityPool.sol b/contracts/mainnet/ICommunityPool.sol index 077a29e..11edb94 100644 --- a/contracts/mainnet/ICommunityPool.sol +++ b/contracts/mainnet/ICommunityPool.sol @@ -36,7 +36,7 @@ interface ICommunityPool is ITwin { IMessageProxyForMainnet messageProxyValue ) external; function refundGasByUser( - bytes32 schainHash, + SchainHash schainHash, address payable node, address user, uint256 gas @@ -46,11 +46,11 @@ interface ICommunityPool is ITwin { function setMinTransactionGas(uint256 newMinTransactionGas) external; function setMultiplier(uint256 newMultiplierNumerator, uint256 newMultiplierDivider) external; function refundGasBySchainWallet( - bytes32 schainHash, + SchainHash schainHash, address payable node, uint256 gas ) external returns (bool); function getBalance(address user, string calldata schainName) external view returns (uint256); - function checkUserBalance(bytes32 schainHash, address receiver) external view returns (bool); - function getRecommendedRechargeAmount(bytes32 schainHash, address receiver) external view returns (uint256); + function checkUserBalance(SchainHash schainHash, address receiver) external view returns (bool); + function getRecommendedRechargeAmount(SchainHash schainHash, address receiver) external view returns (uint256); } From ed93beaee0cc00c315420643b17a34c411066190 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 14 Oct 2024 18:38:43 +0300 Subject: [PATCH 12/17] Update IGasReimbursable --- contracts/IGasReimbursable.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/IGasReimbursable.sol b/contracts/IGasReimbursable.sol index 6d45f9b..07be024 100644 --- a/contracts/IGasReimbursable.sol +++ b/contracts/IGasReimbursable.sol @@ -26,7 +26,7 @@ import "./IMessageReceiver.sol"; interface IGasReimbursable is IMessageReceiver { function gasPayer( - bytes32 schainHash, + SchainHash schainHash, address sender, bytes calldata data ) From f4b5e6078f18337c3cb88c292b33a4453e11eb2e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 14 Oct 2024 18:54:28 +0300 Subject: [PATCH 13/17] Update IMessageProxy --- contracts/IMessageProxy.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/IMessageProxy.sol b/contracts/IMessageProxy.sol index 76e7c63..60be724 100644 --- a/contracts/IMessageProxy.sol +++ b/contracts/IMessageProxy.sol @@ -37,9 +37,9 @@ interface IMessageProxy is IMessageListener { SchainHash schainHash, address contractAddress ) external view returns (bool); - function getContractRegisteredLength(bytes32 schainHash) external view returns (uint256); + function getContractRegisteredLength(SchainHash schainHash) external view returns (uint256); function getContractRegisteredRange( - bytes32 schainHash, + SchainHash schainHash, uint256 from, uint256 to ) From 1faae319e7c080f40913b1303ea12f11b297f41e Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Mon, 14 Oct 2024 19:06:04 +0300 Subject: [PATCH 14/17] Move from bytes32 to SchainHash --- contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol | 10 +++++----- contracts/mainnet/IMessageProxyForMainnet.sol | 8 ++++---- contracts/mainnet/ISkaleManagerClient.sol | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol index bb54561..8e7ad73 100644 --- a/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol +++ b/contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol @@ -45,9 +45,9 @@ interface IDepositBoxERC20 is IDepositBox { function stopTrustingReceiver(string calldata schainName, address receiver) external; function trustReceiver(string calldata schainName, address receiver) external; function validateTransfer(uint transferId) external; - function isReceiverTrusted(bytes32 schainHash, address receiver) external view returns (bool); - function getArbitrageDuration(bytes32 schainHash) external view returns (uint256); - function getBigTransferThreshold(bytes32 schainHash, address token) external view returns (uint256); + function isReceiverTrusted(SchainHash schainHash, address receiver) external view returns (bool); + function getArbitrageDuration(SchainHash schainHash) external view returns (uint256); + function getBigTransferThreshold(SchainHash schainHash, address token) external view returns (uint256); function getDelayedAmount(address receiver, address token) external view returns (uint256 value); function getNextUnlockTimestamp(address receiver, address token) external view returns (uint256 unlockTimestamp); function getSchainToERC20(string calldata schainName, address erc20OnMainnet) external view returns (bool); @@ -60,7 +60,7 @@ interface IDepositBoxERC20 is IDepositBox { external view returns (address[] memory); - function getTimeDelay(bytes32 schainHash) external view returns (uint256); + function getTimeDelay(SchainHash schainHash) external view returns (uint256); function getTrustedReceiver(string calldata schainName, uint256 index) external view returns (address); - function getTrustedReceiversAmount(bytes32 schainHash) external view returns (uint256); + function getTrustedReceiversAmount(SchainHash schainHash) external view returns (uint256); } diff --git a/contracts/mainnet/IMessageProxyForMainnet.sol b/contracts/mainnet/IMessageProxyForMainnet.sol index 4531342..8b7839f 100644 --- a/contracts/mainnet/IMessageProxyForMainnet.sol +++ b/contracts/mainnet/IMessageProxyForMainnet.sol @@ -33,11 +33,11 @@ interface IMessageProxyForMainnet is IMessageProxy { function addReimbursedContract(string memory schainName, address reimbursedContract) external; function removeReimbursedContract(string memory schainName, address reimbursedContract) external; function messageInProgress() external view returns (bool); - function isPaused(bytes32 schainHash) external view returns (bool); - function isReimbursedContract(bytes32 schainHash, address contractAddress) external view returns (bool); - function getReimbursedContractsLength(bytes32 schainHash) external view returns (uint256); + function isPaused(SchainHash schainHash) external view returns (bool); + function isReimbursedContract(SchainHash schainHash, address contractAddress) external view returns (bool); + function getReimbursedContractsLength(SchainHash schainHash) external view returns (uint256); function getReimbursedContractsRange( - bytes32 schainHash, + SchainHash schainHash, uint256 from, uint256 to ) diff --git a/contracts/mainnet/ISkaleManagerClient.sol b/contracts/mainnet/ISkaleManagerClient.sol index 032e1e2..2363303 100644 --- a/contracts/mainnet/ISkaleManagerClient.sol +++ b/contracts/mainnet/ISkaleManagerClient.sol @@ -29,5 +29,5 @@ import {SchainHash} from "../DomainTypes.sol"; interface ISkaleManagerClient { function initialize(IContractManager newContractManagerOfSkaleManager) external; function isSchainOwner(address sender, SchainHash schainHash) external view returns (bool); - function isAgentAuthorized(bytes32 schainHash, address sender) external view returns (bool); + function isAgentAuthorized(SchainHash schainHash, address sender) external view returns (bool); } From d0494cc3147e32db59af6c586ee911853e4a3bd2 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Thu, 21 Nov 2024 17:38:28 +0200 Subject: [PATCH 15/17] Add setRemoteExecutionManager function --- contracts/schain/IExecutionManager.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contracts/schain/IExecutionManager.sol b/contracts/schain/IExecutionManager.sol index 5b24fd1..5d5ed66 100644 --- a/contracts/schain/IExecutionManager.sol +++ b/contracts/schain/IExecutionManager.sol @@ -28,5 +28,9 @@ import {SchainHash} from "../DomainTypes.sol"; interface IExecutionManager is IMessageReceiver { function initialize(IMessageProxyForSchain messageProxyAddress) external; + function setRemoteExecutionManager( + SchainHash schainHash, + address executionManagerAddress + ) external; function testSend(SchainHash targetChainHash, string calldata message) external; } From 64c5dd79d188756f73569c508783241ce1e6dde9 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Tue, 10 Dec 2024 17:15:30 +0200 Subject: [PATCH 16/17] Add IExecutor --- .../schain/ExecutionLayer/IActionExecutor.sol | 36 +++++++++++++++++++ .../IExecutionManager.sol | 6 ++-- contracts/schain/ExecutionLayer/IExecutor.sol | 36 +++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 contracts/schain/ExecutionLayer/IActionExecutor.sol rename contracts/schain/{ => ExecutionLayer}/IExecutionManager.sol (87%) create mode 100644 contracts/schain/ExecutionLayer/IExecutor.sol diff --git a/contracts/schain/ExecutionLayer/IActionExecutor.sol b/contracts/schain/ExecutionLayer/IActionExecutor.sol new file mode 100644 index 0000000..20f84d5 --- /dev/null +++ b/contracts/schain/ExecutionLayer/IActionExecutor.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +/** + * IActionExecutor - SKALE Interchain Messaging Agent + * Copyright (C) 2024-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.8.19 <0.9.0; + +struct TokenInfo { + address token; + uint256 number; +} + +interface IActionExecutor { + function execute( + TokenInfo[] memory inputTokens, + bytes memory arguments + ) + external + returns (TokenInfo[] memory outputTokens); +} diff --git a/contracts/schain/IExecutionManager.sol b/contracts/schain/ExecutionLayer/IExecutionManager.sol similarity index 87% rename from contracts/schain/IExecutionManager.sol rename to contracts/schain/ExecutionLayer/IExecutionManager.sol index 5d5ed66..c986823 100644 --- a/contracts/schain/IExecutionManager.sol +++ b/contracts/schain/ExecutionLayer/IExecutionManager.sol @@ -21,9 +21,9 @@ pragma solidity >=0.8.19 <0.9.0; -import {IMessageReceiver} from "../IMessageReceiver.sol"; -import {IMessageProxyForSchain} from "./IMessageProxyForSchain.sol"; -import {SchainHash} from "../DomainTypes.sol"; +import {IMessageReceiver} from "../../IMessageReceiver.sol"; +import {IMessageProxyForSchain} from "../IMessageProxyForSchain.sol"; +import {SchainHash} from "../../DomainTypes.sol"; interface IExecutionManager is IMessageReceiver { diff --git a/contracts/schain/ExecutionLayer/IExecutor.sol b/contracts/schain/ExecutionLayer/IExecutor.sol new file mode 100644 index 0000000..da686f1 --- /dev/null +++ b/contracts/schain/ExecutionLayer/IExecutor.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: AGPL-3.0-only + +/** + * IExecutor - SKALE Interchain Messaging Agent + * Copyright (C) 2024-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 . + */ + +// cspell::words func-name-mixedcase + +pragma solidity >=0.8.19 <0.9.0; + +import {IActionExecutor} from "./IActionExecutor.sol"; + +type ExecutorId is bytes32; + +interface IExecutor is IActionExecutor { + // ID will be public constant variable but not function + // slither-disable-start naming-convention + // solhint-disable-next-line func-name-mixedcase + function ID() external pure returns (ExecutorId executorId); + // slither-disable-end naming-convention +} From 6370654b47e1d5643e76940a180a98a1ac27f2e5 Mon Sep 17 00:00:00 2001 From: Dmytro Stebaiev Date: Fri, 13 Dec 2024 17:32:09 +0200 Subject: [PATCH 17/17] Update initializer --- contracts/schain/ExecutionLayer/IExecutionManager.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/schain/ExecutionLayer/IExecutionManager.sol b/contracts/schain/ExecutionLayer/IExecutionManager.sol index c986823..38a4119 100644 --- a/contracts/schain/ExecutionLayer/IExecutionManager.sol +++ b/contracts/schain/ExecutionLayer/IExecutionManager.sol @@ -22,12 +22,12 @@ pragma solidity >=0.8.19 <0.9.0; import {IMessageReceiver} from "../../IMessageReceiver.sol"; -import {IMessageProxyForSchain} from "../IMessageProxyForSchain.sol"; +import {ITokenManagerERC20} from "../TokenManagers/ITokenManagerERC20.sol"; import {SchainHash} from "../../DomainTypes.sol"; interface IExecutionManager is IMessageReceiver { - function initialize(IMessageProxyForSchain messageProxyAddress) external; + function initialize(ITokenManagerERC20 erc20TokenManagerAddress) external; function setRemoteExecutionManager( SchainHash schainHash, address executionManagerAddress