I am trying to code a smart contract and I am using a mapping (address => bool) ; i make it true when a certain conditions meet. Now for another condition I want my mapping to reset and loose all of its data , i want it to be where it was in the beginning a empty mapping.

enter image description here

Problem statement : I am setting all true for whoever voted using in my Dapp using a mapping ( address => bool ) now after voting is ended i want all my mapping values to be false , is there any efficient way to solve this

Thank you in advance..


1 Answer 1


no. not really at this point in time. the only way is to iterate through the mapping, using a helper array of all the mapping's keys, and reset each value one by one to default/false


Not the answer you're looking for? Browse other questions tagged or ask your own question.