pmk
January 9, 2022, 11:38pm
#1
Any idea what is the safe (because of gas limits) amount of addresses that can be added with this function, a for loop and an array:
function addToPresale(address[] calldata addresses) external onlyOwner {
for (uint256 i = 0; i < addresses.length; i++) {
require(addresses[i] != address(0), "Cannot add null address");
_presaleEligible[addresses[i]] = true;
_totalClaimed[addresses[i]] > 0 ? _totalClaimed[addresses[i]] : 0;
}
}
maxareo
January 10, 2022, 9:32am
#2
I've seen an array of 500 values can be passed into a function like this. Check out this contract .
pmk
January 10, 2022, 12:55pm
#3
And if you want to have, for example, a whitelist of 2000 addresses, then you would add them 500 by 500?
maxareo
January 10, 2022, 5:35pm
#4
That's what was done in that contract. They used 50+ transactions to mint 25000+ NFTs.
1 Like
pmk
January 10, 2022, 6:52pm
#5
But I don't mean minting, I mean setting addresses into an array.
maxareo
January 11, 2022, 11:38am
#6
In nature, they are the same, both using sstore
opcode to write into the blockchain storage.
1 Like
I think you should look closer to merkleTree !
This allow you to make a whitelist with no limit address and the unique thing store in blockchain is one hash !
maxareo
January 11, 2022, 3:24pm
#8
Can you elaborate on that?
I suggest you to look a this post
Introduction
Reading time: 8 min read
That can save a loooooot of money !
I have tested this and approve
1 Like