@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
Keywords
Readme
WhiteList
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
License
The-Poolz Contracts is released under the MIT License.