Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multichain Integration #189

Merged
merged 17 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,3 @@ cache/*
coverage/*
metadata/*
coverage.json
abi/PRBMath*.json
abi/*Structs*.json
abi/*Errors*.json
abi/IERC734Extended.json
abi/Shares.json
abi/UnorderedIndexableContractDynamicSetLib.json
abi/UnorderedNamedContractDynamicSetLib.json
abi/AccessControl.json
abi/Address.json
abi/ByteArr.json
abi/Context.json
abi/ERC20.json
abi/ERC20Burnable.json
abi/ERC165.json
abi/ERC721.json
abi/ERC734.json
abi/IAccessControl.json
abi/IERC20.json
abi/IERC20Metadata.json
abi/IERC165.json
abi/IERC721.json
abi/IERC721Metadata.json
abi/IERC721Receiver.json
abi/MerkleProof.json
abi/Migrations.json
abi/Ownable.json
abi/Strings.json
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ node_modules
package-lock.json
package.json
typechain
contracts/MultiSigWallet.sol
contracts/v1/MultiSigWallet.sol
7 changes: 4 additions & 3 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
contracts/utils/*.sol
contracts/Guardian.sol
contracts/MultiSigWallet.sol
contracts/v1/utils/*.sol
contracts/v2/utils/*.sol
contracts/v1/Guardian.sol
contracts/v1/MultiSigWallet.sol
94 changes: 65 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,21 @@ This project utilizes a variety of NPM scripts to run various tasks and processe

- `clean`: Removes the cache and artifacts folders generated by Hardhat.
- `compile:size`: Compiles the smart contracts and analyzes the size of the compiled contracts using the hardhat-contract-sizer plugin.
- `compile`: Compiles the smart contracts using the Hardhat CLI.
- `coverage`: Generates a code coverage report for the smart contracts using the solidity-coverage plugin.
- `deploy:localhost`: Deploys the smart contracts to a local network.
- `deploy:otp_alphanet`, `deploy:otp_devnet`, `deploy:otp_testnet`, and `deploy:otp_mainnet`: Deploy the smart contracts to specific networks (alphanet, devnet, testnet, or mainnet).
- `dev`: Runs a local development node with Hardhat and automatically deploys all contracts.
- `compile`: Compiles the smart contracts with specific configuration using `hardhat.node.config.ts`.
- `coverage`: Generates a code coverage report for the smart contracts with specific network and coverage settings.
- `deploy:v1:gno_chiado`, `deploy:v1:gno_mainnet`, `deploy:v1:localhost`, `deploy:v1:otp_alphanet`, `deploy:v1:otp_devnet`, `deploy:v1:otp_mainnet`, `deploy:v1:otp_testnet`, and `deploy:v1`: Deploy version 1 of the smart contracts to various networks including Gnosis Chiado, Hardhat, OriginTrail Parachain Alphanet, OriginTrail Parachain Devnet, OriginTrail Parachain Testnet, and OriginTrail Parachain Mainnet.
- `deploy:v2:gno_chiado`, `deploy:v2:gno_mainnet`, `deploy:v2:localhost`, `deploy:v2:otp_alphanet`, `deploy:v2:otp_devnet`, `deploy:v2:otp_mainnet`, `deploy:v2:otp_testnet`, and `deploy:v2`: Similar to the v1 deploy scripts, these deploy version 2 of the smart contracts to the respective networks.
- `dev:v1`, `dev:v2`, and `dev`: Run local development nodes with Hardhat for different versions of contracts.
- `export-abi`: Updates ABI files according to the current state of the smart contracts.
- `format:fix`: Automatically fixes code formatting issues for JSON, JavaScript, TypeScript, and Solidity files using Prettier.
- `format`: Checks code formatting for JSON, JavaScript, TypeScript, and Solidity files using Prettier.
- `generate-evm-account`: Generates a new Ethereum account using the scripts/generate_evm_account.ts script.
- `generate-otp-account`: Generates a new OriginTrail account using the scripts/generate_otp_account.ts script.
- `lint:fix`: Automatically fixes linting issues for both Solidity and TypeScript files.
- `lint`: Executes linters for both Solidity and TypeScript files.
- `mint-test-tokens`: Mints test tokens on the local - development network using the scripts/mint_test_tokens.ts script.
- `prepare`: Sets up the Husky Git hooks and generates TypeChain typings for the smart contracts.
- `slither:reentrancy`: Executes the Slither static analysis tool with a focus on reentrancy vulnerabilities in the smart contracts.
- `slither`: Runs the Slither static analysis tool on the smart contracts.
- `test:fulltrace`: Runs the test suite with full stack traces enabled for easier debugging.
- `test:gas:fulltrace`: Executes tests with gas usage reporting and full stack traces enabled.
- `test:gas:trace`: Runs tests with gas usage reporting and stack traces enabled.
- `test:gas`: Runs tests with gas usage reporting enabled, using the hardhat-gas-reporter plugin.
- `test:integration`: Executes only the integration tests.
- `test:unit`: Executes only the unit tests.
- `test`: Execute all tests for the smart contracts.
- `format`: Checks code formatting for the same file types.
- `generate-evm-account` and `generate-otp-account`: Generate new Ethereum and OriginTrail accounts, respectively.
- `lint:fix`, `lint:sol:fix`, `lint:ts:fix`, `lint:sol`, `lint:ts`, and `lint`: Provide various linting functionalities for Solidity and TypeScript files, including fixing issues.
- `mint-test-tokens`: Mints test tokens on the local development network.
- `prepare`: Sets up Husky Git hooks and generates TypeChain typings for the smart contracts.
- `slither:reentrancy` and `slither`: Run Slither static analysis with a focus on reentrancy vulnerabilities, and a general analysis, respectively.
- `test:fulltrace`, `test:gas:fulltrace`, `test:gas:trace`, `test:gas`, `test:integration`, `test:trace`, `test:unit`, `test:v1:integration`, `test:v1:unit`, `test:v1`, `test:v2:integration`, `test:v2:unit`, `test:v2`, and `test`: A comprehensive suite of test scripts for different scenarios, including full trace, gas usage, integration, and unit tests for different versions.
- `typechain`: Generates TypeChain typings for the smart contracts.
- `test:trace`: Executes tests with stack trace enabled for easier debugging.

These scripts can be run using the `npm run <script-name>` command. For example, to compile the smart contracts, you can run:

Expand All @@ -79,6 +69,8 @@ npm run compile
Hardhat has plenty of other useful commands, extended by the installed plugins. Here's a brief description of the most useful tasks:

- `decode`: Decodes encoded ABI data (e.g. input data of transaction).
- `encode_selector`: Calculates EVM function/event/error selector (sighash).
- `encode_data`: Encodes data needed for low-level contract calls.

These tasks can be run using the `npx hardhat <task-name>` command. For example, to decode input data, you can run:

Expand All @@ -101,19 +93,63 @@ EVM_PRIVATE_KEY_OTP_DEVNET='<0x_ethereum_private_key>'
ACCOUNT_WITH_OTP_URI_OTP_DEVNET='<substrate_account_uri>'
```

Devnet deployment command
<br/>

OriginTrail Parachain Devnet (v1 contracts)
```sh
npm run deploy:v1:otp_devnet
```
or (v2 contracts)
```sh
npm run deploy:v2:otp_devnet
```

<br/>

OriginTrail Parachain Testnet (v1 contracts)
```sh
npm run deploy:v1:otp_testnet
```
or (v2 contracts)
```sh
npm run deploy:v2:otp_testnet
```

<br/>

OriginTrail Parachain Mainnet (v1 contracts)
```sh
npm run deploy:v1:otp_mainnet
```
or (v2 contracts)
```sh
npm run deploy:v2:otp_mainnet
```

<br/>

Gnosis Chiado (v1 contracts)
```sh
npm run deploy:v1:gno_chiado
```
or (v2 contracts)
```sh
npm run deploy:otp_devnet
npm run deploy:v2:gno_chiado
```
Testnet deployment command

<br/>

Gnosis Mainnet (v1 contracts)
```sh
npm run deploy:otp_testnet
npm run deploy:v1:gno_mainnet
```
Mainnet deployment command
or (v2 contracts)
```sh
npm run deploy:otp_mainnet
npm run deploy:v2:gno_mainnet
```

### Redeploy contract on parachain
<br/>

### Redeploy contract

In order to redeploy desired contract, set `deployed` to `false` in `deployments/<network>_contracts.json`.
Loading