Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Mintable, RBACMintable and Burnable ERC721 tokens #957

Conversation

vittominacori
Copy link
Contributor

🚀 Description

This add Mintable, RBACMintable and Burnable tokens to the ERC721 token lists.

Features:

  • Added BurnableERC721Token

    • Only token owner can burn his own token
  • Added MintableERC721Token

    • Only contract owner can mint new tokens
    • Only contract owner can call the finishMinting function
  • Added RBACMintableERC721Token

    • Only address with minter role can mint new tokens
    • Only owner can add/remove minter
    • All the MintableERC721Token stuffs
  • 📘 I've reviewed the OpenZeppelin Contributor Guidelines

  • ✅ I've added tests where applicable to test my new functionality.

  • 📖 I've made sure that my contracts are well-documented.

  • 🎨 I've run the JS/Solidity linters and fixed any issues (npm run lint:all:fix).

@shrugs
Copy link
Contributor

shrugs commented Jun 4, 2018

@vittominacori how do you think these two PRs should be combined?

#950


// solium-disable-next-line max-len
contract SimpleERC721Token is ERC721Token, MintableERC721Token, BurnableERC721Token {
constructor(string name, string symbol) public
Copy link
Contributor

@shrugs shrugs Jun 4, 2018

Choose a reason for hiding this comment

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

nitpick: formatting should look like

constructor(string _name, string _symbol)
  ERC721Token(_name, _symbol)
  public
{
}

Choose a reason for hiding this comment

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

I think so.

@vittominacori
Copy link
Contributor Author

vittominacori commented Jun 5, 2018

@shrugs

Regarding my code, I just wanted to replicate what I've already done with ERC20 RBACMintableToken.
So make the token able to be mint by more than an "owner".
And to do so I created MintableERC721Token.sol, RBACMintableERC721Token.sol and the behaviours to test them.

Your code is a little different, you allow the ERC721Minter to mint new tokens by validating signature.

About your code:

I think RBACOwnable should have only an owner and it is unuseful as the removed RBACWithAdmin contract. What's the difference between these 2 contracts and why one is being removed and the other should be created? In addition using the onlyOwner modifier to check Role can be confusing or maybe have conflict if people also extends from Ownable.

Also RBACMintable is more specific than expected. I mean why we should include all the possibile cases in the RBAC implementation and not only when requested? So I prefer to have the onlyMinter implementation in Token because of there are no other cases when the RBACMintable can be used so, for me, make no sense to have it into the RBAC folder.

PRs could be merged but, guy, you are the reviewer so feel free to ask for changes in my code if it sounds repetitive or unuseful.

@shrugs
Copy link
Contributor

shrugs commented Jun 6, 2018

I'd very much like to include your contribution in OZ!

The reason we have MintableToken and RBACMintableToken is primarily for backwards compatibility; RBAC allows for either 1 or many addresses with a permission, so it pretty much covers the primary use-case of Ownable. I'm not sure we'd need both MintableERC721Token and RBACMintableERC721Token, since RBACMintableERC721Token just as useful.

If you agree with that, we can rename RBACMintableERC721Token to MintableERC721Token and then I can work on rebasing #950 on top of this one.

re: RBACMintable I think it's good to keep the definition of roles and their access logic within //access. I don't mind the implementation of that logic being deferred to the implementer (like it is in https://github.com/OpenZeppelin/openzeppelin-solidity/pull/950/files#diff-9404d7caf069d2c48bf2e2867b83ea7fR37 ) because someone may have a different implementation need.

RBACWithAdmin is super powerful, so we've removed it from the main contracts; it was designed to be an example, regardless: #936

@vittominacori
Copy link
Contributor Author

vittominacori commented Jun 6, 2018

Ok I agree to rename RBAC into Mintable.
Everyone will be enforced to add a minter role after the token creation.
The ability to mint like an ownable token is being removed.

If you prefer also to have RBACMintable into access feel free to keep it. I wouldn't imagine that this will open the road to a lot of RBAC[Something] contracts into //access.

Thanks.

@shrugs
Copy link
Contributor

shrugs commented Jun 6, 2018

The owner of a mintable token will be automatically set as the deployer because of the constructor in RBACOwnable, so I think it's ok for us not to automatically set the owner as the minter as well (although it would be good to mention that in the comments).

Let me know if you think it'd be easier to rebase this branch on #950 or #950 on this branch.

@vittominacori
Copy link
Contributor Author

I think it could be better to merge #950 here.
Keep MintableERC721 from my code, then rename and add the RBACMintableERC721 stuffs and then add your changes.

The others files should not have conflicts.

Take a look to the added test behaviours and adapt to your token and minter contracts.

@canhlinh
Copy link

Awasome. I very much appreciate if you guys continue working to finish this this PR.

@shrugs
Copy link
Contributor

shrugs commented Jun 15, 2018

hey @vittominacori any update on your end? If you're unavailable, I can spend time this weekend and merge our PRs together. You'll still be the author of the original commits :)

@vittominacori
Copy link
Contributor Author

Hi @shrugs I'm really busy these days. So it could be better if you can start merging PRs.
Don't worry about authorship :)

Feel free to ask for changes, I will try to work on when I can.

@shrugs shrugs mentioned this pull request Jun 16, 2018
4 tasks
@shrugs shrugs mentioned this pull request Sep 4, 2018
1 task
@shrugs
Copy link
Contributor

shrugs commented Sep 4, 2018

closing in favor of work on #1273, since this will need to use the new roles refactor branch.

@shrugs shrugs closed this Sep 4, 2018
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