Enter hundreds of addresses per parameter

Hello people

On a project I’m working on they want to manually enter hundreds of addresses into a whitelist contract.

What would be the best way to do this barbarity?

Putting an array by parameter would be very expensive in gas to check if the addrees exists. I think it has to be stored in a mapping, but if I do that I’ll have to register each addrees one by one. no?

maybe you can make a function in the smart contract that registers 1k addresses and call that function multiple times

you mean hardcode the addresses in the contract?

like address private ['address1','address2', ...] and create a function that registers this array in a mapping?

What I’m saying doesn’t seem to make much sense. The only thing that occurs to me is to put a huge array per parameter and have it register until it is finished

I mean to have a mapping in the contract and to add those addresses to the mapping with function calls after that

add one by one in the mapping with a function.
is that what you mean?

yes, but calling a function that does that for a big list so that you don’t have to call that function hundreds of times

would you put the list of addresses in the contract?

No, only to send a list of addresses to a function

1 Like

I will do some experiment and I will share it with you so that you can give me your opinion if you wish.
Thank you for your attention and quick answers.