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

@poolzfinance/whitelist

v1.0.0

Published

[![Build Status](https://travis-ci.com/The-Poolz/WhiteList.svg?branch=master)](https://travis-ci.com/The-Poolz/WhiteList) [![codecov](https://codecov.io/gh/The-Poolz/WhiteList/branch/master/graph/badge.svg?token=lCJvViiyQc)](https://codecov.io/gh/The-Poo

Downloads

2

Readme

WhiteList

Build Status codecov CodeFactor

WhiteList is a smart contract that creates a mechanism to explicitly allow certain identified addresses to access a certain privilege. This is the opposite of a blacklist, which is a list of prohibited things when everything is allowed by default.

Navigation

Installation

npm install

Testing

truffle run coverage

Deployment

truffle dashboard
truffle migrate --network dashboard

How's it work?

The WhiteList contract provides the ability to create an unlimited number of whitelists, the CreateManualWhiteList function is responsible for this. The address that created the whitelist automatically receives the Creator role. https://github.com/The-Poolz/WhiteList/blob/7139a7f92b11629fa28b8e98c3ebada1f89f226e/contracts/WhiteList.sol#L33-L36

  • _ChangeUntil is specifies the time during which the whitelist is active. After its expiration, interaction with the current whitelist will be impossible!
  • By default, the added address (User) in the whitelist has a certain allocation value._Contract is address that is allowed to shorten the allocation in the whitelist. This opens up the possibility of interacting with other smart contracts, allowing them to change the distribution. Whitelist interface for using third-party smart contracts.
  • Each whitelist has a unique id returned when it is created, which can be used to determine its uniqueness.

NOTICE: Contract role can be passed to a normal user address. The input address will be able to use the Register and LastRoundRegister functions.

CreateManualWhiteList example of a transaction in a blockchain scanner.

Add address to whitelist

The Creator defines the whitelist members by specifying an array and a distribution of their amounts. https://github.com/The-Poolz/WhiteList/blob/b9e8306c169e6759a7a5e1f1d2fec9133c445156/contracts/WhiteList.sol#L70 Each added address will be automatically added to the whitelist in the presence of an allocation.

AddAddress example of a transaction in a blockchain scanner.

Remove address from whitelist

https://github.com/The-Poolz/WhiteList/blob/98db67799fcb2363c7361a383204f0c29704e4ed/contracts/WhiteList.sol#L87 Each removable address will receive a zero allocation value in the whitelist.

RemoveAddress example of a transaction in a blockchain scanner.

Check address allocation

Want to check if an address is whitelisted? Check function returns user allocation. https://github.com/The-Poolz/WhiteList/blob/98db67799fcb2363c7361a383204f0c29704e4ed/contracts/WhiteListHelper.sol#L53

User registration

There are two ways to reduce the allocation of Subject by a certain value: the first is to use the AddAddress function, the second is the Register function. The main difference between them is that Register can only use the Contract role. https://github.com/The-Poolz/WhiteList/blob/98db67799fcb2363c7361a383204f0c29704e4ed/contracts/WhiteList.sol#L99-L103

Last round register

The LastRoundRegister opens the possibility of disabling the scope of allocation restrictions. https://github.com/The-Poolz/WhiteList/blob/98db67799fcb2363c7361a383204f0c29704e4ed/contracts/WhiteList.sol#L118-L121

  • Each added _Subject will receive the maximum possible allocation.
  • Only the Contract role can use this function.

Change creator

https://github.com/The-Poolz/WhiteList/blob/98db67799fcb2363c7361a383204f0c29704e4ed/contracts/WhiteList.sol#L52 In situations where the contract creates a whitelist and it is necessary to transfer the creator's right to a specific address, the ChangeCreator function can help us. Or we just need to update the creator role.

ChangeCreator example of a transaction in a blockchain scanner.

Contract diagram

classDiagram

License

The-Poolz Contracts is released under the MIT License.