HQ20/contracts is a Solidity project with contracts, libraries and examples to help you build fully-featured distributed applications for the real world.
Use the package manager yarn to install dependencies.
$ yarn add @hq20/contracts
pragma solidity ^0.6.0;
import "@hq20/contracts/contracts/access/Roles.sol"
contract MyContract is Roles {
constructor() public Roles(msg.sender) {
// do something
}
}
Contracts go in contracts
, test files go in test
.
Inside the contracts folder the files are organized by topic and by type.
At the root of contracts
are directories for each one of the topics, containing the simplest implementations that are in a mature state.
For contracts that are used as example implementations there is a contracts/examples
directory with the appropriate topic folders inside.
For contracts that are under development there is a contracts/drafts
directory with the appropriate topic folders inside.
For contracts that are used for testing of libraries or internal methods there is a contracts/test
directory with the appropriate topic folders inside.
The test
directory replicates the structure of the contracts
directory.
At the time of this writing (Feb 2020
), this is the directory structure:
contracts ──┬─── access
│
├─── classifieds
│
├─── drafts ───────┬─── classifieds
│ ├─── issuance
| ├─── lists ──────────── mocks
| ├─── strings
| ├─── token
| └─── voting
│
├─── examples ─────┬─── access
│ ├─── dao
│ ├─── energy
│ └─── introspection
│
├─── exchange
├─── issuance
├─── lists
├─── state
├─── test
├─── token
└─── utils
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
As well as bug fixes, we will welcome updates to the basic contracts that make them even easier to understand, examples of contracts implementing a particular feature, or advanced contracts that put together a number of features into a complete use case.
Please make sure to update tests as appropriate.