AddressWhitelist
A contract to track a whitelist of addresses.
nonReentrant()
modifier
Prevents a contract from calling itself, directly or indirectly.
Calling a nonReentrant
function from another nonReentrant
function is not supported. It is possible to prevent this from happening
by making the nonReentrant
function external, and make it call a
private
function that does the actual work.
nonReentrantView()
modifier
Designed to prevent a view-only method from being re-entered during a call to a nonReentrant()
state-changing method.
addToWhitelist(address newElement)
external
Adds an address to the whitelist.
Parameters:
-
newElement
: the new address to add.
removeFromWhitelist(address elementToRemove)
external
Removes an address from the whitelist.
Parameters:
-
elementToRemove
: the existing address to remove.
isOnWhitelist(address elementToCheck) → bool
external
Checks whether an address is on the whitelist.
Parameters:
-
elementToCheck
: the address to check.
getWhitelist() → address[] activeWhitelist
external
Gets all addresses that are currently included in the whitelist.
Note: This method skips over, but still iterates through addresses. It is possible for this call to run out of gas if a large number of addresses have been removed. To reduce the likelihood of this unlikely scenario, we can modify the implementation so that when addresses are removed, the last addresses in the array is moved to the empty index.
renounceOwnership()
public
Leaves the contract without owner. It will not be possible to call
onlyOwner
functions anymore. Can only be called by the current owner.
NOTE: Renouncing ownership will leave the contract without an owner,
thereby removing any functionality that is only available to the owner.