I used the smart contract wizard to bootstrap my own contract and had a few basic beginner questions, mainly concerning (fixed) pricing patterns, not some kind of bonding curve scenario.
I've seen approaches where the price is just a fixed public variable like: uint256 public constant PRICE = 123450000000000000;
and since it's a constant, obviously is immutable. I've also seen an approach that allows updating the price by the owner like:
uint256 private _price = 0.12345 ether;
function setPrice(uint256 _newPrice) public onlyOwner() {
_price = _newPrice;
}
-
Is it bad practice to allow price updating? I know you'll have to pay gas to do so, but is this frowned upon?
-
Is it preferable to use the default
wei
unit and not explicitly declare the unit asether
? If you leave it asether
, when you callsetPrice
the value of the argument should be inether
? -
When using the contract wizard I did not select Burnable because I don't want a token owner to be able to burn, so ERC721Burnable is not included. But an override is inserted:
// The following functions are overrides required by Solidity.
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
What is that for?
- I did select Pausable though so I can pause if necessary. Do people generally pause their project right away? By default ERC721Pausable is not paused, but if you do want to have it paused on deploy, would you just call the internal
_pause()
in the constructor? This will cost gas right?