Open sillytuna opened 2 years ago
O.O
This may require a major version bump, cuz the upgradeable repo requires the storage slots to stay the same.
Understand about the storage slot situ.
I've got another optimisation I need to experiment with which may make this less important (tho it'll still save gas). Will check tomorrow. It would also affect storage slots though.
_packedOwnership
access was performing asha3
op for every new index but as these are consecutive they can be stored as a regular array offset from a base storage location irrespective of the start token id. Only onesha3
is required instead of one per index used. Solidity effectively uses this technique for its arrays but also stores array length, which we don't need to do.Optimised
_packedOwnershipOf
accordingly.Pros Reduces gas usage slightly in common functions but more significantly in bulk transfers (figures below).
Cons 22,772 additional deployment cost Code readability
New
Previous