Skip to content

Commit

Permalink
Add ExecutionManager
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed Oct 4, 2024
1 parent 8fd64f5 commit 3aed53a
Show file tree
Hide file tree
Showing 37 changed files with 141 additions and 73 deletions.
4 changes: 3 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
24 changes: 24 additions & 0 deletions contracts/DomainTypes.sol
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/
pragma solidity >=0.8.8 <0.9.0;


type SchainHash is bytes32;
4 changes: 2 additions & 2 deletions contracts/IGasReimbursable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "./IMessageReceiver.sol";

Check warning on line 24 in contracts/IGasReimbursable.sol

View workflow job for this annotation

GitHub Actions / test

global import of path ./IMessageReceiver.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

Expand All @@ -32,4 +32,4 @@ interface IGasReimbursable is IMessageReceiver {
)
external
returns (address);
}
}
2 changes: 1 addition & 1 deletion contracts/IMessageListener.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;


interface IMessageListener {
Expand Down
2 changes: 1 addition & 1 deletion contracts/IMessageProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import { IMessageListener } from "./IMessageListener.sol";

Expand Down
4 changes: 2 additions & 2 deletions contracts/IMessageReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;


interface IMessageReceiver {
Expand All @@ -29,4 +29,4 @@ interface IMessageReceiver {
bytes calldata data
)
external;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;


interface IERC721ReferenceMintAndMetadataMainnet {
function setSenderContractOnSchain(address newSenderContractOnSchain) external;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;


interface IERC721ReferenceMintAndMetadataSchain {
Expand All @@ -32,4 +32,4 @@ interface IERC721ReferenceMintAndMetadataSchain {
external
pure
returns (bytes memory data);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/DepositBoxes/IDepositBoxERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IDepositBox.sol";

Expand Down Expand Up @@ -64,4 +64,4 @@ interface IDepositBoxERC1155 is IDepositBox {
external
view
returns (address[] memory);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/DepositBoxes/IDepositBoxERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IDepositBox.sol";

Expand Down Expand Up @@ -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);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/DepositBoxes/IDepositBoxERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IDepositBox.sol";

Expand All @@ -44,4 +44,4 @@ interface IDepositBoxERC721 is IDepositBox {
external
view
returns (address[] memory);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/DepositBoxes/IDepositBoxEth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IDepositBox.sol";

Expand All @@ -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;
}
}
21 changes: 13 additions & 8 deletions contracts/mainnet/ICommunityPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "@skalenetwork/skale-manager-interfaces/IContractManager.sol";

Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/IDepositBox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "@skalenetwork/skale-manager-interfaces/IContractManager.sol";

Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/ILinker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "./ITwin.sol";

Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/IMessageProxyForMainnet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IMessageProxy.sol";
import "./ICommunityPool.sol";
Expand All @@ -44,4 +44,4 @@ interface IMessageProxyForMainnet is IMessageProxy {
external
view
returns (address[] memory contractsInRange);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/ISkaleManagerClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "@skalenetwork/skale-manager-interfaces/IContractManager.sol";

Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions contracts/mainnet/ITwin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "./ISkaleManagerClient.sol";

Expand All @@ -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);
}
}
12 changes: 8 additions & 4 deletions contracts/schain/ICommunityLocker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IMessageReceiver.sol";

Expand All @@ -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;
}
function setTimeLimitPerMessage(string memory chainName, uint256 newTimeLimitPerMessage) external;
function setGasPrice(
uint256 gasPrice,
uint256 timestamp,
IMessageProxyForSchain.Signature memory signature
) external;
}
32 changes: 32 additions & 0 deletions contracts/schain/IExecutionManager.sol
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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;
}
4 changes: 2 additions & 2 deletions contracts/schain/IKeyStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "./bls/IFieldOperations.sol";


interface IKeyStorage {
function initialize() external;
function getBlsCommonPublicKey() external view returns (IFieldOperations.G2Point memory);
}
}
2 changes: 1 addition & 1 deletion contracts/schain/IMessageProxyForSchain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IMessageProxy.sol";
import "./IKeyStorage.sol";
Expand Down
4 changes: 2 additions & 2 deletions contracts/schain/ITokenManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with SKALE IMA. If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.6.10 <0.9.0;
pragma solidity >=0.8.8 <0.9.0;

import "../IMessageReceiver.sol";

Expand All @@ -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);
}
}
Loading

0 comments on commit 3aed53a

Please sign in to comment.