Skip to content

Commit

Permalink
Add version + update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Sep 3, 2024
1 parent 4ab48f3 commit 28f31a4
Show file tree
Hide file tree
Showing 19 changed files with 779 additions and 471 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Please follow https://changelog.md/ conventions.

## v0.2.0

- Add the constant VERSION
- Add batch function to manage documents for one target contract

## v0.1.0

- 🎉 first release!
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Contributing Guidelines

There are many ways to contribute to CMTAT Contracts.

## Opening an issue

You can [open an issue] to suggest a feature, a difficulty you have or report a minor bug. For serious bugs in an audited version please do not open an issue, instead refer to our [security policy] for appropriate steps. See [SECURITY.md](./SECURITY.MD).

Before opening an issue, be sure to search through the existing open and closed issues, and consider posting a comment in one of those instead.

When requesting a new feature, include as many details as you can, especially around the use cases that motivate it.

## Submitting a pull request

If you would like to contribute code or documentation you may do so by forking the repository and submitting a pull request.

Run linter and tests to make sure your pull request is good before submitting it.



## Reference

Based on the version made by [OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md)
61 changes: 32 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# DocumentEngine (ERC-1643)

> This project is not audited !
> This project has not been audited yet, please use at your own risk. For any questions, please contact [[email protected]](mailto:[email protected]).
>
> If you want to use this project, perform your own verification or send an email to [[email protected]](mailto:[email protected]).
The `DocumentEngine` is an external contract to manage documents through [*ERC-1643*](https://github.com/ethereum/EIPs/issues/1643), a standard proposition to manage document on-chain. This standard is notably used by [ERC-1400](https://github.com/ethereum/eips/issues/1411) from Polymath.

Expand Down Expand Up @@ -34,13 +33,13 @@ Since this engine allows to set documents for several different smart contracts,

IERC1643

```bash
```solidity
function setDocument(bytes32 _name, string _uri, bytes32 _documentHash) external;
```

DocumentEngine

```bash
```solidity
function setDocument(address smartContract,bytes32 name_,string memory uri_, bytes32 documentHash_)
```

Expand All @@ -64,10 +63,8 @@ function setDocument(address smartContract,bytes32 name_,string memory uri_, byt

## Surya Description Report


### Contracts Description Table


| Contract | Type | Bases | | |
| :----------------: | :------------------: | :----------------------------------------------: | :------------: | :-----------: |
|| **Function Name** | **Visibility** | **Mutability** | **Modifiers** |
Expand All @@ -77,16 +74,18 @@ function setDocument(address smartContract,bytes32 name_,string memory uri_, byt
|| setDocument | Public ❗️ | 🛑 | onlyRole |
|| removeDocument | External ❗️ | 🛑 | onlyRole |
|| batchSetDocuments | External ❗️ | 🛑 | onlyRole |
|| batchSetDocuments | External ❗️ | 🛑 | onlyRole |
|| batchRemoveDocuments | External ❗️ | 🛑 | onlyRole |
|| batchRemoveDocuments | External ❗️ | 🛑 | onlyRole |
|| getDocument | External ❗️ | | NO❗️ |
|| getDocument | External ❗️ | | NO❗️ |
|| getAllDocuments | External ❗️ | | NO❗️ |
|| getAllDocuments | External ❗️ | | NO❗️ |
|| hasRole | Public ❗️ | | NO❗️ |
|| _getDocument | Internal 🔒 | | |
|| _removeDocumentName | Internal 🔒 | 🛑 | |
|| _removeDocument | Internal 🔒 | 🛑 | |
|| _setDocument | Internal 🔒 | 🛑 | |
|| hasRole | Public ❗️ | | NO❗️ |


### Legend
Expand All @@ -109,22 +108,12 @@ The toolchain includes the following components, where the versions are the late

## Tools

### Forge coverage

```bash
forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage
```



### Prettier

```bash
npx prettier --write --plugin=prettier-plugin-solidity 'src/**/*.sol'
```



### Slither

```bash
Expand All @@ -135,8 +124,6 @@ slither . --checklist --filter-paths "openzeppelin-contracts|test|CMTAT|forge-s

See [./doc/script](./doc/script)



### Foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Expand All @@ -148,58 +135,74 @@ Foundry consists of:
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

### Documentation
#### Documentation

https://book.getfoundry.sh/

### Usage
#### Usage

##### Coverage

#### Build
```bash
$ forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage
```

##### Gas report

```bash
$ forge test --gas-report
```

##### Build

```shell
$ forge build
```

#### Test
##### Test

```shell
$ forge test
```

#### Format
##### Format

```shell
$ forge fmt
```

### Gas Snapshots
##### Gas Snapshots

```shell
$ forge snapshot
```

#### Anvil
##### Anvil

```shell
$ anvil
```

#### Deploy
##### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

#### Cast
##### Cast

```shell
$ cast <subcommand>
```

#### Help
##### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```

## Intellectual property

The code is copyright (c) Capital Market and Technology Association, 2018-2024, and is released under [Mozilla Public License 2.0](https://github.com/CMTA/CMTAT/blob/master/LICENSE.md).
18 changes: 9 additions & 9 deletions doc/coverage/coverage/index-sort-b.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-08-29 13:49:12</td>
<td class="headerValue">2024-09-03 09:18:28</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">10</td>
Expand All @@ -49,9 +49,9 @@
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryHi">90.0 %</td>
<td class="headerCovTableEntry">13</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntryHi">92.9 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
Expand Down Expand Up @@ -87,11 +87,11 @@
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">39 / 39</td>
<td class="coverNumHi">48 / 48</td>
<td class="coverPerHi">90.9&nbsp;%</td>
<td class="coverNumHi">10 / 11</td>
<td class="coverPerHi">90.0&nbsp;%</td>
<td class="coverNumHi">9 / 10</td>
<td class="coverPerHi">92.9&nbsp;%</td>
<td class="coverNumHi">13 / 14</td>
</tr>
</table>
</center>
Expand Down
18 changes: 9 additions & 9 deletions doc/coverage/coverage/index-sort-f.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-08-29 13:49:12</td>
<td class="headerValue">2024-09-03 09:18:28</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">10</td>
Expand All @@ -49,9 +49,9 @@
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryHi">90.0 %</td>
<td class="headerCovTableEntry">13</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntryHi">92.9 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
Expand Down Expand Up @@ -87,11 +87,11 @@
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">39 / 39</td>
<td class="coverNumHi">48 / 48</td>
<td class="coverPerHi">90.9&nbsp;%</td>
<td class="coverNumHi">10 / 11</td>
<td class="coverPerHi">90.0&nbsp;%</td>
<td class="coverNumHi">9 / 10</td>
<td class="coverPerHi">92.9&nbsp;%</td>
<td class="coverNumHi">13 / 14</td>
</tr>
</table>
</center>
Expand Down
18 changes: 9 additions & 9 deletions doc/coverage/coverage/index-sort-l.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-08-29 13:49:12</td>
<td class="headerValue">2024-09-03 09:18:28</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">10</td>
Expand All @@ -49,9 +49,9 @@
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryHi">90.0 %</td>
<td class="headerCovTableEntry">13</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntryHi">92.9 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
Expand Down Expand Up @@ -87,11 +87,11 @@
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">39 / 39</td>
<td class="coverNumHi">48 / 48</td>
<td class="coverPerHi">90.9&nbsp;%</td>
<td class="coverNumHi">10 / 11</td>
<td class="coverPerHi">90.0&nbsp;%</td>
<td class="coverNumHi">9 / 10</td>
<td class="coverPerHi">92.9&nbsp;%</td>
<td class="coverNumHi">13 / 14</td>
</tr>
</table>
</center>
Expand Down
18 changes: 9 additions & 9 deletions doc/coverage/coverage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">39</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntry">48</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-08-29 13:49:12</td>
<td class="headerValue">2024-09-03 09:18:28</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">10</td>
Expand All @@ -49,9 +49,9 @@
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryHi">90.0 %</td>
<td class="headerCovTableEntry">13</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntryHi">92.9 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
Expand Down Expand Up @@ -87,11 +87,11 @@
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">39 / 39</td>
<td class="coverNumHi">48 / 48</td>
<td class="coverPerHi">90.9&nbsp;%</td>
<td class="coverNumHi">10 / 11</td>
<td class="coverPerHi">90.0&nbsp;%</td>
<td class="coverNumHi">9 / 10</td>
<td class="coverPerHi">92.9&nbsp;%</td>
<td class="coverNumHi">13 / 14</td>
</tr>
</table>
</center>
Expand Down
Loading

0 comments on commit 28f31a4

Please sign in to comment.