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.
npm installtruffle run coveragetruffle dashboardtruffle migrate --network dashboardThe 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.
WhiteList/contracts/WhiteList.sol
Lines 33 to 36 in 7139a7f
_ChangeUntilis 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.
_Contractis 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
idreturned 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.
The Creator defines the whitelist members by specifying an array and a distribution of their amounts.
WhiteList/contracts/WhiteList.sol
Line 70 in b9e8306
AddAddress example of a transaction in a blockchain scanner.
WhiteList/contracts/WhiteList.sol
Line 87 in 98db677
RemoveAddress example of a transaction in a blockchain scanner.
Want to check if an address is whitelisted? Check function returns user allocation.
WhiteList/contracts/WhiteListHelper.sol
Line 53 in 98db677
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.
WhiteList/contracts/WhiteList.sol
Lines 99 to 103 in 98db677
The LastRoundRegister opens the possibility of disabling the scope of allocation restrictions.
WhiteList/contracts/WhiteList.sol
Lines 118 to 121 in 98db677
- Each added
_Subjectwill receive the maximum possible allocation. - Only the
Contract rolecan use this function.
WhiteList/contracts/WhiteList.sol
Line 52 in 98db677
ChangeCreator function can help us. Or we just need to update the creator role.
ChangeCreator example of a transaction in a blockchain scanner.
The-Poolz Contracts is released under the MIT License.