forked from rmourey26/CMTAT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPauseModule.sol
68 lines (58 loc) · 1.97 KB
/
PauseModule.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.17;
import "../../../../openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol";
import "../../../../openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import "../../security/AuthorizationModule.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract PauseModule is PausableUpgradeable, AuthorizationModule {
string internal constant TEXT_TRANSFER_REJECTED_PAUSED =
"All transfers paused";
function __PauseModule_init(address admin) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
__Pausable_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__PauseModule_init_unchained();
}
function __PauseModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() public onlyRole(PAUSER_ROLE) {
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() public onlyRole(PAUSER_ROLE) {
_unpause();
}
uint256[50] private __gap;
}