-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathAllowlistModule.sol
More file actions
97 lines (81 loc) · 2.84 KB
/
AllowlistModule.sol
File metadata and controls
97 lines (81 loc) · 2.84 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.20;
/* ==== Module === */
import {IAllowlistModule} from "../../../interfaces/modules/IAllowlistModule.sol";
import {AllowlistModuleInternal} from "../../internal/AllowlistModuleInternal.sol";
/*
/**
* @title Allowlist module.
* @dev
*
* Allows the issuer to set an allowlist
*/
abstract contract AllowlistModule is
AllowlistModuleInternal,
IAllowlistModule
{
/* ============ State Variables ============ */
bytes32 public constant ALLOWLIST_ROLE = keccak256("ALLOWLIST_ROLE");
/* ============ Modifier ============ */
modifier onlyAllowlistManager {
_authorizeAllowlistManagement();
_;
}
/*//////////////////////////////////////////////////////////////
PUBLIC/EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/* ============ State functions ============ */
/**
* @inheritdoc IAllowlistModule
*/
function setAddressAllowlist(address account, bool status) public virtual onlyAllowlistManager{
_addToAllowlist(account, status, "");
}
/**
* @inheritdoc IAllowlistModule
*/
function setAddressAllowlist(
address account, bool status, bytes calldata data
) public virtual onlyAllowlistManager {
_addToAllowlist(account, status, data);
}
/**
* @inheritdoc IAllowlistModule
*/
function batchSetAddressAllowlist(
address[] calldata accounts, bool[] calldata status
) public virtual onlyAllowlistManager {
_addToAllowlist(accounts, status, "");
}
/**
* @inheritdoc IAllowlistModule
*/
function enableAllowlist(
bool status
) public virtual onlyAllowlistManager {
_enableAllowlist(status);
emit AllowlistEnableStatus(_msgSender(), status);
}
/* ============ View functions ============ */
/**
* @inheritdoc IAllowlistModule
*/
function isAllowlistEnabled() public view virtual returns (bool) {
return _isAllowlistEnabled();
}
/**
* @inheritdoc IAllowlistModule
*/
function isAllowlisted(address account) public view virtual returns (bool) {
return _isAllowlisted(account);
}
/*//////////////////////////////////////////////////////////////
INTERNAL/PRIVATE FUNCTIONS
//////////////////////////////////////////////////////////////*/
function _addToAllowlist(AllowlistModuleInternalStorage storage $,address account, bool status, bytes memory data) internal override(AllowlistModuleInternal){
AllowlistModuleInternal._addToAllowlist($, account, status, data);
emit AddressAddedToAllowlist(account, status, _msgSender(), data);
}
/* ==== Access Control ==== */
function _authorizeAllowlistManagement() internal virtual;
}