Skip to content

Commit

Permalink
Merge pull request #84 from GenerationSoftware/gen-1175-vault-pre-aud…
Browse files Browse the repository at this point in the history
…it-check-by-brendan

Pre-audit clean up
  • Loading branch information
trmid committed Feb 29, 2024
2 parents 606165f + 6d1b4cb commit 94b0c03
Show file tree
Hide file tree
Showing 62 changed files with 576 additions and 531 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
env:
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }}
run: forge test --gas-report --nmc IntegrationTest
run: forge test --gas-report --nmc 'Integration|Invariant|Fuzz'
id: gas

- name: Install lcov
Expand All @@ -44,7 +44,7 @@ jobs:
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }}
run: |
forge coverage --nmc IntegrationTest --report lcov && lcov --extract lcov.info -o lcov.info 'src/*'
forge coverage --nmc 'Integration|Invariant|Fuzz' --report lcov && lcov --extract lcov.info -o lcov.info 'src/*'
id: coverage

- name: Report code coverage
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint-staged && npm test
npm test
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"plugins": ["prettier"],
"rules": {
"avoid-low-level-calls": "off",
"compiler-version": ["error", "0.8.19"],
"compiler-version": ["error", "0.8.24"],
"func-visibility": "off",
"no-empty-blocks": "off",
"no-inline-assembly": "off"
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

## Overview

In PoolTogether V5 deposits are held in Vaults. Vaults are [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) compatible. Vaults are the entry point for users interacting with the PoolTogether protocol. Users deposit an underlying asset (i.e. USDC) in this contract which is then funnelled to a yield source and in exchange users receive an ERC20 token representing their share of deposits in the vault.
In PoolTogether V5 deposits are held in prize vaults. Prize vaults are [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) compatible and are the entry point for users interacting with the PoolTogether protocol. Users deposit an underlying asset (i.e. USDC) in this contract which is then funnelled to a yield source and in exchange users receive an ERC20 token representing their share of deposits in the vault.

- Balances are stored in a TWAB Controller.
- Yield is forwarded to the Liquidator to be sold.
Expand Down Expand Up @@ -93,13 +93,12 @@ npm run hint

### Tests

Test names including `SLOW` will be skipped on default test runs and need to be explicitly run.
You can run tests with the following commands:

You can run tests with:

```
forge test
```
- **unit tests:** `npm run test`
- **fuzz tests:** `npm run fuzz`
- **invariant tests:** `npm run invariant`
- **integration tests:** `npm run integration` (*informative for which integrations have potential issues*)

### CI

Expand All @@ -109,4 +108,4 @@ It will build the contracts and run the test coverage.

You can modify it here: [.github/workflows/coverage.yml](.github/workflows/coverage.yml)

For the coverage to work, you will need to setup the `MAINNET_RPC_URL` repository secret in the settings of your Github repository.
For the coverage to work, you will need to setup the relevant `{X}_RPC_URL` repository secrets in the settings of your Github repository.
5 changes: 3 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ src = 'src'
out = 'out'
test = 'test'
libs = ['lib']
solc = "0.8.19"
solc = "0.8.24"
fs_permissions = [{ access = "read", path = "./broadcast" }]
gas_reports = ["Vault", "VaultFactory"]
gas_reports = ["PrizeVault", "PrizeVaultWrapper", "PrizeVaultFactory"]
no_match_contract = "Integration"

[fuzz]
runs = 1000
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
"scripts": {
"clean": "forge clean",
"compile": "forge compile",
"coverage": "forge coverage --report lcov && lcov --extract lcov.info -o lcov.info 'src/*' && genhtml lcov.info -o coverage",
"coverage": "forge coverage --no-match-contract 'Integration|Invariant|Fuzz' --report lcov && lcov --extract lcov.info -o lcov.info 'src/*' && genhtml lcov.info -o coverage",
"format": "prettier --config .prettierrc --write \"**/*.{json,md,sol,yml}\"",
"format:file": "prettier --config .prettierrc --write",
"hint": "solhint --config \"./.solhint.json\" \"{src,test}/**/*.sol\"",
"lint-staged": "lint-staged",
"prepack": "npm run clean && npm run compile",
"prepare": "husky install",
"test": "forge test"
"test": "forge test --nmc 'Integration|Invariant|Fuzz'",
"fuzz": "forge test --mc 'Fuzz' --nmc '-'",
"invariant": "forge test --mc 'Invariant' --nmc '-'",
"integration": "forge test --mc 'Integration' --nmc '-'"
},
"devDependencies": {
"husky": "8.0.3",
Expand Down

0 comments on commit 94b0c03

Please sign in to comment.