Skip to content

Commit ffca818

Browse files
committed
Update readme
1 parent 9246b87 commit ffca818

File tree

1 file changed

+41
-42
lines changed

1 file changed

+41
-42
lines changed
Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,82 @@
11
# Sharing Smart Contracts
22

3-
Brief description of your project.
4-
5-
## Table of Contents
6-
7-
- [Installation](#installation)
8-
- [Scripts](#scripts)
9-
- [Compile](#compile)
10-
- [Verify](#verify)
11-
- [Deploy (Production)](#deploy-production)
12-
- [Deploy (Test)](#deploy-test)
13-
- [Run Tests](#run-tests)
14-
- [Generate UML Diagrams](#generate-uml-diagrams)
3+
Note: all of the following commands should be executed inside `packages/sharing-smart-contract`.
154

165
## Installation
176

18-
Describe the steps to install the project dependencies.
19-
207
```bash
218
npm ci
229
```
2310

24-
## Scripts
25-
26-
### Compile
11+
## Build
2712

2813
To clean and compile the project:
2914

3015
```bash
3116
npm run compile
3217
```
3318

34-
### Verify
19+
### Test
3520

36-
To verify the contracts:
21+
Start a local Hardhat node that, by default, forks Bellecour network:
3722

3823
```bash
39-
npm run verify
24+
npx hardhat node
4025
```
4126

42-
### Deployment
43-
44-
To deploy the contracts on a local hardhat network, run:
27+
Open a new terminal and run :
4528

4629
```bash
47-
npm run deploy # [-- --network <localhost>] if using an external local node.
30+
npm run test -- --network localhost
4831
```
4932

50-
To deploy the project on a live network, two options are available:
51-
1. Triggering the dedicated Github Action workflow (recommended).
52-
2. Or adding a private key locally and running:
33+
## Deployment
34+
35+
To deploy contracts, set up a private key in `.env` file and run:
36+
5337
```bash
5438
npm run deploy -- --network <name>
5539
```
5640

57-
#### Note:
58-
* Deployment on chains that support CreateX factory will deploy contracts
59-
using `create2` strategy.
60-
* Github Actions workflow should be used for production deployments.
41+
**Note**: Deployment on chains that support CreateX factory will deploy contracts using `create2` strategy.
42+
43+
### Mainnets deployment
6144

45+
Deploying on any mainnet must happen through the dedicated Github action.
46+
The action can be triggered from Github UI or using Github CLI:
6247

63-
### Run Tests
48+
```sh
49+
gh workflow run 'Sharing Smart Contract - Deployment' \
50+
-f environment=<name> \ # testnets | mainnets
51+
-f network=<name>
52+
# [ --ref <branch name> ]
53+
```
6454

65-
To deploy the project on the test network - localhost.
66-
You need first to start a local hardhat node which will be a fork of bellecour network :
55+
The output should be something like:
6756

68-
```bash
69-
npx hardhat node
57+
```
58+
✓ Created workflow_dispatch event for sharing-smart-contract-deploy.yml at feature/sharing-deployment-with-actions
7059
```
7160

72-
Open a new terminal and run :
61+
Then check the execution on [Github](https://github.com/iExecBlockchainComputing/dataprotector-sdk/actions/workflows/sharing-smart-contract-deploy.yml).
62+
63+
### Testnets deployments
64+
65+
It is **highly recommended** to use Github Actions to deploy on live testnets, especially for "final" versions that are going to be used by other services.
66+
67+
It is ok to deploy manually on testnets in dev mode. In that case use random create2 salts to not interfere with the configured salt.
68+
69+
### Verification
70+
71+
To verify contracts run:
7372

7473
```bash
75-
npm run test
74+
npm run verify -- --network <name>
7675
```
7776

78-
⚠️ Even if, the default network in the hardhat config is the local bellecour fork node. The tests will be run on a a simple snap hardhat node. That is why we need to specify the localhost network for the test which corresponds to the fork node of bellecour.
77+
## Docs and diagrams
7978

80-
### Generate UML Diagrams
79+
#### UML Diagrams
8180

8281
To generate UML diagrams for smart contracts (storage + class):
8382

@@ -93,14 +92,14 @@ To convert Solidity files to storage UML diagrams:
9392
npm run sol-to-uml
9493
```
9594

96-
#### Storage to Diagrams
95+
#### Storage to diagrams
9796

9897
To convert Solidity files to class UML diagrams:
9998

10099
```bash
101100
npm run storage-to-diagrams
102101
```
103102

104-
#### Issue
103+
#### Issues
105104

106105
Do not use a more recent version of hardhat than the current one (2.20.1). Cf issue : <https://github.com/NomicFoundation/hardhat/issues/4974>

0 commit comments

Comments
 (0)