I used the contracts wizard and made sure Pausable was enabled. One override that added was:
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override whenNotPaused {
super._beforeTokenTransfer(from, to, tokenId);
}
So this means that ANY transfer cannot proceed if the contract is paused right? Does that include calls to _safeMint()
? I have a custom minting function that looks something like:
function myCustomMint(uint256 _mintAmount) public payable nonReentrant {
// some require statements
for (uint256 i; i < _mintAmount; i++) {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(msg.sender, tokenId);
}
}
If my contract is paused, I don't want minting to be enabled. Do I explicitly modify the function signature of myCustomMint()
with whenNotPaused
? Or does the _beforeTokenTransfer
override with the modifier take care of that?
Also, using Pausable
, if I want the contract to be paused by default when it's deployed, do I just call _pause();
in the constructor body?