Ethereum Asked on November 10, 2021
if you have a mapping like:
mapping (uint => bool) owned;
How would you go through and update 1000 items in that mapping to set them all to true
?
Without using a loop due to gas prices.
Is there a way to do this?
Is there another way with another structure besides maps? Arrays? mapping to a struct?
An example might be – I want to set items 500 – 1,500 to true and the rest are false. How would you achieve this?
edit: a good example would be batch minting ERC-721 tokens. How would you create 1000, or 20k tokens? You obviously can’t do a loop to update the owner mapping.
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP