How to add a lot of whitelist addresses (2.20)?

Many thanks to OpenZeppelin dev team for their assistance.

There is only one small question yet to decide)

In version 2.1+, the addManyToWhitelist function has been removed. With the emergence of Roles, the addWhitelisted function was added with only one address.
How do I add an extensive list of addresses? Call each time this function for a specific address?
Thx!

1 Like

@BitUser

The options to add multiple addresses to the whitelist are:

  1. Call addWhitelisted for each address, or

  2. Create a function in your contract (like the previous addAddressesToWhitelist) that accepts an array of addresses and calls addWhitelisted for each address.
    Then you call this new function passing in an array of addresses to add to the whitelist.

Your new function might look something like the following:

function addWhitelisted(address[] memory accounts)
    public
    onlyWhitelistAdmin
{
    for (uint256 account = 0; account < accounts.length; account++) {
        addWhitelisted(accounts[account]);
    }
}
2 Likes

how to fill input in when addWhitelisted call it , show single in put
Screenshot 2022-01-17 at 3.46.35 PM
what the format of adding multiple address