You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: all of the following commands should be executed inside `packages/sharing-smart-contract`.
15
4
16
5
## Installation
17
6
18
-
Describe the steps to install the project dependencies.
19
-
20
7
```bash
21
8
npm ci
22
9
```
23
10
24
-
## Scripts
25
-
26
-
### Compile
11
+
## Build
27
12
28
13
To clean and compile the project:
29
14
30
15
```bash
31
16
npm run compile
32
17
```
33
18
34
-
### Verify
19
+
### Test
35
20
36
-
To verify the contracts:
21
+
Start a local Hardhat node that, by default, forks Bellecour network:
37
22
38
23
```bash
39
-
npm run verify
24
+
npx hardhat node
40
25
```
41
26
42
-
### Deployment
43
-
44
-
To deploy the contracts on a local hardhat network, run:
27
+
Open a new terminal and run :
45
28
46
29
```bash
47
-
npm run deploy # [-- --network <localhost>] if using an external local node.
30
+
npm run test-- --network localhost
48
31
```
49
32
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
+
53
37
```bash
54
38
npm run deploy -- --network <name>
55
39
```
56
40
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
61
44
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:
62
47
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
+
```
64
54
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:
67
56
68
-
```bash
69
-
npx hardhat node
57
+
```
58
+
✓ Created workflow_dispatch event for sharing-smart-contract-deploy.yml at feature/sharing-deployment-with-actions
70
59
```
71
60
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:
73
72
74
73
```bash
75
-
npm run test
74
+
npm run verify -- --network <name>
76
75
```
77
76
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
79
78
80
-
###Generate UML Diagrams
79
+
####UML Diagrams
81
80
82
81
To generate UML diagrams for smart contracts (storage + class):
83
82
@@ -93,14 +92,14 @@ To convert Solidity files to storage UML diagrams:
93
92
npm run sol-to-uml
94
93
```
95
94
96
-
#### Storage to Diagrams
95
+
#### Storage to diagrams
97
96
98
97
To convert Solidity files to class UML diagrams:
99
98
100
99
```bash
101
100
npm run storage-to-diagrams
102
101
```
103
102
104
-
#### Issue
103
+
#### Issues
105
104
106
105
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