forked from InverterNetwork/contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIERC20Issuance_Blacklist_v1.sol
122 lines (104 loc) · 5.34 KB
/
IERC20Issuance_Blacklist_v1.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.0;
// Internal
import {IERC20Issuance_v1} from "@ex/token/IERC20Issuance_v1.sol";
/**
* @title ERC20 Issuance Token with Blacklist Functionality.
*
* @notice An ERC20 token implementation that extends ERC20Issuance_v1 with
* blacklisting capabilities. This allows accounts with the blacklist manager role to restrict specific
* addresses from participating in token operations.
*
* @dev This contract inherits from:
* - IERC20Issuance_Blacklist_v1.
* - ERC20Issuance_v1.
* Key features:
* - Individual address blacklisting.
* - Batch blacklisting operations.
* - Owner-controlled manager role assignment.
* - Blacklist manager controlled blacklist management.
* Blacklist operations are performed by accounts with the blacklist manager role,
* while the contract owner controls who can be a blacklist manager.
* All blacklist operations can only be performed by accounts with the blacklist manager role.
*
* @custom:security-contact [email protected]
* In case of any concerns or findings, please refer to
* our Security Policy at security.inverter.network or
* email us directly!
*
* @custom:version 1.0.0
*
* @custom:standard-version 1.0.0
*
* @author Zealynx Security
*/
interface IERC20Issuance_Blacklist_v1 is IERC20Issuance_v1 {
// -------------------------------------------------------------------------
// Events
/// @notice Emitted when an address is added to the blacklist.
/// @param account_ The address that was blacklisted.
event AddedToBlacklist(address indexed account_);
/// @notice Emitted when an address is removed from the blacklist.
/// @param account_ The address that was removed from blacklist.
event RemovedFromBlacklist(address indexed account_);
/// @notice Emitted when a blacklist manager role is granted or revoked.
/// @param account_ The address that was granted or revoked the role.
/// @param allowed_ Whether the role was granted (true) or revoked (false).
event BlacklistManagerUpdated(address indexed account_, bool allowed_);
// -------------------------------------------------------------------------
// Errors
/// @notice Thrown when attempting to blacklist the zero address.
error ERC20Issuance_Blacklist_ZeroAddress();
/// @notice Thrown when caller does not have blacklist manager role.
error ERC20Issuance_Blacklist_NotBlacklistManager();
/// @notice Thrown when attempting to mint tokens to a blacklisted address.
error ERC20Issuance_Blacklist_BlacklistedAddress(address account_);
/// @notice Thrown when batch operation exceeds the maximum allowed size.
error ERC20Issuance_Blacklist_BatchLimitExceeded(
uint provided_, uint limit_
);
// -------------------------------------------------------------------------
// External Functions
/// @notice Checks if an address is blacklisted.
/// @param account_ The address to check.
/// @return isBlacklisted_ True if address is blacklisted.
function isBlacklisted(address account_)
external
view
returns (bool isBlacklisted_);
/// @notice Checks if an address is a blacklist manager.
/// @param account_ The address to check.
/// @return isBlacklistManager_ True if address is a blacklist manager.
function isBlacklistManager(address account_)
external
view
returns (bool isBlacklistManager_);
/// @notice Adds an address to blacklist.
/// @param account_ The address to the blacklist.
/// @dev May revert with ERC20Issuance_Blacklist_ZeroAddress.
function addToBlacklist(address account_) external;
/// @notice Removes an address from the blacklist.
/// @param account_ The address to remove.
/// @dev May revert with ERC20Issuance_Blacklist_ZeroAddress.
function removeFromBlacklist(address account_) external;
/// @notice Adds multiple addresses to the blacklist.
/// @param accounts_ Array of addresses to the blacklist.
/// @dev May revert with ERC20Issuance_Blacklist_ZeroAddress
/// The array size should not exceed the block gas limit. Consider
/// using smaller batches (e.g., 100-200 addresses) to ensure
/// transaction success.
function addToBlacklistBatched(address[] calldata accounts_) external;
/// @notice Removes multiple addresses from the blacklist.
/// @param accounts_ Array of addresses to remove.
/// @dev May revert with ERC20Issuance_Blacklist_ZeroAddress
/// The array size should not exceed the block gas limit. Consider
/// using smaller batches (e.g., 100-200 addresses) to ensure
/// transaction success.
function removeFromBlacklistBatched(address[] calldata accounts_)
external;
/// @notice Sets or revokes blacklist manager role for an address.
/// @param manager_ The address to grant or revoke the role from.
/// @param allowed_ Whether to grant (true) or revoke (false) the role.
/// @dev May revert with ERC20Issuance_Blacklist_ZeroAddress.
function setBlacklistManager(address manager_, bool allowed_) external;
}