Skip to content

Commit d4b8b13

Browse files
authored
docs: Clean READMEs and fix main coverage report on Codecov (#290)
1 parent 6b9b450 commit d4b8b13

File tree

5 files changed

+267
-233
lines changed

5 files changed

+267
-233
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: PoCo Contracts CI
22

33
on:
4+
push:
5+
branches:
6+
- main
47
pull_request:
58
workflow_call:
69

README.md

Lines changed: 15 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# iExec PoCo Smart Contracts
22

33
[![codecov](https://codecov.io/github/iExecBlockchainComputing/PoCo/graph/badge.svg)](https://codecov.io/github/iExecBlockchainComputing/PoCo)
4+
[![npm version](https://img.shields.io/npm/v/@iexec/poco.svg)](https://www.npmjs.com/package/@iexec/poco)
45

5-
# Introduction
6+
## Introduction
67

78
This repository contains the smart contract implementation of iExec's Proof of Contribution protocol.
89

9-
## Related articles
10+
### Related articles
1011

1112
- [PoCo Series #1 — About Trust and Agents Incentives](https://medium.com/iex-ec/about-trust-and-agents-incentives-4651c138974c)
1213
- [PoCo Series #2 — On the use of staking to prevent attacks](https://medium.com/iex-ec/poco-series-2-on-the-use-of-staking-to-prevent-attacks-2a5c700558bd)
@@ -19,184 +20,20 @@ This repository contains the smart contract implementation of iExec's Proof of C
1920

2021
## Documentation
2122

22-
- [Protocol documentation](https://docs.iex.ec/protocol/proof-of-contribution)
23-
- [Solidity API documentation](./docs/solidity/index.md)
23+
- [iExec technical documentation](https://docs.iex.ec/)
24+
- [Protocol specific documentation](https://docs.iex.ec/protocol/proof-of-contribution)
25+
- [Solidity contracts API](./docs/README.md#solidity-contracts-api)
26+
- [Technical README](./docs/README.md)
2427

25-
### UML and storage diagrams
26-
- [Contracts and Actors Architecture](./docs/README.md#contracts-and-actors-architecture)
27-
- [State diagrams](./docs/Statuses.md)
28-
- [Nominal workflow sequence](./docs/README.md#nominal)
29-
- [Nominal workflow sequence w/ TEE](./docs/README.md#nominaltee)
30-
- [Boost workflow sequence](./docs/README.md#boost)
31-
- Storage diagrams
32-
- [Diamond storage](./docs/uml/storage-diagram-diamond.svg)
33-
- [PoCo storage](./docs/uml/storage-diagram-poco.svg)
34-
- UML classes related to:
35-
- [IexecPoco1Facet & IexecPoco2Facet](./docs/uml/class-uml-IexecPocoFacets.svg)
36-
- [IexecPocoBoostFacet](./docs/uml/class-uml-IexecPocoBoostFacet.svg)
37-
- [IexecEscrows](./docs/uml/class-uml-IexecEscrows.svg)
38-
- [iExec PoCo registries](./docs/uml/class-uml-dir-registries.svg)
39-
- [iExec PoCo libraries](./docs/uml/class-uml-dir-libs.svg)
40-
- [iExec PoCo modules (facets)](./docs/uml/class-uml-dir-facets.svg)
28+
## Resources
29+
- **NPM Package**: [@iexec/poco](https://www.npmjs.com/package/@iexec/poco) includes all smart contract source code, ABIs, and deployment artifacts.
30+
- **ABIs**: available in the `abis/` directory of this repository and the published NPM package.<br>
31+
Note: ⚠️ `artifacts/` folder is deprecated and will be removed in future versions.
32+
- **Deployment addresses**: available in the `deployments/` folder of this repository and the published NPM package.
33+
- **Subgraph**: the Subgraph indexing Arbitrum deployments is available on [The Graph Explorer](https://thegraph.com/explorer/):
34+
- [Arbitrum Mainnet](https://thegraph.com/explorer/subgraphs/B1comLe9SANBLrjdnoNTJSubbeC7cY7EoNu6zD82HeKy?view=Query&chain=arbitrum-one)
35+
- [Arbitrum Sepolia Testnet](https://thegraph.com/explorer/subgraphs/2GCj8gzLCihsiEDq8cYvC5nUgK6VfwZ6hm3Wj8A3kcxz?view=Query&chain=arbitrum-one)
4136

4237
## Audits
4338

4439
All contract audit files can be found in [audits/](./audits/) folder.
45-
46-
# How to?
47-
48-
## Resources
49-
50-
* **NPM Package**: all contract ABIs, source code, and deployment artifacts (with addresses) are bundled in the [@iexec/poco](https://www.npmjs.com/package/@iexec/poco) package.
51-
* **ABIs**: available in the `abis/` folder of this repository and in the NPM package (`/abis`).
52-
* **Deployment addresses**: published in the `deployments/` folder of this repository and in the NPM package (`/deployments/<chain>`).
53-
* **Artifacts**: ⚠️ DEPRECATED and replaced by `abis`. This will be removed in future versions.
54-
55-
Note: `abis/` folder contains the most up to date version of the ABIs even before deployment on live networks.
56-
## Configure a deployment
57-
58-
Starting from version 5, the PoCo uses a modular design based on [ERC-2535](https://eips.ethereum.org/EIPS/eip-2535). Tests and deployment scripts will use different modules (facets) and deployment process depending on the required configuration. In particular, the configuration can use a [create2 factory](https://github.com/iExecBlockchainComputing/iexec-solidity/blob/master/contracts/Factory/GenericFactory.sol) for the deployment, and enable native token or ERC20 token based escrow depending on the targeted blockchain. This means that the codebase is the same on public blockchains (ERC20 based RLC) and dedicated sidechains (Native token based RLC).
59-
60-
The configuration file is located in `./config/config.json`.
61-
62-
It contains:
63-
- A list of categories created during the deployment process. Additional categories can be created by the contract administrator using the `createCategory` function.
64-
- For each chain id, a quick configuration:
65-
- **"asset":** can be "Token" or "Native", select which escrow to use.
66-
- **"token":** the address of the token to use. If asset is set to token, and no token address is provided, a mock will be deployed on the fly.
67-
- **"v3":** a list of resources from a previous (v3) deployment. This allows previous resources to be automatically available. It also enables score transfer from v3 to v5. [optional]
68-
- **"v5":** deployment parameters for the new version. If factory address is set, and no salt is provided, `bytes32(0)` will be used by default.
69-
70-
If you want to deploy the iExec PoCo V5 smart contracts on a new blockchain, the recommended process is to:
71-
72-
0. Edit the `./config/config.json` file as follows:
73-
1. Create a new entry under "chains" with your chain id;
74-
2. Set the asset type depending on your blockchain;
75-
3. If you are using `"asset": "Token"`, provide the address of the token you want to use;
76-
4. Unless you know what you are doing, leave all `"v3"` resources to `Null`;
77-
5. Use the factory with the same salt as the other blockchains, and use the same wallet as previous deployments to have the same deployment address on this new blockchain.
78-
79-
## Additional configuration & environment variables
80-
81-
Environment variable can be used to alter the configuration of a deployment:
82-
- **SALT**: if set, the `SALT` env var will overwrite the salt parameter from the config. This can be useful to distinguish different deployments without modifying the config.
83-
84-
Additionally, the migration process will look for some smart contracts before deploying new instances. This is true of the application, dataset and workerpool registries. Thus, if different marketplaces are deployed to the same network, they will share these registries.
85-
86-
# Development
87-
88-
This project uses trunk-based development workflow with automatic release management. It means that:
89-
- Only squash merge commits are accepted.
90-
- When merging a PR, its title is used as the commit message.
91-
- A check is added to enforce using the correct format for PR titles (feat:..., fix:..., ...).
92-
- Release please is used to manage Github releases.
93-
94-
## Build
95-
96-
The PoCo smart contracts are in the `contracts/` folder. Json artifacts, containing the contracts bytecode and ABI can be found in the `artifacts/` folder. In case you need to regenerate them, you can use the following command:
97-
```
98-
npm install
99-
npm run build
100-
```
101-
102-
## Test
103-
104-
### Automatic testing
105-
106-
PoCo smart contracts come with a test suite in the `./test` folder. You can startup a sandbox blockchain and run the tests using the following command:
107-
108-
```
109-
npm install
110-
npm run test
111-
```
112-
113-
Additionally, you can produce a coverage report using the following command:
114-
```
115-
npm run coverage
116-
```
117-
118-
The automatic testing command uses the Hardhat network by default to run the tests.
119-
120-
### Testing on a custom blockchain
121-
122-
1. Start a blockchain
123-
- You can either use the Hardhat CLI with the following command:
124-
```
125-
npx hardhat node [<any additional arguments>]
126-
```
127-
- Or run any other blockchain client.
128-
2. **[Optional]** Update the configuration
129-
130-
If your blockchain listen to a port that is not 8545, or if the blockchain is on a different node, update the `hardhat.config.ts` configuration (network ports, accounts with mnemonic, ..) accordingly to the [Hardhat Configuration](https://hardhat.org/hardhat-runner/docs/config) documentation.
131-
3. Run tests
132-
```
133-
npm run test -- --network <networkUrl>
134-
```
135-
136-
## Deploy
137-
138-
The iExec PoCo contracts support automated deployment through both command-line interface and GitHub Actions workflows.
139-
140-
### Command Line Deployment
141-
142-
You can deploy the smart contracts according to the [deploy/0_deploy.ts](./deploy/0_deploy.ts) content. This will automatically save addresses of the deployed artifacts to `deployments/` folder.
143-
144-
To deploy using the CLI:
145-
146-
1. Make sure you followed the "Configure a deployment" section above
147-
2. Enter your targeted blockchain parameters in `hardhat.config.ts`
148-
3. Run the deployment using:
149-
150-
```
151-
npm run deploy -- --network <your network name>
152-
```
153-
154-
Example with custom salt:
155-
156-
```
157-
SALT=0x0000000000000000000000000000000000000000000000000000000000000001 npx hardhat deploy --network hardhat
158-
```
159-
160-
161-
### Verification
162-
163-
To verify contracts:
164-
165-
```
166-
npm run verify:all -- --network <your network name> # e.g. arbitrum
167-
```
168-
169-
This script automatically reads all deployed contract addresses and their constructor arguments from the deployment artifacts and verifies them on the relevant block explorer.
170-
171-
172-
## Formatting
173-
174-
Format a specific file or files in a directory:
175-
```
176-
npm run format <filePath|folderPath>
177-
```
178-
179-
## Render UML diagrams
180-
181-
To render all UML diagrams:
182-
```
183-
npm run uml
184-
```
185-
186-
To render only class diagrams:
187-
188-
```
189-
npm run sol-to-uml
190-
```
191-
192-
To render only .puml files:
193-
194-
```
195-
npm run puml-to-links
196-
```
197-
198-
To render only storage diagrams:
199-
200-
```
201-
npm run storage-to-diagrams
202-
```

0 commit comments

Comments
 (0)