How to implement whitelist to the OpenZeppelin solidity v2.1.1

I want to implement whitelist to the OpenZeppelin solidity v2.1.1. I checked inside the package, there is no whitelist solidity file. can you please clarify me

1 Like

Hey there @Thirupathi! Indeed, we’ve added WhitelistCrowdsale back in OpenZeppelin v2.1.1, but the implementation differs a bit from the pre-2.0 version. Now, there’s no Whitelist contract anymore, but we have WhitelistedRole and WhitelistAdminRole.

By inheriting from WhitelistAdminRole, the creator of the contract will get the role WhitelistAdmin. Accounts with this role can call addWhitelisted to add new accounts to the whitelist (and can also remove them from it). You can then use the onlyWhitelisted modifier or require(isWhitelisted(acc)) to mark functions that you only want people in the whitelist to be able to call.

contract MyContract is WhitelistedRole {
  function restrictedAccess() onlyWhitelisted() {
   ...
 }
}

See the code in WhitelistCrowdsale, and PRs https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1525 and https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1589 to learn more.

Why is OpenZeppelin still using WhiteList, isn't EarlyAccess a bit more appropriate?