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:
56
+
57
+
```
58
+
✓ Created workflow_dispatch event for sharing-smart-contract-deploy.yml at feature/sharing-deployment-with-actions
59
+
```
60
+
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
+
First, set up the target explorer API key in `.env` file.
72
+
73
+
1. To verify contracts that are deployed using Hardhat Ignition, run:
67
74
68
75
```bash
69
-
npx hardhat node
76
+
# Get deployment id using:
77
+
npx hardhat ignition deployments
78
+
79
+
# Verify
80
+
npm run verify:ignition -- <deploymentId># e.g. chain-421614
70
81
```
71
82
72
-
Open a new terminal and run :
83
+
**Note**: contracts deployed using Github Actions are automatically verified.
84
+
85
+
2. To verify any contract, run
73
86
74
87
```bash
75
-
npm run test
88
+
npm run verify -- <address> --network <name>
76
89
```
77
90
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.
91
+
## Docs and diagrams
79
92
80
-
###Generate UML Diagrams
93
+
####UML Diagrams
81
94
82
95
To generate UML diagrams for smart contracts (storage + class):
83
96
@@ -93,14 +106,14 @@ To convert Solidity files to storage UML diagrams:
93
106
npm run sol-to-uml
94
107
```
95
108
96
-
#### Storage to Diagrams
109
+
#### Storage to diagrams
97
110
98
111
To convert Solidity files to class UML diagrams:
99
112
100
113
```bash
101
114
npm run storage-to-diagrams
102
115
```
103
116
104
-
#### Issue
117
+
#### Issues
105
118
106
119
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