This is the place for smart contracts that are implementing Boson Protocol. You are invited to learn more about the project through its code and perhaps test locally how you might use it within your own project. When you are ready to integrate with Boson Protocol on a live network, you will soon be able to find the latest deployment details here, as well.
Note: the contracts are not yet deployed on Ethereum mainnet or other main networks.
For more details about how Boson Protocol works and how you might make use of it, please see the documentation site.
Table of Contents
For local development of the contracts, your development machine will need a few tools installed.
At a minimum, you'll need:
- Node (12.20)
- NPM (> 6)
- Ruby (2.7)
- Bundler (> 2)
- Git
- direnv
For instructions on how to get set up with these specific versions:
- See the OS X guide if you are on a Mac.
- See the Linux guide if you use a Linux distribution.
We have a fully automated local build process to check that your changes are good to be merged. To run the build:
./go
By default, the build process fetches all dependencies, compiles, lints, formats and tests the codebase. There are also tasks for each step. This and subsequent sections provide more details of each of the tasks.
To fetch dependencies:
./go dependencies:install
To compile the contracts:
./go contracts:compile
All contracts are thoroughly unit tested using Truffle's JavaScript testing support.
To run the unit tests:
./go tests:unit
By default, the build system automates starting and stopping Ganache on a free port in the background ready for each test run.
If instead, you want to run the tests against an existing node, Ganache or
otherwise, create a JSON file creating accounts in the same format as
config/accounts.json
and execute:
./go "tests:unit[<port>,<path-to-accounts-json>]"
We use solidity-coverage to provide test coverage reports.
To check the test coverage:
./go tests:coverage
solidity-coverage
runs its own instance of Ganache internally, as well as
instrumenting contracts before running.
To run the interaction tests, follow the instructions in the interaction tests README.md.
Both the contracts themselves and the tests are linted and formatted as part of the build process.
For the contracts, we use:
- solhint for linting
- prettier-solidity for formatting
For the tests, we use:
To lint the contracts:
./go contracts:lint
This will check if the linter is satisfied. If instead you want to attempt to automatically fix any linting issues:
./go contracts:lint_fix
To check the formatting of the contracts:
./go contracts:format
To automatically fix formatting issues:
./go contracts:format_fix
Similarly, for the tests, to perform the same tasks:
./go tests:lint
./go tests:lint_fix
./go tests:format
./go tests:format_fix
For an overview of the contracts and their responsibilities, see
Overview.
The whitepaper is available through the project's website.
We welcome contributions! Until now, Boson Protocol has been largely worked on by a small dedicated team. However, the ultimate goal is for all of the Boson Protocol repositories to be fully owned by the community and contributors. Issues, pull requests, suggestions, and any sort of involvement are more than welcome.
If you have noticed a bug, file an issue. If you have a large pull request, we recommend filing an issue first; small PRs are always welcome.
Questions are also welcome, as long as they are tech related. We can use them to improve our documentation.
All PRs must pass all tests before being merged.
By being in this community, you agree to the Code of Conduct. Take a look at it, if you haven't already.
Licensed under LGPL v3.