Blacklister

Git Source

Inherits: OwnableUpgradeable, IBlacklister

Title: Blacklister

Author: Merge Layers Inc.

Contract for managing blacklisted addresses

State Variables

isBlacklisted

Mapping of addresses to their blacklist status

mapping(address user => bool isBlacklisted) public isBlacklisted

_blacklistedList

List of blacklisted addresses

address[] private _blacklistedList

rolesOperator

The roles operator contract

IRoles public rolesOperator

Functions

onlyOwnerOrGuardian

Modifier to restrict access to owner or has guardian blacklist role

modifier onlyOwnerOrGuardian() ;

constructor

Disables initializers on implementation contract

Note: oz-upgrades-unsafe-allow: constructor

constructor() ;

initialize

Initialize the contract

function initialize(address payable _owner, address _roles) external initializer;

Parameters

NameTypeDescription
_owneraddress payableThe owner address
_rolesaddressThe roles contract address

blacklist

Blacklists a user immediately (onlyOwner).

function blacklist(address user) external override onlyOwnerOrGuardian;

Parameters

NameTypeDescription
useraddressThe address to blacklist

unblacklist

Removes a user from the blacklist (onlyOwner).

function unblacklist(address user) external override onlyOwnerOrGuardian;

Parameters

NameTypeDescription
useraddressThe address to unblacklist

unblacklist

Removes a user from the blacklist (onlyOwner).

function unblacklist(address user, uint256 index) external override onlyOwnerOrGuardian;

Parameters

NameTypeDescription
useraddressThe address to unblacklist
indexuint256The index of the user in blacklist array

getBlacklistedAddresses

Returns the list of currently blacklisted addresses.

function getBlacklistedAddresses() external view returns (address[] memory);

Returns

NameTypeDescription
<none>address[]blacklistedAddresses Array of blacklisted addresses

_addToBlacklist

Internal function to add an address to blacklist

function _addToBlacklist(address user) internal;

Parameters

NameTypeDescription
useraddressThe address to blacklist

_removeFromBlacklist

Internal function to remove an address from blacklist list

function _removeFromBlacklist(address user) internal;

Parameters

NameTypeDescription
useraddressThe address to remove

_removeFromBlacklist

Internal function to remove an address from blacklist list by index

function _removeFromBlacklist(address user, uint256 index) internal;

Parameters

NameTypeDescription
useraddressThe address to remove
indexuint256The index in the blacklist array