Authorizable

Git Source

Inherits: IAuthorizable

Implements authorization control for contracts

Authorization control is boolean and handled by isAuthorized modifier

State Variables

_authorizedAccounts

EnumerableSet of authorized accounts

EnumerableSet.AddressSet internal _authorizedAccounts;

Functions

constructor

constructor(address _account);

Parameters

NameTypeDescription
_accountaddressInitial account to add authorization to

authorizedAccounts

Checks whether an account is authorized

function authorizedAccounts(address _account) external view returns (bool _authorized);

Returns

NameTypeDescription
_authorizedboolWhether the account is authorized or not

authorizedAccounts

Getter for the authorized accounts

function authorizedAccounts() external view returns (address[] memory _accounts);

Returns

NameTypeDescription
_accountsaddress[]Array of authorized accounts

addAuthorization

Add auth to an account

function addAuthorization(address _account) external virtual isAuthorized;

Parameters

NameTypeDescription
_accountaddressAccount to add auth to

removeAuthorization

Remove auth from an account

function removeAuthorization(address _account) external virtual isAuthorized;

Parameters

NameTypeDescription
_accountaddressAccount to remove auth from

_addAuthorization

function _addAuthorization(address _account) internal;

_removeAuthorization

function _removeAuthorization(address _account) internal;

_isAuthorized

function _isAuthorized(address _account) internal view virtual returns (bool _authorized);

isAuthorized

Checks whether msg.sender can call an authed function

Will revert with Unauthorized if the sender is not authorized

modifier isAuthorized();