0

I have a mapping(bytes32=> exampleStruct) public myMapping where:

struct exampleStruct {
    address owner,
    uint256 number,
    uint256 anotherNumber
}

To optimize gas sometimes I delete struct as in:

delete myMapping[structHash];

Is this optimal to get gas refunds or should I do:

delete myMapping[structHash].owner;
delete myMapping[structHash].number;
delete myMapping[structHash].anotherNumber;
delete myMapping[structHash];

1 Answer 1

1

only use delete myMapping[structHash];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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