@builtbyfrancis/flagroles

1.0.2 • Public • Published

FlagRoles

NPM Package CI MIT License

About the Project

Gas optimized and simplified version of OpenZeppelin's AccessControl for roles.

Features

  • Gas Optimised and Simplified

  • Grant and Revoke roles as the contract Owner

  • Allow a single address to simultaneously hold up to 256 roles

Installation

To install with Hardhat or Truffle:

npm install @builtbyfrancis/flagroles

API

onlyRole

modifier onlyRole(uint256 role)

Modifier to guard a function and revert if msg.sender does not have the role.

grantRole

function grantRole(uint256 role, address account) public onlyOwner

At the end of this function account will have the role(s) within role regardless of the current state.

revokeRole

function revokeRole(uint256 role, address account) public onlyOwner

At the end of this function account will NOT have the role(s) within role regardless of the current state.

hasRole

function hasRole(uint256 role, address account) public view returns (bool)

Returns true if account has the role(s) within role otherwise false

Safety

This codebase has undergone rigorous testing and includes a full suite of unit tests.

Nevertheless, this codebase is provided on an "as is" and "as available" basis.

We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

Acknowledgements

This repository is inspired by and depends on:

Package Sidebar

Install

npm i @builtbyfrancis/flagroles

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

5 kB

Total Files

4

Last publish

Collaborators

  • builtbyfrancis