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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@arewageek/access-control

v1.1.0

Published

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a Hardhat Ignition module that deploys that contract.

Readme

Access Control

Access Control is a Solidity library for implementing role-based access control mechanisms in smart contracts. It provides a simple and effective way to manage permissions and enforce authorization through customizable roles.

Features

  • Role-based access control for Solidity contracts.
  • Default ADMIN_ROLE for managing other roles.
  • Functions to grant, revoke, and renounce roles.
  • Easy integration with other contracts.

Installation

You can install the package using your preferred package manager:

npm install arewageek/access-control
# or
bun add arewageek/access-control
# or
yarn add arewageek/access-control
# or
pnpm install arewageek/access-control

Usage

To integrate AccessControl into your contract:

import {AccessControl} from '@arewageek/access-control/contracts/AccessControl.sol';

contract Token {
    // Your contract code here
    AccessControl public ac;
}

Granting Roles

Only accounts with ADMIN_ROLE can grant roles:

ac.grant(MY_ROLE, _walletAddress);

Revoking Roles

Only accounts with ADMIN_ROLE can revoke roles:

ac.revoke(MY_ROLE, _walletAddress);

Renouncing Roles

Any account can renounce a role it holds:

ac.renounce(MY_ROLE);

Contract Details

  • ADMIN_ROLE: Default admin role with privileges to grant or revoke other roles.
  • onlyRole(bytes32 role): Modifier to restrict access to specific roles.
  • onlyAdmin: Modifier to restrict access to admin-only functions.

Key Functions

  • hasRole(bytes32 role, address account): Returns whether an account holds a given role.
  • grantRole(bytes32 role, address account): Assigns a role to an account.
  • revokeRole(bytes32 role, address account): Removes a role from an account.
  • renounceRole(bytes32 role): Allows the caller to relinquish a role.

License

This project is licensed under the MIT License.

Issues

Report bugs or request features at: https://github.com/arewageek/access-control/issues

How to Contribute

Contributions are very welcome from the community! Here's how to do that:

  • Fork the repository on GitHub.
  • Clone your fork and create a new branch:
git clone https://github.com/your-username/access-control.git
git checkout -b feature/your-feature-name
  • Make your changes, ensuring they follow the existing style and structure.
  • Write tests for your changes if applicable.
  • Run tests to verify: npx hardhat test
  • Commit your changes and push the branch: git push origin feature/your-feature-name
  • Open a Pull Request from your branch to the main branch of the original repository.