I have a which tracks ids for some structs for different users.

mapping (address => uint[]) usersStuff

This mapping for each user can grow or shrink.

If it happens to shrink to 0 for a single user (i.e. with delete usersStuff[msg.sender] ) but the actual variable hasn't been deleted because usersStuff has data for other users, is there a gas refund?


Yes, deleting a mapping entry results in a gas refund.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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