> For the complete documentation index, see [llms.txt](https://docs.mangrove.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mangrove.exchange/dev/strat-lib/technical-references/api-preferences/strats/src/strategies/utils/accesscontrolled.md).

# AccessControlled

The contract stores an admin address which is checked against `msg.sender` in the `onlyAdmin` modifier.\
Additionally, a specific `msg.sender` can be verified with the `onlyCaller` modifier.

## SetAdmin

```solidity
event SetAdmin(address admin)
```

logs new `admin` of `this`\
By emitting this data, an indexer will be able to keep track of what address is the admin of this contract.

### Parameters

| Name  | Type    | Description    |
| ----- | ------- | -------------- |
| admin | address | The new admin. |

## \_admin

```solidity
address _admin
```

The admin address.

## constructor

```solidity
constructor(address admin_) public
```

`AccessControlled`'s constructor

### Parameters

| Name    | Type    | Description                                                                                                                 |
| ------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
| admin\_ | address | The address of the admin that can access privileged functions and also allowed to change the admin. Cannot be `address(0)`. |

## onlyAdmin

```solidity
modifier onlyAdmin()
```

This modifier verifies that `msg.sender` is the admin.

## onlyCaller

```solidity
modifier onlyCaller(address caller)
```

This modifier verifies that `msg.sender` is the caller.

### Parameters

| Name   | Type    | Description                                                      |
| ------ | ------- | ---------------------------------------------------------------- |
| caller | address | The address of the caller that can access the modified function. |

## adminOrCaller

```solidity
modifier adminOrCaller(address caller)
```

This modifier verifies that `msg.sender` is either caller or the admin

### Parameters

| Name   | Type    | Description                                                    |
| ------ | ------- | -------------------------------------------------------------- |
| caller | address | The address of a caller that can access the modified function. |

## admin

```solidity
function admin() public view returns (address current)
```

Retrieves the current admin.

### Return Values

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| current | address | admin.      |

## setAdmin

```solidity
function setAdmin(address admin_) public
```

This sets the admin. Only the current admin can change the admin.

### Parameters

| Name    | Type    | Description                            |
| ------- | ------- | -------------------------------------- |
| admin\_ | address | The new admin. Cannot be `address(0)`. |


---

# 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.mangrove.exchange/dev/strat-lib/technical-references/api-preferences/strats/src/strategies/utils/accesscontrolled.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.
