0

Is it possible to set a minimal price through smart-contract (Solidity) when an NFT is minted?

3
  • 1
    Ethereum is Turing complete. Therefore, yes, you can set a minimum price. Sep 24 at 17:00
  • What about the technique to use? With fees upfront?
    – loi219
    Sep 24 at 22:13
  • 1
    Add 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 Man
    Sep 24 at 22:15
1

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.

1
  • Never thought of that! Thanks
    – loi219
    Sep 29 at 17:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.