Hello everyone. Please tell me how to check the presence of a key in mapping?

Is there an opportunity to do something like:
if key not in mappingArr:

Jul 12, 2023, 5:33 PM
in solidity you need to see it in the other way
check if the the key is true or false
as check in a for loop every item on a mapping is pretty expensive
Jul 12, 2023, 6:00 PM
pretty, it never goes through for large mappings
Jul 12, 2023, 6:11 PM
Make a 2nd mapping that holds
mapping(address => bool)
Jul 12, 2023, 6:30 PM
True, you can reach a denial of service error
Jul 12, 2023, 6:55 PM

© 2024 Draquery.com All rights reserved.