# PermissionControl

#### Extends

[Operatable](/pheriphery-contracts/operatable.md)

## Initialization

### constructor

```solidity
constructor(address to)
```

#### Description

Initializes a new PermissionControl instance.

#### Parameters

| Name | Type      | Description                      |
| ---- | --------- | -------------------------------- |
| to   | `address` | The owner of the smart contract. |

#### Emits

[OwnershipTransferred](https://github.com/boringcrypto/BoringSolidity/blob/master/contracts/BoringOwnable.sol#L13C11-L13C31)

## Write Methods

### whitelistLiquidator

```solidity
function whitelistLiquidator(address liquidator, bool approved)
    public onlyOperators
```

#### Description

Allows [operators](/pheriphery-contracts/operatable.md#operators) to:

* add a liquidator to the whitelist.
* remove a liquidator from the whitelist.

#### Parameters

| Name       | Type      | Description                        |
| ---------- | --------- | ---------------------------------- |
| liquidator | `address` | The liquidator's address.          |
| approved   | `bool`    | The status to set to `liquidator`. |

#### Emits

[LogWhiteListLiquidator](#logwhitelistliquidator)

### whitelistUsers

```solidity
function whitelistUsers(address[] calldata users, bool[] calldata approved) 
    public onlyOperators
```

#### Description

Calls [whitelistUser ](#whitelistuser)for each entry of `users` and `approved`.

#### Parameters

| Name     | Type        | Description                                                                                       |
| -------- | ----------- | ------------------------------------------------------------------------------------------------- |
| users    | `address[]` | The user addresses.                                                                               |
| approved | `bool[]`    | Maps each user's address to the status it should be set to (see [whitelistUser](#whitelistuser)). |

#### Emits

[LogWhiteListUser](#logwhitelistuser)

### whitelistUser

```solidity
function whitelistUser(address user, bool approved) public onlyOperators
```

#### Description

Allows [operators](/pheriphery-contracts/operatable.md#operators) to:

* add a user to the whitelist.
* remove a user from the whitelist.

#### Parameters

| Name     | Type      | Description                  |
| -------- | --------- | ---------------------------- |
| user     | `address` | The user's address.          |
| approved | `bool`    | The status to set to `user`. |

#### Emits

[LogWhiteListUser](#logwhitelistuser)

## View Methods

### whitelistedUsers

```solidity
mapping(address => bool) public whitelistedUsers; 
```

#### Description

Maps each whitelisted user's address to `true`.

### liquidators

```solidity
mapping(address => bool) public liquidators;
```

#### Description

Maps each whitelisted liquidator's address to `true`.

## Events

### LogWhiteListUser

```solidity
event LogWhiteListUser(
    address indexed user,
    address indexed operator,
    bool approved
)
```

#### Parameters

| Name     | Type      | Index? |
| -------- | --------- | ------ |
| user     | `address` | Yes    |
| operator | `address` | Yes    |
| approved | `bool`    | No     |

### LogWhiteListLiquidator

```solidity
event LogWhiteListLiquidator(
    address indexed user,
    address indexed operator,
    bool approved
)
```

#### Parameters

| Name     | Type      | Index? |
| -------- | --------- | ------ |
| user     | `address` | Yes    |
| operator | `address` | Yes    |
| approved | `bool`    | No     |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.alloy.tether.to/pheriphery-contracts/operatable/permissioncontrol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
