Bundle ERC721 extensions into base contract #2149
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #2086.
The goal behind this initiative is to have all optional extensions for tokens baked into the base implementation (that is, for
ERC20
to includeERC20Detailed
, andERC721
to include bothERC721Metadata
andERC721Enumerable
). These optional extensions were often (always?) used along the base implementation, and the changes in Solidity around inheritance mean that forcing our users to use multiple inheritance create unnecessary friction.As a side effect, we should be able to use the newly added
EnumerableSet
and the proposals aroundEnumerableMap
(#2072) to improve code readability, gas efficiency and overall security.Because the tokens are some of the library's biggest contracts, these changes are not trivial. I thought it best to approach this in a step-by-step manner, by:
This PR contains just the first step of the three described above. To make reviewing easier, I split the changes to the contracts code in different commits. The tests refactor is unfortunately hard to review, though I am confident it was performed correctly (I copy-pasted the tests from ERC721.behavior and ERC721Full.test into ERC721.test).