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

Allow to restrict minters #4

Closed
wants to merge 12 commits into from
Closed

Allow to restrict minters #4

wants to merge 12 commits into from

Conversation

Hadrienlc
Copy link

See #2

@Hadrienlc Hadrienlc linked an issue Nov 9, 2021 that may be closed by this pull request
@Hadrienlc Hadrienlc self-assigned this Nov 9, 2021
@Hadrienlc Hadrienlc marked this pull request as ready for review November 9, 2021 08:55
__MintControl_init_unchained();
}

function __MintControl_init_unchained() internal initializer {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how these init functions work, but I guess we should ensure that if there is an update, we can still keep the same state _minters and minterControlEnabled. I remember some "hacks" with a gap variable to make sure we can do updates.

Can we have some tests for that even just manual tests

Copy link
Member

@NicolasMahe NicolasMahe left a comment

Choose a reason for hiding this comment

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

  • Is it possible to initialize the smart contract with the minterControlEnabled enabled and the owner/deployer as minter? Will it create a breaking changes (is it possible to have optional function parameter in solidity?)
  • Could be nice to have a function to enable the minter control and set the owner as minter so in one transaction, the owner could turn on minter control with a basic config.

@Hadrienlc
Copy link
Author

  • Is it possible to initialize the smart contract with the minterControlEnabled enabled and the owner/deployer as minter? Will it create a breaking changes (is it possible to have optional function parameter in solidity?)

By default now, there is not minting restriction when creating the contract so it have side effects i think.
And no, it's not possible to have an optional parameter.

  • Could be nice to have a function to enable the minter control and put the owner has minter so in one transaction, the owner could turn on minter control with a basic config.

It's not really a standard way to do, since we manage a list of minters.
I vote against this one but i will follow the majority

@NicolasMahe
Copy link
Member

It's not really a standard way to do, since we manage a list of minters.
I vote against this one but i will follow the majority

I'm good with 2 transactions then.

Copy link
Member

@antho1404 antho1404 left a comment

Choose a reason for hiding this comment

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

I haven't done any manual tests, but the code seems fine. I guess that could be a good first version to publish to rarible and get their feedback as well

Comment on lines 57 to 59
function mintAndTransfer(LibERC1155LazyMint.Mint1155Data memory data, address to, uint256 _amount) public override virtual {
function mintAndTransfer(LibERC1155LazyMint.Mint1155Data memory data, address to, uint256 _amount) public override virtual validateMinter {
address minter = address(data.tokenId >> 96);
Copy link
Member

Choose a reason for hiding this comment

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

The minter is this function is not _msgSender() but address(data.tokenId >> 96).

The modifier will not work. Maybe replace the modifier by its require to give more flexibility?

Copy link
Member

Choose a reason for hiding this comment

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

I think the same issue apply to ERC721Lazy

Copy link
Member

Choose a reason for hiding this comment

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

This is related to the lazy minting process where Alice signs the NFT payload, but Bob sent it later on. In that case, Bob is the sender and mint for Alice.

In that case, who should be authorized? Bob because he's the one pushing the creation or Alice because she's the one that initially creates it? Both?

It feels more natural that Alice is the one that should be authorized and in that case yes this needs to be changed. If Bob should be the one authorized then it's valid

@NicolasMahe
Copy link
Member

NicolasMahe commented Nov 17, 2021

Closing this PR to create it on rarible repo rarible#105

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.

Mint restriction: Role-based permissions in the smart contract
3 participants