forked from rmourey26/CMTAT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnforcementModule.sol
75 lines (63 loc) · 2.15 KB
/
EnforcementModule.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
69
70
71
72
73
74
75
//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";
import "../../internal/EnforcementModuleInternal.sol";
/**
* @dev Enforcement module.
*
* Allows the issuer to freeze transfers from a given address
*/
abstract contract EnforcementModule is
EnforcementModuleInternal,
AuthorizationModule
{
string internal constant TEXT_TRANSFER_REJECTED_FROM_FROZEN =
"The address FROM is frozen";
string internal constant TEXT_TRANSFER_REJECTED_TO_FROZEN =
"The address TO is frozen";
function __EnforcementModule_init(address admin) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
// AccessControlUpgradeable inherits from ERC165Upgradeable
__ERC165_init_unchained();
// AuthorizationModule inherits from AccessControlUpgradeable
__AccessControl_init_unchained();
/* CMTAT modules */
// Internal
__Enforcement_init_unchained();
// Security
__AuthorizationModule_init_unchained(admin);
// own function
__EnforcementModule_init_unchained();
}
function __EnforcementModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/**
* @notice Freezes an address.
* @param account the account to freeze
* @param reason indicate why the account was frozen.
*/
function freeze(
address account,
string memory reason
) public onlyRole(ENFORCER_ROLE) returns (bool) {
return _freeze(account, reason);
}
/**
* @notice Unfreezes an address.
* @param account the account to unfreeze
* @param reason indicate why the account was unfrozen.
*
*
*/
function unfreeze(
address account,
string memory reason
) public onlyRole(ENFORCER_ROLE) returns (bool) {
return _unfreeze(account, reason);
}
uint256[50] private __gap;
}