# Pausing capabilities sanity check approach

**URL:** <https://forum.openzeppelin.com/t/pausing-capabilities-sanity-check-approach/18205>\
**Category:** Smart Contracts\
**Tags:** erc721\
**Created:** [November 4, 2021, 10:40am UTC](https://forum.openzeppelin.com/t/pausing-capabilities-sanity-check-approach/18205 "2021-11-04T10:40:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Walker](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/alex_walker/32/10108_2.png) [@Alex\_Walker](https://forum.openzeppelin.com/u/Alex_Walker)\
**Post date:** [November 4, 2021, 10:40am UTC](https://forum.openzeppelin.com/t/pausing-capabilities-sanity-check-approach/18205/1 "2021-11-04T10:40:34Z")

</div>

Hi, small question on pausing a smart contract (NFT mint) using `import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";`

To pause/unpause the contract I am trying to make sure I have got it right in terms of what I need to over ride so the contract owner can pause/unpause the contract when they want to:

overiding:

```auto
    function _beforeTokenTransfer(address from, address to, uint256 tokenId)
        internal
        override(ERC721, ERC721Pausable, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

```

implementing:

```auto
    function testingIfPaused() view public {
        require(paused(), "contract not paused");
    }
    function runIfNotPaused() public whenNotPaused {
        
    }
    function pause() public whenNotPaused onlyOwner {
        super._pause();
    }
    function unpause() public whenPaused onlyOwner {
        super._unpause();
    }

```

is that correct way to use the ERC721pausable library? Just a sanity check more than anything else... thx

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [November 5, 2021, 1:40pm UTC](https://forum.openzeppelin.com/t/pausing-capabilities-sanity-check-approach/18205/2 "2021-11-05T13:40:19Z")

</div>

You have a couple of errors.

> [@Alex\_Walker](#):
>
> ```auto
> function pause() public whenNotPaused onlyOwner {
> super._pause();
> }
> function unpause() public whenPaused onlyOwner {
> super._unpause();
> }
> 
> ```

You don't need to include the `whenPaused` and `whenNotPaused` modifiers in these functions. They're already included in `_pause` and `_unpause`.

You also shouldn't use `super._pause`, just `_pause` (same for unpause).

Please see the code generated by Contracts Wizard for reference.

> **[OpenZeppelin Contracts Wizard](https://wizard.openzeppelin.com/)**
>
> An interactive smart contract generator based on OpenZeppelin Contracts.
