-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathEnforcementModule.sol
59 lines (52 loc) · 1.72 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
//SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;
import "../../security/AuthorizationModule.sol";
import "../../internal/EnforcementModuleInternal.sol";
/**
* @title Enforcement module.
* @dev
*
* Allows the issuer to freeze transfers from a given address
*/
abstract contract EnforcementModule is
EnforcementModuleInternal,
AuthorizationModule
{
/* ============ State Variables ============ */
bytes32 public constant ENFORCER_ROLE = keccak256("ENFORCER_ROLE");
string internal constant TEXT_TRANSFER_REJECTED_FROM_FROZEN =
"Address FROM is frozen";
string internal constant TEXT_TRANSFER_REJECTED_TO_FROZEN =
"Address TO is frozen";
/* ============ Initializer Function ============ */
function __EnforcementModule_init_unchained() internal onlyInitializing {
// no variable to initialize
}
/*//////////////////////////////////////////////////////////////
PUBLIC/EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice Freezes an address.
* @param account the account to freeze
* @param reason indicate why the account was frozen.
*/
function freeze(
address account,
string calldata 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 calldata reason
) public onlyRole(ENFORCER_ROLE) returns (bool) {
return _unfreeze(account, reason);
}
}