Package Exports
- @git-consensus/contracts
- @git-consensus/contracts/build/scripts/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@git-consensus/contracts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Git Consensus Contracts
The Git Consensus Protocol enables distributed governance for Git projects. This repository serves as the location for the Solidity contract interfaces and implementations.
Links
💡 Motivation
📖 Docs
❓ Questions
Developer Guide
This is a modern Ethereum contract repository for Solidity contracts. It combines two extremely powerful frameworks:
- Foundry - for Unit testing written in Solidity (contracts/test)
- Hardhat - for Integration testing written in Typescript (integration/)
These also offer some great tools for some advanced things like contract debugging, deployment, gas measurements, etc.
Setup
Clone the repository:
git clone https://github.com/git-consensus/contract.git && cd contracts
Install Node.js / NPM:
npm install --global npm
Install Yarn:
npm install --global yarn
Build Node dependencies (/node_modules/):
yarn install
Foundry
First run the command below to get foundryup
, the Foundry toolchain installer:
curl -L https://foundry.paradigm.xyz | bash
Then, in a new terminal session or after reloading your PATH
, run it to get
the latest forge
and cast
binaries:
foundryup
Advanced ways to use foundryup
, and other documentation, can be found in the foundryup package.
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development. It consists of:
- Forge: Library for Unit / Fuzz testing written in Solidity (see /contracts/test).
- Cast: Library for interacting with a live Ethereum JSON-RPC compatible node, or for parsing data. A swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
Need help getting started with Foundry? Read the 📖 Foundry Book
Hardhat
Hardhat is an Ethereum development environment for professionals. We use the Hardhat Network for Integration testing which written in Typescript. It uses Ethers.js and Mocha/Chai. See /integration/.
On Hardhat's website you will find:
Do Things
Finished Setup?
Run some unit tests with Forge:
forge test
Build contract artifacts and run integration tests with Hardhat:
yarn test
Deploy to Ropsten network:
Create a .env file matching the variables seen in .env.example
Getting fully prepared may involve getting a INFURA_API_KEY by signing up, and getting some test ETH on your target network via a facet.
Then run:
yarn deploy --network ropsten
Generate contract API docs:
Ensure ../docs
path exists for the docs repo. If it isn't:
git clone https://github.com/git-consensus/docs.git ../docs
or
git clone git@github.com:git-consensus/docs.git ../docs
Now you can automatically convert NatSpec comments in contracts to docs with:
yarn doc
Recommended VSCode Extensions
Style Guide
Add Solidity comments in the natspec format.
Always
yarn pretty
your before committing.Lowercase commit message (for consistency).
Embed your Ethereum address in your commit message on this repository.
Integration testing with Mocha/Chai asserts:
expect(actual).to.equal(expected)
Use same consistent pattern for import ordering.
In general, please do your best to always keep this repository beautiful! ❤️
Licensing
The code in this project is licensed under the is licensed under the GNU General Public License v3.