Skip to content

Commit

Permalink
Remove proxy folder
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed Sep 19, 2024
1 parent 228428d commit 5edc297
Show file tree
Hide file tree
Showing 331 changed files with 32,217 additions and 8,081 deletions.
File renamed without changes.
69 changes: 0 additions & 69 deletions .eslintrc.js

This file was deleted.

10 changes: 10 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

if [[ $(npx cspell -- --no-summary $1 2> /dev/null) ]]
then
echo "It looks like you have spell-checking errors in your commit message."
npx cspell -- --no-summary $1
exit 1
fi
17 changes: 17 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# cSpell:words gpgsign

set -e

GPG_SIGN_ENABLED=$(git config commit.gpgsign || true)
if ! [[ "$GPG_SIGN_ENABLED" == "true" ]]
then
echo "Enable GPG signature for new commits";
exit 1;
fi

files=$(git diff --cached --name-only)
npx cspell -- --no-summary $files

yarn fullCheck
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
133 changes: 124 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,139 @@ Please see [SECURITY.md](.github/SECURITY.md) for audit reports and reporting po

IMA consists of the following three parts:

1) `Mainnet` smart contracts.
2) `SKALE Chain` smart contracts.
3) A containerized [IMA Agent](https://github.com/skalenetwork/ima-agent) application.
1) `Mainnet` smart contracts.
2) `SKALE Chain` smart contracts.
3) A containerized [IMA Agent](https://github.com/skalenetwork/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.

## Components Structure
## SKALE IMA Proxy

### Proxy
SKALE Interchain Messaging Smart Contracts

IMA proxy is the Solidity part of IMA containing `Mainnet` and `SKALE Chain` 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.5.10
NodeJS version - 10.16.0
NPM version - 6.9.0

### Message Proxy system

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:

1) Add interface:

```solidity
interface Proxy {
function postOutgoingMessage(
string calldata targetSchainName,
address targetContract,
uint256 amount,
address to,
bytes calldata data
)
external;
}
```

2) Write `postMessage` function, which will receive and process messages from other chains:

```solidity
function postMessage(
address sender,
string memory fromSchainName,
address payable to,
uint256 amount,
bytes memory data
)
public
{
...
}
```

3) Add the address of MessageProxy on some chain:
Data of Smart contracts stores in `data` folder

4) Then continue developing your dApp

### Ether clone on SKALE chain

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>

### Interchain Messaging Agent system

This system sends and receives ETH, ERC20, and ERC721 tokens from other chains.
It consists of 3 additional smart contracts (not including MessageProxy contract):

1) `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. ...
2) `TokenManager.sol`
3) `TokenFactory.sol`

### Install

1) Clone this repo
2) run `npm install`
3) run `npm start`, this command will compile contracts

### Deployment

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:

```bash
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:

```bash
npm run deploy-to-mainnet
```

- deploy only to your schain:

```bash
npm run deploy-to-schain
```

- deploy only to your mainnet and to schain:

```bash
npm run deploy-to-both
```

#### Generate IMA data file for skale-node

Results will be saved to `[RESULTS_FOLDER]/ima_data.json`

- `ARTIFACTS_FOLDER` - path to `build/contracts` folder
- `RESULTS_FOLDER` - path to the folder where `ima_data.json` will be saved

```bash
cd proxy
npm run compile
python ima_datafile_generator.py [ARTIFACTS_FOLDER] [RESULTS_FOLDER]
```

## For more information

- [SKALE Network Website](https://skale.network)
- [SKALE Network Twitter](https://twitter.com/SkaleNetwork)
- [SKALE Network Blog](https://skale.network/blog)
- [SKALE Network Website](https://skale.network)
- [SKALE Network Twitter](https://twitter.com/SkaleNetwork)
- [SKALE Network Blog](https://skale.network/blog)

Learn more about the SKALE community over on [Discord](https://discord.gg/vvUtWJB).

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
67 changes: 54 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,63 @@
{
"name": "skale-ima",
"name": "skale-ima-proxy",
"private": true,
"license": "AGPL-3.0",
"author": "SKALE Labs and contributors",
"scripts": {
"lint-check": "eslint ./test/*.*js",
"lint-fix": "eslint ./test/*.*js --fix",
"postinstall": "./postinstall.sh",
"check-outdated": "yarn outdated",
"upgrade-to-latest": "yarn upgrade --latest"
"compile": "npx hardhat compile",
"cleanCompile": "npx hardhat clean && yarn compile",
"deploy-to-both-chains": "yarn deploy-to-mainnet && yarn deploy-to-schain",
"deploy-to-mainnet": "VERSION=$(cat ../VERSION) npx hardhat run migrations/deployMainnet.ts --network mainnet",
"deploy-to-schain": "VERSION=$(cat ../VERSION) npx hardhat run migrations/deploySchain.ts --network schain",
"deploy-skale-manager-components": "npx hardhat run migrations/deploySkaleManagerComponents.ts --network mainnet",
"eslint": "npx eslint .",
"lint": "npx solhint \"contracts/**/*.sol\"",
"prepare": "yarn cleanCompile",
"test": "yarn tsc && npx hardhat test",
"tsc": "tsc --noEmit",
"slither": "slither .",
"fullcheck": "yarn lint && yarn tsc && yarn eslint && yarn slither",
"hooks": "git config core.hooksPath proxy/.githooks",
"no-hooks": "git config core.hooksPath .git/hooks"
},
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.1.0",
"@openzeppelin/contracts-upgradeable": "^4.7.1",
"@openzeppelin/hardhat-upgrades": "^1.14.0",
"@skalenetwork/etherbase-interfaces": "^0.0.1-develop.20",
"@skalenetwork/ima-interfaces": "2.0.0",
"@skalenetwork/skale-manager-interfaces": "2.0.0",
"@skalenetwork/upgrade-tools": "^2.0.2",
"axios": "^0.21.4",
"dotenv": "^16.0.0",
"ethers": "^5.7.2",
"hardhat": "2.11.0 - 2.16.1"
},
"dependencies": {},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1"
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@nomiclabs/hardhat-waffle": "^2.0.2",
"@typechain/ethers-v5": "^11.1.1",
"@typechain/hardhat": "^7.0.0",
"@types/chai": "^4.2.12",
"@types/chai-almost": "^1.0.1",
"@types/chai-as-promised": "^7.1.3",
"@types/elliptic": "^6.4.14",
"@types/minimist": "^1.2.0",
"@types/mocha": "^9.1.0",
"@types/sinon-chai": "^3.2.5",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"chai": "^4.2.0",
"chai-almost": "^1.0.1",
"chai-as-promised": "^7.1.1",
"eslint": "^8.46.0",
"ethereum-waffle": "^4.0.10",
"ganache": "7.9.2",
"solhint": "3.3.6",
"solidity-coverage": "^0.8.4",
"ts-generator": "^0.1.1",
"ts-node": "^8.10.2",
"typechain": "^8.3.1",
"typescript": "^5.1.6"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions predeployed/build/lib/ima_predeployed/addresses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PROXY_ADMIN_ADDRESS = '0xd2aAa00000000000000000000000000000000000'
MESSAGE_PROXY_FOR_SCHAIN_ADDRESS = '0xd2AAa00100000000000000000000000000000000'
MESSAGE_PROXY_FOR_SCHAIN_IMPLEMENTATION_ADDRESS = '0xD2AAa001D2000000000000000000000000000000'
KEY_STORAGE_ADDRESS = '0xd2aaa00200000000000000000000000000000000'
KEY_STORAGE_IMPLEMENTATION_ADDRESS = '0xD2AAa002d2000000000000000000000000000000'
COMMUNITY_LOCKER_ADDRESS = '0xD2aaa00300000000000000000000000000000000'
COMMUNITY_LOCKER_IMPLEMENTATION_ADDRESS = '0xD2aaA003d2000000000000000000000000000000'
TOKEN_MANAGER_ETH_ADDRESS = '0xd2AaA00400000000000000000000000000000000'
TOKEN_MANAGER_ETH_IMPLEMENTATION_ADDRESS = '0xd2AaA004d2000000000000000000000000000000'
TOKEN_MANAGER_ERC20_ADDRESS = '0xD2aAA00500000000000000000000000000000000'
TOKEN_MANAGER_ERC20_IMPLEMENTATION_ADDRESS = '0xd2aAa005d2000000000000000000000000000000'
TOKEN_MANAGER_ERC721_ADDRESS = '0xD2aaa00600000000000000000000000000000000'
TOKEN_MANAGER_ERC721_IMPLEMENTATION_ADDRESS = '0xd2AAa006d2000000000000000000000000000000'
ETH_ERC20_ADDRESS = '0xD2Aaa00700000000000000000000000000000000'
ETH_ERC20_IMPLEMENTATION_ADDRESS = '0xD2aaA007d2000000000000000000000000000000'
TOKEN_MANAGER_LINKER_ADDRESS = '0xD2aAA00800000000000000000000000000000000'
TOKEN_MANAGER_LINKER_IMPLEMENTATION_ADDRESS = '0xd2aAA008D2000000000000000000000000000000'
Loading

0 comments on commit 5edc297

Please sign in to comment.