npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hq20/contracts

v0.0.6

Published

A set of reusable smart contracts from HQ20

Downloads

15

Readme

HQ20/contracts is a Solidity project with contracts, libraries and examples to help you build fully-featured distributed applications for the real world.

Disclaimer: The contracts are expected to be used as smart contract patterns for you to draw inspiration from, and for them to be easy to understand they have been kept deliberately simple. If you decide to reuse the contracts, or to copy and paste code in them, make sure that you look for and close the vulnerabilities. If you plan to go to the mainnet, please get a third party audit done.

In a Nutshell

At the time of this writing (May 2020), this are the contents of this repository:

contracts ──┬─── access        - Access Control Contracts, some of them built on top of `AccessControl.sol`
            ├─── classifieds   - Example of a decentralized classifieds market for ERC721
            ├─── dao           - Example of building a decentralized venture capital fund
            ├─── energy        - Example of building a decentralized market for energy distribution
            ├─── exchange      - The Uniswap decentralized market contracts, with solidity tests
            ├─── introspection - Example of using ERC165 to verify contract types before casting
            ├─── issuance      - Example of an ICO, can be used as well for share issuances
            ├─── lists         - Reusable implementations of different types of linked lists
            ├─── math          - Reusable implementation of a lightweight fixed point math library
            ├─── state         - Reusable implementation of a fully-featured state machine
            ├─── token         - Token implementations, including a reusable dividend-bearing ERC20
            ├─── utils         - Reusable library to cast between `uint` and `int`.
            └─── voting        - Example implementations of token-based and address-based votings

Installation

Use the package manager yarn to install dependencies.

$ yarn add @hq20/contracts

Usage

pragma solidity ^0.6.0;
import "@hq20/contracts/contracts/access/Roles.sol"


contract MyContract is Roles {
	constructor() public Roles(msg.sender) {
		// do something
	}
}

Directories

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 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.

Contributing

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.

License

Apache-2.0