Hi, I would like to provide the ability for our customers to mint an NFT on our website. I want them to be responsible for the minting costs, rather than me.
I'm thinking that my webapp will:
verify who the customer is (via web2 traditional login means) and make sure they have not already minted their NFT
add them to the "MINTER_ROLE" of my smart contract
allow them to mint an NFT
remove them from the "MINTER_ROLE" of my smart contract
Am I thinking about this correctly? Is this the way to go about this? Is there an easier way?
I'm not asking if this is easier on other chains, or via a market place (I want to do this on my own website), or with 1155, etc. I'm asking if this is the right way to think about this if I want to do ERC-721, directly on my website, with customers self-minting (rather than me minting and then transferring to them.)
Thanks in advance for any advice!
If you expect users can only mint once, maybe you can add a flag, mapping(address => bool) hasMinted, so only when hasMinted is false, user can mint and then set hasMinted to true.
with this way, there is no need to add role and then remove role.
My advise: You can write 2 contract:
one is 721/1155 NFT contract:standard interface contract, but add MINTER_ROLE for your mint function.
another is Trading Contract: this contract will call your first contract, you can build any logic in this.
add Trading Contract address to your MINTER_ROLE.
This way you can keep your contracts simple and maintainable.
Next, let us clear your bussiness logic: You want to allow some specified users to be able to mint.
I think, You can borrow the idea of whitelisting mode. there have many topic or post to discuss this.
If you want stop/close mint for your user, Pause Trading contract using Pauseable.sol.
hope help you.
@Skyge and @night-king thank you both for your answers. Both are very useful and help me think about this from different angles. I appreciate you taking the time to help!