Supposed I have an enumerable map, now I want to clear it so it doesn't contain any element. What is the most gas efficient way to do that?
Solidity – How to Clear OpenZeppelin Enumerable Map
openzeppelinsolidity
openzeppelinsolidity
Supposed I have an enumerable map, now I want to clear it so it doesn't contain any element. What is the most gas efficient way to do that?
Best Answer
The
EnumerableMap
uses structSet
to store the data. To reset a struct, you can use the keyworddelete
to clear all the slots.