-
Notifications
You must be signed in to change notification settings - Fork 238
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
Minter Access Control #105
Minter Access Control #105
Conversation
Thank you! |
Nice one! |
Nice one @NicolasMahe! |
@evgenynacu Would this PR be in conflict with the fix we're deploying to restrict minting with private |
came here to ask the same question! any input would be much appreciated! current private createtoken is a great start thanks for that. This would give more flexibility on top of it ideally. |
Hey guys Sorry for the delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
sorry for the long wait, here are some comments
feel free to ask any questions, gonna answer faster this time :)
Implement feedback on Mint Access Control
Comments implemented 👍 The state variable |
Hi @NicolasMahe, I leave some comments, not critical, I hope You are agree. Together we`ll try to generate this code better))) |
Feedbacks implemented 👍 One conversation open for more modification. |
__MinterAccessControl_init_unchained(); | ||
} | ||
|
||
function version() public view returns (uint256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For version identification we use smth like that:
bytes4 constant public V2 = bytes4(keccak256("V2"));
You can see it: exchange-v2/contracts/LibOrderDataV2.sol
So may You use this constant in test?
I think there is no error here, but probably we should use the same approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated: af18208
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You for your work, I`ll review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SKonstantinS waiting for your review ;)
merged into https://github.com/rarible/protocol-contracts/tree/RPC-132-minter-role branch for now, gonna merge into master soon, thanks! |
@NicolasMahe merged into master too |
@disenotov Question on Minter Access control: can you enable this after a contract has been deployed with isPrivate=false? It appears it is enabled by the isPrivate boolean, but I don't see an "enable" function to change the setting via any of the ABI's. What is the name of the function to enable it? I can access the MinterAccessControl functions (isMinter, addMinter etc). |
@bobwith2bees Hello! do you want to switch isPrivate from false to true? if so, then it's not possible. We designed it so public collections can't become private or vice versa. |
@disenotov That's what I needed to know. Thanks for the clarification. |
Hey guys,
This PR is the implementation of suggestions from the discussion of my business partner: rarible/protocol#11 and is the phase 2 of the proposal https://gov.rarible.org/t/proposal-to-optionally-restrict-the-mint-of-tokens/182.
This PR adds a new smart contract,
MinterAccessControl
, to restrict who can mint tokens.The state variable
_minters
contains the addresses that are authorized to mint.Functions
grantMinter
andrevokeMinter
add or remove an address to/from the authorized minter list. Only the smart contract's owner can execute these functions.The state variable
minterAccessControlEnabled
controls the restriction of mint.false
by default not to create breaking change.Functions
enableMinterAccessControl
anddisableMinterAccessControl
enable and disable the restriction of mint. Only the smart contract's owner can execute these functions.Finally, the function
isValidMinter
asserts if the minter is authorized only if the mint restriction is enabled. Return true for any minter if the mint restriction is disabled.This function is called in the
mintAndTransfer
function of the contractsERC721LazyMinimal
andERC721Lazy
using the minter encoded in thetokenId
.The
MinterAccessControl
restriction is disabled by default the prevent breaking change. The contract owner has to callenableMinterAccessControl
and add the minter's address withgrantMinter
function.