AuthorizedCallers API Reference
Summary
AuthorizedCallers is an owner-managed access control helper contract.
It maintains a storage-backed allowlist of authorized addresses and provides:
- Owner-controlled updates to the allowlist.
- A reusable internal validation helper (
_validateCaller). - A modifier (
onlyAuthorizedCallers) to restrict functions to authorized callers.
This contract is designed to be inherited by other contracts requiring restricted execution paths.
Contract
@chainlink/contracts/src/v0.8/shared/access/AuthorizedCallers.sol
Import
import {AuthorizedCallers} from "@chainlink/contracts/src/v0.8/shared/access/AuthorizedCallers.sol";
Inheritance
Ownable2StepMsgSender
State
Storage
EnumerableSet.AddressSet internal s_authorizedCallers;
Maintains the set of authorized caller addresses.
External API
Constructor
constructor(address[] memory authorizedCallers)
Initializes the authorized caller set by internally applying:
AuthorizedCallerArgs({
addedCallers: authorizedCallers,
removedCallers: new address
})
getAllAuthorizedCallers
function getAllAuthorizedCallers()
external
view
returns (address[] memory)
Returns the full set of authorized callers.
applyAuthorizedCallerUpdates
function applyAuthorizedCallerUpdates(
AuthorizedCallerArgs memory authorizedCallerArgs
) external virtual onlyOwner
Owner-only update function.
Processing order:
- Removals (
removedCallers) - Additions (
addedCallers)
Internally calls _applyAuthorizedCallerUpdates.
onlyAuthorizedCallers (modifier)
modifier onlyAuthorizedCallers()
Restricts function execution to addresses in s_authorizedCallers.
Internally calls _validateCaller().
Events
event AuthorizedCallerAdded(address caller);
event AuthorizedCallerRemoved(address caller);
Errors
error UnauthorizedCaller(address caller);
error ZeroAddressNotAllowed();
Structs
AuthorizedCallerArgs
struct AuthorizedCallerArgs {
address[] addedCallers;
address[] removedCallers;
}
Used when updating the allowlist.
Internal Functions
_applyAuthorizedCallerUpdates
function _applyAuthorizedCallerUpdates(
AuthorizedCallerArgs memory authorizedCallerArgs
) internal
Behavior:
-
Iterates over
removedCallers:- If removal succeeds, emits
AuthorizedCallerRemoved.
- If removal succeeds, emits
-
Iterates over
addedCallers:- Reverts
ZeroAddressNotAllowed()ifcaller == address(0). - Adds to set and emits
AuthorizedCallerAdded.
- Reverts
_validateCaller
function _validateCaller() internal view
Reverts:
UnauthorizedCaller(msg.sender)
If msg.sender is not present in s_authorizedCallers.
Security model
- Owner controls allowlist membership.
- Removals are processed before additions to avoid accidental overlap issues.
- Zero address cannot be added.
- Modifier-based enforcement prevents unauthorized execution.
- Designed for inheritance — does not perform business logic itself.