Skip to content

Commit

Permalink
Update doc and cmtat
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Apr 11, 2024
1 parent bc34d49 commit 560809d
Show file tree
Hide file tree
Showing 42 changed files with 760 additions and 266 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_modules/
broadcast/
lib/
out/
docOut/
cache/
.~lock.test.odt#
nethereum-gen.settings
Expand All @@ -12,4 +13,4 @@ artifacts/
cache_hardhat/
#drawio
*.bkp
*.dtmp
*.dtmp
55 changes: 0 additions & 55 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,5 @@

Please follow [https://changelog.md/](https://changelog.md/) conventions.

## v1.0.3 - 20231122

- Upgrade the library CMTAT to the version [v2.3.1](https://github.com/CMTA/CMTAT/releases/tag/v2.3.1)
- Use custom errors instead of revert message (gas optimization)
- Add the rule `SanctionList`
- Upgrade OpenZeppelin to the version [v5.0.0](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.0)

## v1.0.2 - 20230609

- Upgrade the library CMTAT to the vesion [v2.3.0](https://github.com/CMTA/CMTAT/releases/tag/v2.3.0)
- Set the number of runs for the optimizer to 200 for Hardhat and Foundry, see [https://docs.soliditylang.org/en/v0.8.17/using-the-compiler.html#optimizer-options](https://docs.soliditylang.org/en/v0.8.17/using-the-compiler.html#optimizer-options)

## 1.0.2-rc.0 - 20230523

The release 1.0.2 contains mainly the different fixes and improvements related to the audit performed on the version 1.0.1.

**Documentation**

- Update the documentation for the release
- Add slither report
- Install hardhat in order to generic docgen documentation

**General modifications**

- Upgrade the library CMTAT to the latest version [2.3.0-rc.0](https://github.com/CMTA/CMTAT/releases/tag/2.3-Beta) ([pull/28](https://github.com/CMTA/RuleEngine/pull/28))
- In RuleEngine, `ruleLength` is changed to `rulesCount()`
- Add the gasless suport / MetaTx module ([pull/27](https://github.com/CMTA/RuleEngine/pull/27))
- RuleWhitelist: update RuleWhitelist to use code from IEIP1404Wrapper ([pull/29](https://github.com/CMTA/RuleEngine/pull/29))

**Audit report**

This version also includes improvements suggested by the audit report, addressing the following findings:

General

- CVF-10: use a floating pragma for the version ([pull/25](https://github.com/CMTA/RuleEngine/pull/25))
- CVF2, CVF-6: remove the function kill for the contracts RuleEngine and Whitelist ([pull/17](https://github.com/CMTA/RuleEngine/pull/17))

RuleEngine

- CVF-1 / removeRule: add an additional argument with the rule index hint ([pull/23](https://github.com/CMTA/RuleEngine/pull/23))
- CVF-7, CVF-8, CVF-9: check for duplicate rule ([pull/20](https://github.com/CMTA/RuleEngine/pull/20))

Whitelist

- CVF-3: use a local variable for iterate inside a loop ([pull/18/](https://github.com/CMTA/RuleEngine/pull/18/))
- CVF-4, CVF-5: remove useless conditional statement ([pull/19/](https://github.com/CMTA/RuleEngine/pull/19/))
- CVF-15, CVF-16, CVF-17: improve readibility ([pull/24](https://github.com/CMTA/RuleEngine/pull/24))

## 1.0.1 - 20230122

- Update the library CMTAT to the version [2.2](https://github.com/CMTA/CMTAT/releases/tag/2.2)
- Update the library OpenZeppelin to the version [4.8.1](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v4.8.1)
- Improve integration test with CMTAT

## 1.0.0 - 20221114
- 🎉 first release!
62 changes: 50 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
# IncomeVault
Contracts to perform coupon payment

## Initialization
The `IncomeVault`is a prototype to perform coupon-payment dividend with a CMTAT and the snapshotModule

## Introduction

The dividends are deposited in a Vault. Once the claims are open, a token holder can then perform a claim to get his dividends for a given period.

Currently, the vault supports only dividend under the form of another ERC-20 and it is suitable for the following use-case:

- Dividends in ERC-20 compatible, which could be an ERC-20 stablecoin such as USDC or USDT for example
- Interest paid out at given intervals which shall be a configurable parameter (i.e. every 6 months, every 1 year)

For the specific case where dividends are distributed in shares, meaning additional payout of the “existing” CMTAT Token, it is not currently supported due to the following reasons:
\- With the current architecture, depending on when you decide to mint the new tokens, you will increase the total supply used to compute the token holder shares. Therefore, you will reduce the dividends distributed to the token holders.
\- In general, for yield tokens, the formula used can be different.

## Compatibility

- The dividends can be paid with ERC-20 tokens as described in the [ERC-20](https://eips.ethereum.org/EIPS/eip-20) specification
- The shares used to compute the dividends part have to be a smart contract implementing the interface `ICMTATSnapshot` as described in the CMTAT. This interface is responsible to provide information on the token holder's balance and the total supply for a specific time.

## Audits

The contracts are NOT audited, do not use them for production without auditing them !!!!

A report performed with [Slither](https://github.com/crytic/slither) is available in [doc/audits/tools](./doc/audits/tools/slither-report.md)

## Documentation

Here a summary of the main documentation

| Document | Link/Files |
| ----------------------- | ---------------------------------------- |
| Specification | [doc/specification](./doc/specification) |
| Technical documentation | [doc/technical](./doc/technical) |
| Toolchain | [doc/TOOLCHAIN.md](./doc/TOOLCHAIN.md) |
| Surya report | [doc/surya](./doc/surya/) |

## Foundry

The project is developed with [Foundry](https://book.getfoundry.sh)

### Initialization

You must first initialize the submodules, with

Expand All @@ -21,19 +61,15 @@ See also the command's [documentation](https://book.getfoundry.sh/reference/forg



## Compilation
### Compilation

The official documentation is available in the Foundry [website](https://book.getfoundry.sh/reference/forge/build-commands)

```
forge build --contracts src/RuleEngine.sol
forge build --contracts src/IncomeVault.sol
```

```
forge build --contracts src/RuleWhiteList.sol
```

## Testing
### Testing

You can run the tests with

Expand All @@ -49,7 +85,9 @@ forge test --match-contract <contract name> --match-test <function name>

See also the test framework's [official documentation](https://book.getfoundry.sh/forge/tests), and that of the [test commands](https://book.getfoundry.sh/reference/forge/test-commands).

### Coverage
#### Coverage

> Unfortunately, tests are performed with a proxy deployment and the coverage command does not work currently in this configuration
* Perform a code coverage

Expand All @@ -60,13 +98,13 @@ forge coverage --ffi
* Generate LCOV report

```
forge coverage --report lcov
forge coverage --ffi --report lcov
```

- Generate `index.html`

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

See [Solidity Coverage in VS Code with Foundry](https://mirror.xyz/devanon.eth/RrDvKPnlD-pmpuW7hQeR5wWdVjklrpOgPCOA-PJkWFU) & [Foundry forge coverage](https://www.rareskills.io/post/foundry-forge-coverage)
Loading

0 comments on commit 560809d

Please sign in to comment.