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

@artman325/community

v1.2.0

Published

Smart contract for managing community membership and roles

Downloads

21

Readme

CommunityContract

Smart contract for managing community membership and roles. Also has implemented NFT Interface. When role granted to user, user obtained NFT for each role. User can customize own NFT and specify ExtraURI

Deploy

Any user can create own community by call method produce of CommunityFactory contract: produce(hook, name, symbol)

Latest contract instances in test networks

20220630 Ethereum Rinkeby Testnet CommunityFactory

Binance SmartChain TestNet CommunityFactory

ABI factory abi instance abi

Overview

There are 6 predefined roles:

role name| role index --|-- relayers|1 owners|2 admins|3 members|4 alumni|5 visitors|6

Role relayers is web servers X which can register new accounts in community via invite by owners/admins or some who can manage.

Roles owners is a single role that can magage itself. means one owner can add(or remove) other owner.

Contract can be used as external storage for getting list of members.

Any user obtain NFT with tokenID = (roleid <<160)+walletaddress Any who can manage certain role can setup tokenURI for this role by calling setRoleURI.
Also any member can setup personal URI for his role by calling setExtraURI.

Full methods for each contracts can be find here Community Most usable method methods will be described below:

Methods

grantRoles

adding accounts to new roles. Can be called any role which manage roles. Revert if any roles can not be managed by sender

Params: name | type | description --|--|-- accounts|address[]| account's address
roles|uint8[]| indexes of roles

revokeRoles

removing roles from certain accounts. Can be called any role which manage roles. Revert if any roles can not be managed by sender

Params: name | type | description --|--|-- accounts|address[]| accounts's address
roles|uint8[]| indexes of roles

createRole

Creating new role. Сan called by owners

Params: name | type | description --|--|-- role|string| name of role

manageRole

allow account with byRole setup ofRole to another account with default role(members). Сan called only by owners.

Params: name | type | description --|--|-- byRole|uint8| index of source role ofRole|uint8| index of target role canGrantRole|bool| if true then byRole can grant ofRole to account, overwise - disabled canRevokeRole|bool| if true then byRole can revoke ofRole from account, overwise - disabled requireRole|uint8| target account should be in role requireRole to be able to obtain ofRole. if zero - then available to everyone maxAddresses|uint256| amount of addresses that be available to grant in duration period(bucket) if zero - then no limit duration|uint64| if zero - then no buckets. but if maxAddresses != 0 then it's real total maximum addresses available to grant

getAddresses

Returns all accounts belong to role

Params: name | type | description --|--|-- role|uint8| index of role.

getRoles

Returns all roles which member belong to

Params: name | type | description --|--|-- account|address | account's address. [optional] if not specified returned all roles

addressesCount

Returns number of all accounts belong to role

Params: name | type | description --|--|-- role|uint8| index of role.

invitePrepare

Storing signatures of invite

Params: name | type | description --|--|-- sSig|bytes|admin's signature rSig|bytes|recipient's signature

inviteAccept

Accepting admin's invite

Params: name | type | description --|--|-- p|string|admin's message which will be signed sSig|bytes|admin's signature rp|string|recipient's message which will be signed rSig|bytes|recipient's signature

inviteView

Returns tuple of invite stored at contract

Params: name | type | description --|--|-- sSig|bytes|admin's signature

Return Tuple: name | type | description --|--|-- sSig|bytes|admin's signature rSig|bytes|recipient's signature gasCost|uint256| stored gas which was spent by relayers for invitePrepare(or and inviteAccepted) reimbursed|ENUM(0,1,2)|ReimburseStatus (0-NONE,1-PENDING,2-DONE) used|bool| if true invite is already used exists|bool|if true invite is exist

Example to use

visit wiki