The IMA is still in active development and therefore should be regarded as alpha software. The development is still subject to further security hardening, testing, and breaking changes.
The proxy contracts have been reviewed and audited by a third-parties for security. Please see SECURITY.md for audit reports and reporting policies.
IMA consists of the following three parts:
Mainnet
smart contracts.SKALE Chain
smart contracts.- A containerized IMA Agent application.
Smart contracts are interfaces for any software working with Mainnet
and SKALE Chain
like other smart contracts deployed there or software connecting these Ethereum networks.
The Agent is a Node JS application connecting the smart contracts on Mainnet with SKALE Chains.
SKALE Interchain Messaging Smart Contracts
Proxy is a library with smart contracts for the SKALE Interchain Messaging Agent. This system allows transferring ETH, ERC20 and ERC721 and is based on the Message Proxy system.
- Smart contract language: Solidity 0.8.16
- NodeJS version: v18
- Yarn Classic
This system allows sending and receiving messages from other chains. MessageProxy.sol
contract needs to be deployed to Mainnet, and deployed to each SKALE chain to use it with the SKALE Interchain Messaging Agent.
You can use MessageProxy contract separately by Interchain Messaging Smart Contracts:
-
Add interface:
interface Proxy { function postOutgoingMessage( string calldata targetSchainName, address targetContract, uint256 amount, address to, bytes calldata data ) external; }
-
Write
postMessage
function, which will receive and process messages from other chains:function postMessage( address sender, string memory fromSchainName, address payable to, uint256 amount, bytes memory data ) public { ... }
-
Add the address of MessageProxy on some chain: Data of Smart contracts stores in
data
folder -
Then continue developing your dApp
There is a Wrapped Ether clone(EthERC20.sol) on SKALE chains - it is an ERC20 token and inherits the known ERC-20 approve issue. Please find more details here https://blog.smartdec.net/erc20-approve-issue-in-simple-words-a41aaf47bca6
This system sends and receives ETH, ERC20, and ERC721 tokens from other chains. It consists of 3 additional smart contracts (not including MessageProxy contract):
DepositBox.sol
- contract only on a mainnet: DepositBox can transfer ETH and ERC20, ERC721 tokens to other chains. -deposit(string memory schainName, address to)
- transfer ETH. ...TokenManager.sol
TokenFactory.sol
- Clone this repo
- run
npm install
- run
npm start
, this command will compile contracts
Configure your networks for SKALE chain and mainnet in truffle-config.js
There are several example networks in comments.
The .env
file should include the following variables:
URL_W3_ETHEREUM="your mainnet RPC url, it also can be an infura endpoint"
URL_W3_S_CHAIN="your SKALE chain RPC url, it also can be an infura endpoint"
CHAIN_NAME_SCHAIN="your SKALE chain name"
PRIVATE_KEY_FOR_ETHEREUM="your private key for mainnet"
PRIVATE_KEY_FOR_SCHAIN="your private key for SKALE chain"
ACCOUNT_FOR_ETHEREUM="your account for mainnet"
ACCOUNT_FOR_SCHAIN="your account for SKALE chain"
NETWORK_FOR_ETHEREUM="your created network for mainnet"
NETWORK_FOR_SCHAIN="your created network for SKALE chain"
- deploy only to your mainnet:
npm run deploy-to-mainnet
- deploy only to your schain:
npm run deploy-to-schain
- deploy only to your mainnet and to schain:
npm run deploy-to-both
Results will be saved to [RESULTS_FOLDER]/ima_data.json
ARTIFACTS_FOLDER
- path tobuild/contracts
folderRESULTS_FOLDER
- path to the folder whereima_data.json
will be saved
cd proxy
npm run compile
python ima_datafile_generator.py [ARTIFACTS_FOLDER] [RESULTS_FOLDER]
Learn more about the SKALE community over on Discord.
All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
All contributions are made under the GNU Affero General Public License v3. See LICENSE. Copyright (C) 2019-Present SKALE Labs.