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

@intercoin/voting

v1.0.1

Published

Smart contract for facilitating voting and polling

Downloads

3

Readme

#f03c15 README.MD is out of date.

VotingContract

Smart contract for facilitating voting and polling

Installation

Node

npm install @openzeppelin/contracts-ethereum-package

Deploy

when deploy it is need to pass parameters in to init method Params: name | type | description --|--|-- InitSettings|tuple| see InitSettings contractAddress|address|contract's address which will call after user vote. contract nede to implement method with params: ((string,uint256)[],uint256). (tuples of tag:value, user weight) communityAddress|address|address of community contract communitySettings|tuple[]| see CommunitySettings

Overview

once installed will be use methods:

Methods

wasEligible

Checking if the user was eligible in blockNumber block

Params: name | type | description --|--|-- addr|address|user's address blockNumber|uint256|Block number

vote

user can vote if he hasn't vote before and he has was eligible in blockNumber block

Params: name | type | description --|--|-- blockNumber|uint256|Block number voterData|array of tuples| see voterData

getVoterInfo

Return voter info. tuple of voter Params: name | type | description --|--|-- addr|address|user's address

setWeight

[TBD] setup weight for community role Params: name | type | description --|--|-- role|string|role name weight|uint256|weight value

getVoters

return all addresses which already voted

Tuples

InitSettings

name | type | description --|--|-- voteTitle|string|Vote title blockNumberStart|uint256|vote will start from blockNumberStart blockNumberEnd|uint256|vote will end at blockNumberEnd voteWindowBlocks|uint256|period in blocks then we check eligible

CommunitySettings

name | type | description --|--|-- communityRole|string|community role of participants which allowance to vote communityFraction|uint256|fraction (percents mul by 1e6). setup if minimum/memberCount too low communityMinimum|uint256|community minimum

voterData

name | type | description --|--|-- name|string| string value|uint256| uint256

voter

name | type | description --|--|-- contractAddress|address| contract address contractMethodName|string| contract method name voterData|tuple| see voterData alreadyVoted|bool| true if voter is already voted

Lifecycle of Vote

  • deploy( or got) contract which method vote we will be call from voting contract. for example <address contract1>

  • got contract of Community and roles name. for example <address community> and role "members"

  • creation VotingContract and call init method with params

    • initSettings = ["My First Vote",11105165,11155165,100] ([<voteTitle>, <blockNumberStart>, <blockNumberEnd>, <voteWindowBlocks>])
    • contractAddress = <address contract1>
    • communityAddress = <address community>
    • communitySettings = [['members',150000,20]] ([<communityRole>, <communityFraction>, <communityMinimum>])
  • now any user which contain in contract community with role 'members' can vote in period from blockNumberStart to blockNumberEnd if was eligible in blockNumber block calling vote with Params

    • blockNumber = 11105222
    • methodName = 'vote'
    • voterData = [["orange",12],["blackberry",34],["lemon",56]]
  • each successful vote will call method vote(tuple(name,value)[], weight) of <address contract1>. [TBD] weight = 1 unless owner will set new value for role calling setWeight