Is it possible to set a minimal price through smart-contract (Solidity) when an NFT is minted?
-
1Ethereum is Turing complete. Therefore, yes, you can set a minimum price.– Paul Razvan BergCommented Sep 24, 2021 at 17:00
-
What about the technique to use? With fees upfront?– loi219Commented Sep 24, 2021 at 22:13
-
1Add a requirement to the mint method. If you payment is in ether, the requirement would be on msg.value. If it's an erc20 token, it gets slightly more complicated, but fundamentally the same. And yes, abstractly speaking, "fees upfront".– Sloth ManCommented Sep 24, 2021 at 22:15
Add a comment
|
1 Answer
Yes you can
One way to do it would be to override the mint function or create your own function to create an NFT.
function create(uint256 id_) external payable {
require(msg.value == mintingFees, 'No fees provided');
_safeMint(msg.sender,id_);
}
The override statement will prevent the call from going to original erc721 mint function and use your function instead. So to keep the original logic you can call the mint internally from another function
Inside your function you would require a msg.value or a transferFrom to be executed depending on your asset's.