Skip to content

Commit

Permalink
Merge branch 'main' into reserve-range-CEI
Browse files Browse the repository at this point in the history
  • Loading branch information
zajck committed Jun 7, 2023
2 parents 0c44417 + 66225eb commit 00dfcd6
Show file tree
Hide file tree
Showing 186 changed files with 20,731 additions and 32,438 deletions.
94 changes: 60 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,52 @@ on:
types: [opened, reopened, synchronize, ready_for_review]

jobs:
build:
setup:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
name: build
outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
name: setup
outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }}
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
- name: Setup node
uses: actions/setup-node@v3.5.1
with:
node-version: "16.14.x"
node-version: 16.14.x
cache: "npm"
- run: npm install
- name: Prepare Environment
shell: bash
run: |
cp .env.example .env
- run: npm run build
- run: npm run check:contracts
- run: npm run check:scripts
- name: Lint
run: |
npm run check:contracts
npm run check:scripts
- name: Verify interface ids
run: npm run natspec-interface-id
- id: set-test-chunks
run: echo "test-chunks=$(cat test/util/test-chunks.txt | jq -cM '.')" >> $GITHUB_OUTPUT
name: Set Chunks
run: echo "test-chunks=$(jq -c '.' test/util/test-chunks.txt)" >> $GITHUB_OUTPUT
- id: set-test-chunk-ids
name: Set Chunk IDs
run: |
echo "CHUNNKS"
echo $CHUNKS
echo "test-chunk-ids=$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')" >> $GITHUB_OUTPUT
echo "test-chunk-ids=$( echo $CHUNKS | jq -cM 'to_entries | map(.key)')" >> $GITHUB_OUTPUT
env:
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test:
needs: build
needs: setup
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
env:
GAS_REPORTER_COINMARKETCAP_API_KEY: ${{ secrets.COINMARKETCAP_API_KEY }}
name: test (chunk ${{ matrix.chunk }})
strategy:
matrix:
chunk: ${{ fromJson(needs.build.outputs['test-chunk-ids']) }}
chunk: ${{ fromJson(needs.setup.outputs['test-chunk-ids']) }}
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
Expand All @@ -72,13 +72,13 @@ jobs:
run: npm run build
- name: Contract Sizing
run: npm run size
- name: Unit Tests
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs npx hardhat test
- name: Unit Tests
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs npx hardhat test
env:
CHUNKS: ${{ needs.build.outputs['test-chunks'] }}
CHUNKS: ${{ needs.setup.outputs['test-chunks'] }}

integration-test:
needs: build
needs: setup
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
env:
Expand All @@ -91,7 +91,7 @@ jobs:
uses: actions/setup-node@v3.5.1
with:
node-version: 16.14.x
cache: 'npm'
cache: "npm"
- name: Install Dependencies
run: npm install
- name: Prepare Environment
Expand All @@ -102,12 +102,12 @@ jobs:
run: npx hardhat test test/integration/*.js

coverage:
needs: build
runs-on: ubuntu-latest
needs: setup
if: ${{ !github.event.pull_request.draft }}
env:
GAS_REPORTER_COINMARKETCAP_API_KEY: ${{ secrets.COINMARKETCAP_API_KEY }}
name: code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
Expand All @@ -122,8 +122,6 @@ jobs:
shell: bash
run: |
cp .env.example .env
- name: Compile Contracts
run: npm run build
- name: Code coverage
run: npm run coverage
- name: Upload code coverage results
Expand All @@ -141,8 +139,38 @@ jobs:
if (( $(echo "$SKIPPED > $MAX_SKIPPED" | bc -l) )); then echo "Fail: number of skipped statements '$SKIPPED' is higher than configured '$MAX_SKIPPED'" >&2; exit 1; fi
echo "Number of skipped statements '$SKIPPED' is within configured '$MAX_SKIPPED'"
report-coverage:
needs: coverage
runs-on: ubuntu-latest
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
name: "report: coverage"
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0

- name: Setup node
uses: actions/setup-node@v3.5.1
with:
node-version: 16.14.x
cache: "npm"

- name: npm install
run: npm install

- name: Download code coverage results
uses: actions/download-artifact@v3
with:
name: code-coverage-report
path: coverage/
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info

deploy-dry-run:
needs: build
needs: setup
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
name: "deploy: dry run"
Expand All @@ -165,37 +193,35 @@ jobs:
- name: Cancelling tests in case of failure
if: failure()
uses: andymckay/cancel-action@0.2

analyze:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
- name: Setup node
uses: actions/setup-node@v3.5.1
with:
node-version: 16.14.x
cache: 'npm'
cache: "npm"
- name: Install Dependencies
run: npm install
- name: Prepare Environment
shell: bash
run: |
cp .env.example .env
- name: Slither analyzer
uses: crytic/slither-action@v0.2.0
uses: crytic/slither-action@v0.3.0
id: slither
with:
node-version: 16
sarif: results.sarif
fail-on: none
slither-version: dev-workaround-action-48
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.slither.outputs.sarif }}


4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

find . -name '*.js' -not -path '*/node_modules/*' | xargs git diff --cached --name-only | xargs -r npx eslint --fix
find . -name '*.js' -not -path '*/node_modules/*' | xargs git diff --cached --name-only | xargs -r npx prettier --write
git diff --cached --name-only | grep contracts -e *.txt | xargs -r npx solhint --fix
git diff --cached --name-only | grep contracts -e *.txt | xargs -r npx prettier --write
git diff --cached --name-only | grep -e contracts -e *.txt | xargs -r npx solhint --fix
git diff --cached --name-only | grep -e contracts -e *.txt | xargs -r npx prettier --write
npm run natspec-interface-id:fix
2 changes: 1 addition & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ module.exports = {
grep: "@skip-on-coverage", // Find everything with this tag
invert: true, // Run the grep's inverse set.
},
istanbulReporter: ["html", "json-summary"],
istanbulReporter: ["html", "json-summary", "lcov"],
};
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"max-line-length": "off",
"compiler-version": [
"error",
"0.8.9"
"0.8.18"
],
"func-name-mixedcase": "off",
"not-rely-on-time": "off",
Expand Down
54 changes: 29 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,41 @@

<h1 align="center">Boson Protocol V2</h1>

### Intro | [Audits](docs/audits.md) | [Setup](docs/setup.md) | [Tasks](docs/tasks.md) | [Architecture](docs/architecture.md) | [Domain Model](docs/domain.md) | [State Machines](docs/state-machines.md) | [Sequences](docs/sequences.md)
[![Coverage Status](https://coveralls.io/repos/github/bosonprotocol/boson-protocol-contracts/badge.svg)](https://coveralls.io/github/bosonprotocol/boson-protocol-contracts)

### Intro | [Audits](docs/audits.md) | [Setup](docs/setup.md) | [Tasks](docs/tasks.md) | [Architecture](docs/architecture.md) | [Domain Model](docs/domain.md) | [State Machines](docs/state-machines.md) | [Sequences](docs/sequences.md)

## Status

Done or in progress are:

- ✅ Developer environment configuration
- ✅ Developer setup and tasks documentation
- ✅ Role-based access controller contract, with tests
- ✅ High level architecture documentation
- ✅ Proxied voucher contract
- ✅ Protocol Diamond contract, libs, and facets, with tests
- ✅ Shared domain model for contracts (minimal)
- ✅ Domain model expressed in JS, with tests
- ✅ Shared script modules for use in deployment and testing
- ✅ Github Actions for CI
- ✅ Support for EIP-712 meta-transactions
- ✅ Protocol facet contracts and interfaces
- ✅ Remediated audits
- ✅ Generated contract documentation
- ✅ Developer environment configuration
- ✅ Developer setup and tasks documentation
- ✅ Role-based access controller contract, with tests
- ✅ High level architecture documentation
- ✅ Proxied voucher contract
- ✅ Protocol Diamond contract, libs, and facets, with tests
- ✅ Shared domain model for contracts (minimal)
- ✅ Domain model expressed in JS, with tests
- ✅ Shared script modules for use in deployment and testing
- ✅ Github Actions for CI
- ✅ Support for EIP-712 meta-transactions
- ✅ Protocol facet contracts and interfaces
- ✅ Remediated audits
- ✅ Generated contract documentation

## Developers
- [Audits](docs/audits.md) - See the results of our latest security audits
- [Setup](docs/setup.md) - Get going quickly on your local system
- [Tasks](docs/tasks.md) - Build, test, analyse, and deploy
- [Architecture](docs/architecture.md) - Start with the big picture
- [Domain Model](docs/domain.md) - Entities and their relationships
- [State Machines](docs/state-machines.md) - State Machines in the Core Exchange Mechanism
- [Sequences](docs/sequences.md) - Timeline of the simplest exchange
- [Examples](docs/examples.md) - Enhancing the capabilities of the protocol with external contracts
- [Contributing](#contributing) - Guidelines for contributing to this repo
- [License](#license) - License information

- [Audits](docs/audits.md) - See the results of our latest security audits
- [Setup](docs/setup.md) - Get going quickly on your local system
- [Tasks](docs/tasks.md) - Build, test, analyse, and deploy
- [Architecture](docs/architecture.md) - Start with the big picture
- [Domain Model](docs/domain.md) - Entities and their relationships
- [State Machines](docs/state-machines.md) - State Machines in the Core Exchange Mechanism
- [Sequences](docs/sequences.md) - Timeline of the simplest exchange
- [Examples](docs/examples.md) - Enhancing the capabilities of the protocol with external contracts
- [Contributing](#contributing) - Guidelines for contributing to this repo
- [License](#license) - License information

## Contributing

Expand Down
Loading

0 comments on commit 00dfcd6

Please sign in to comment.