Skip to content

Modify token presets "mint" function as virtual to allow extending#2257

Merged
frangio merged 4 commits intoOpenZeppelin:masterfrom
EvilJordan:master
Jun 1, 2020
Merged

Modify token presets "mint" function as virtual to allow extending#2257
frangio merged 4 commits intoOpenZeppelin:masterfrom
EvilJordan:master

Conversation

@EvilJordan
Copy link
Contributor

  1. Discussion (one-sided at the time of this request) of this PR can be found here: https://forum.openzeppelin.com/t/erc721presetminterpauserautoid-mint-function-and-tokenid/2780/8

  2. The preset mint function is not override-able by parent contracts as it is not marked as virtual. Since mint is not part of the ERC721 or ERC20 standard, and the ability to user super and OZ's outstanding presets exists, why not allow for more flexibility?

@frangio
Copy link
Contributor

frangio commented Jun 1, 2020

This must have been an oversight. I believe all functions in these contracts should be virtual, like the rest of the library. @nventuro can you confirm this?

@nventuro
Copy link
Contributor

nventuro commented Jun 1, 2020

Yes, indeed. I did a quick search and it seems no other contracts have their functions missing the virtual attribute, though I did add it to some more functions in the presets.

I'd like to mention however that part of the intent behind the presets is to use them without having to modify them. If you find that you need to customize their behavior, it might be a better idea to use the preset as a basis to write your own custom code that interfaces directly with the base contracts (ERC721, ERC721Pausable, etc.).

@EvilJordan
Copy link
Contributor Author

I'd like to mention however that part of the intent behind the presets is to use them without having to modify them.

Totally, and that's what I've done in my implementation, but had thought it strange this wasn't even an option. Thanks for the attention, and great work!!

@nventuro nventuro requested a review from frangio June 1, 2020 20:00
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants