> For the complete documentation index, see [llms.txt](https://docs.symm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.5/account-layer-diamond/control-facet.md).

# Control Facet

### Overview

The Control Facet provides:

* **Role Management:** Grant, revoke, and configure role admins for the Account Layer's access control system.
* **Pause Control:** Pause and unpause the entire Account Layer diamond.
* **Account Configuration:** Set the AccountManager proxy bytecode and the global signer.
* **Affiliate Configuration:** Configure the Symmio fee receiver, whitelist Symmio cores, manage hook and call selector permissions, and add Symmio cores to active affiliates.

***

### Role Management

#### grantRole() / revokeRole()

Grants or revokes a role. Caller must be an admin for that role.

```solidity
function grantRole(address user, bytes32 role) external onlyRoleAdmin(role);
function revokeRole(address user, bytes32 role) external onlyRoleAdmin(role);
```

**Events:** `RoleGranted(bytes32 role, address user, address admin)` / `RoleRevoked(bytes32 role, address user, address admin)`

#### setRoleAdmin()

Adds or removes a user as a role admin for a specific role. Requires `DEFAULT_ADMIN_ROLE`.

```solidity
function setRoleAdmin(address user, bytes32 role, bool status) external onlyRole(DEFAULT_ADMIN_ROLE);
```

**Events:** `RoleAdminSet(bytes32 role, address user, bool status, address admin)`

***

### Pause Control

#### pause() / unpause()

Pauses or unpauses all state-changing operations on the Account Layer diamond.

```solidity
function pause() external onlyRole(PAUSER_ROLE);
function unpause() external onlyRole(UNPAUSER_ROLE);
```

***

### Account Configuration

#### setAccountManagerImplementation()

Sets the bytecode used to deploy new AccountManager proxy contracts when affiliates are approved.

```solidity
function setAccountManagerImplementation(bytes memory implementation) external onlyRole(SETTER_ROLE);
```

**Events:** `AccountManagerImplementationUpdated(bytes oldImplementation, bytes newImplementation)`

#### setSigner()

Sets the global signer for protocol-level operations. Pass `address(0)` to clear.

```solidity
function setSigner(address _signer) external onlyRole(SIGNER_SETTER_ROLE);
```

**Events:** `SignerUpdated(address oldSigner, address newSigner)`

***

### Affiliate Configuration

#### setSymmioFeeReceiver()

Sets the address that receives Symmio's share of affiliate fees.

```solidity
function setSymmioFeeReceiver(address receiver) external onlyRole(SETTER_ROLE);
```

**Events:** `SymmioFeeReceiverUpdated(address oldReceiver, address newReceiver)`

#### setWhitelistedSymmioCore()

Adds or removes a Symmio core diamond from the whitelist. Affiliates can only be registered against whitelisted cores.

```solidity
function setWhitelistedSymmioCore(address core, bool status) external onlyRole(SETTER_ROLE);
```

**Events:** `WhitelistedSymmioCoreSet(address core, bool status)`

#### setHookAllowedSelectors()

Configures which function selectors an affiliate's hook contracts are allowed to execute via `executeForAccount`.

```solidity
function setHookAllowedSelectors(address affiliate, bytes4[] calldata selectors, bool allowed) external onlyRole(SETTER_ROLE);
```

**Events:** `HookAllowedSelectorsSet(address affiliate, bytes4[] selectors, bool allowed)`

#### setCallAllowedSelectors()

Configures which function selectors an affiliate can invoke via `callAsAffiliate`.

```solidity
function setCallAllowedSelectors(address affiliate, bytes4[] calldata selectors, bool allowed) external onlyRole(SETTER_ROLE);
```

**Events:** `CallAllowedSelectorsSet(address affiliate, bytes4[] selectors, bool allowed)`

#### addSymmioCoreToAffiliate()

Adds a whitelisted Symmio core to an active affiliate and registers the affiliate on that core.

```solidity
function addSymmioCoreToAffiliate(address affiliate, address core) external onlyRole(APPROVER_ROLE);
```

**Events:** `SymmioCoreAddedToAffiliate(address affiliate, address core)`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.symm.io/contract-documentation/symmio-perps-v0.8.5/account-layer-diamond/control-facet.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
