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..635b8fa --- /dev/null +++ b/contracts/DomainTypes.sol @@ -0,0 +1,42 @@ +// 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.19 <0.9.0; + + +type SchainHash is bytes32; + +using { + _schainHashEquals as ==, + _schainHashNotEquals 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); +} + +function _schainHashNotEquals(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 e6c8f19..07be024 100644 --- a/contracts/IGasReimbursable.sol +++ b/contracts/IGasReimbursable.sol @@ -19,17 +19,17 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "./IMessageReceiver.sol"; interface IGasReimbursable is IMessageReceiver { function gasPayer( - bytes32 schainHash, + SchainHash schainHash, address sender, bytes calldata data ) external returns (address); -} \ No newline at end of file +} diff --git a/contracts/IMessageListener.sol b/contracts/IMessageListener.sol index d065619..00f310d 100644 --- a/contracts/IMessageListener.sol +++ b/contracts/IMessageListener.sol @@ -19,7 +19,9 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.19 <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; diff --git a/contracts/IMessageProxy.sol b/contracts/IMessageProxy.sol index 44bc6e3..60be724 100644 --- a/contracts/IMessageProxy.sol +++ b/contracts/IMessageProxy.sol @@ -19,9 +19,9 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; -import { IMessageListener } from "./IMessageListener.sol"; +import { IMessageListener, SchainHash } from "./IMessageListener.sol"; interface IMessageProxy is IMessageListener { @@ -34,12 +34,12 @@ 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); + function getContractRegisteredLength(SchainHash schainHash) external view returns (uint256); function getContractRegisteredRange( - bytes32 schainHash, + SchainHash schainHash, uint256 from, uint256 to ) diff --git a/contracts/IMessageReceiver.sol b/contracts/IMessageReceiver.sol index ee9ed4f..a0788f7 100644 --- a/contracts/IMessageReceiver.sol +++ b/contracts/IMessageReceiver.sol @@ -19,14 +19,16 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +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 ) external; -} \ No newline at end of file +} diff --git a/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol b/contracts/extensions/IERC721ReferenceMintAndMetadataMainnet.sol index 295d7da..112fc8a 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.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..8e7ad73 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.19 <0.9.0; import "../IDepositBox.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); -} \ No newline at end of file + function getTrustedReceiversAmount(SchainHash schainHash) external view returns (uint256); +} diff --git a/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol b/contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol index 8fb7386..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..11edb94 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.19 <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( + SchainHash 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, + SchainHash schainHash, address payable node, - uint gas + uint256 gas ) external returns (bool); - function getBalance(address user, string calldata schainName) external view returns (uint); - 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 + function getBalance(address user, string calldata schainName) external view returns (uint256); + function checkUserBalance(SchainHash schainHash, address receiver) external view returns (bool); + function getRecommendedRechargeAmount(SchainHash schainHash, address receiver) external view returns (uint256); +} diff --git a/contracts/mainnet/IDepositBox.sol b/contracts/mainnet/IDepositBox.sol index dafcbd0..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..c0013bc 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.19 <0.9.0; import "./ITwin.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); -} \ No newline at end of file +} diff --git a/contracts/mainnet/IMessageProxyForMainnet.sol b/contracts/mainnet/IMessageProxyForMainnet.sol index d90bdf6..8b7839f 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.19 <0.9.0; import "../IMessageProxy.sol"; import "./ICommunityPool.sol"; @@ -33,15 +33,15 @@ 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 ) 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..2363303 100644 --- a/contracts/mainnet/ISkaleManagerClient.sol +++ b/contracts/mainnet/ISkaleManagerClient.sol @@ -19,13 +19,15 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +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 isAgentAuthorized(bytes32 schainHash, address sender) external view returns (bool); -} \ No newline at end of file + function isSchainOwner(address sender, SchainHash schainHash) external view returns (bool); + function isAgentAuthorized(SchainHash schainHash, address sender) external view returns (bool); +} diff --git a/contracts/mainnet/ITwin.sol b/contracts/mainnet/ITwin.sol index 28b3802..b85b526 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.19 <0.9.0; import "./ISkaleManagerClient.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); -} \ No newline at end of file + function getSchainContract(SchainHash schainHash) external view returns (address); +} 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/ExecutionLayer/IExecutionManager.sol b/contracts/schain/ExecutionLayer/IExecutionManager.sol new file mode 100644 index 0000000..38a4119 --- /dev/null +++ b/contracts/schain/ExecutionLayer/IExecutionManager.sol @@ -0,0 +1,36 @@ +// 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.19 <0.9.0; + +import {IMessageReceiver} from "../../IMessageReceiver.sol"; +import {ITokenManagerERC20} from "../TokenManagers/ITokenManagerERC20.sol"; +import {SchainHash} from "../../DomainTypes.sol"; + + +interface IExecutionManager is IMessageReceiver { + function initialize(ITokenManagerERC20 erc20TokenManagerAddress) external; + function setRemoteExecutionManager( + SchainHash schainHash, + address executionManagerAddress + ) external; + function testSend(SchainHash targetChainHash, string calldata message) external; +} 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 +} diff --git a/contracts/schain/ICommunityLocker.sol b/contracts/schain/ICommunityLocker.sol index 5fc14af..3f34045 100644 --- a/contracts/schain/ICommunityLocker.sol +++ b/contracts/schain/ICommunityLocker.sol @@ -19,8 +19,9 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; +import {SchainHash} from "../DomainTypes.sol"; import "../IMessageReceiver.sol"; import "./IMessageProxyForSchain.sol"; @@ -34,7 +35,11 @@ interface ICommunityLocker is IMessageReceiver { ITokenManagerLinker newTokenManagerLinker, 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 checkAllowedToSendMessage(SchainHash chainHash, address receiver) external; + function setTimeLimitPerMessage(string memory chainName, uint256 newTimeLimitPerMessage) external; + function setGasPrice( + uint256 gasPrice, + uint256 timestamp, + IMessageProxyForSchain.Signature memory signature + ) external; +} diff --git a/contracts/schain/IKeyStorage.sol b/contracts/schain/IKeyStorage.sol index ac5d310..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..f1add85 100644 --- a/contracts/schain/IMessageProxyForSchain.sol +++ b/contracts/schain/IMessageProxyForSchain.sol @@ -19,14 +19,14 @@ * along with SKALE IMA. If not, see . */ -pragma solidity >=0.6.10 <0.9.0; +pragma solidity >=0.8.19 <0.9.0; import "../IMessageProxy.sol"; 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 diff --git a/contracts/schain/ITokenManager.sol b/contracts/schain/ITokenManager.sol index b0ee59b..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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 fac8071..9aac41f 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.19 <0.9.0; import "./ITokenContractManager.sol"; diff --git a/contracts/schain/TokenManagers/ITokenManagerERC721.sol b/contracts/schain/TokenManagers/ITokenManagerERC721.sol index ba52996..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..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.6.10 <0.9.0; +pragma solidity >=0.8.19 <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..6412bbe 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.19 <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..7b8f29c 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.19 <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..ccdb667 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.19 <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/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" +}