AssetAdminFacet

Git Source

Facet for administrative functions including access control and pausing

Diamond facet providing administrative functionality

Functions

_authority

function _authority() internal view returns (address);

addAgent

Add a new agent with admin privileges

function addAgent(address _agent) external;

Parameters

Name
Type
Description

_agent

address

Address of the agent to add

removeAgent

Remove an agent

function removeAgent(address _agent) external;

Parameters

Name
Type
Description

_agent

address

Address of the agent to remove

isAgent

Check if an address is an agent

function isAgent(address _agent) external view returns (bool);

Parameters

Name
Type
Description

_agent

address

Address to check

Returns

Name
Type
Description

<none>

bool

True if the address is an agent, false otherwise

setPaused

Set the paused state

function setPaused(bool _paused) external;

Parameters

Name
Type
Description

_paused

bool

The new paused state

emergencyPause

Emergency pause function - can only pause, not unpause

function emergencyPause() external;

getAdminInfo

Get all administrative information for an address

function getAdminInfo(address account) external view returns (bool isOwner, bool isAgentRole, bool isAdmin);

Parameters

Name
Type
Description

account

address

The address to check

Returns

Name
Type
Description

isOwner

bool

Whether the address is the owner

isAgentRole

bool

Whether the address is an agent

isAdmin

bool

Whether the address has admin privileges (owner or agent)

batchAddAgents

Batch add multiple agents

function batchAddAgents(address[] calldata agents) external;

Parameters

Name
Type
Description

agents

address[]

Array of addresses to add as agents

batchRemoveAgents

Batch remove multiple agents

function batchRemoveAgents(address[] calldata agents) external;

Parameters

Name
Type
Description

agents

address[]

Array of addresses to remove as agents

isInitialized

Check if the contract is initialized

function isInitialized() external view returns (bool);

Returns

Name
Type
Description

<none>

bool

True if the contract is initialized

getContractStatus

Get contract status information

function getContractStatus()
    external
    view
    returns (bool contractPaused, address ownerAddress, uint256 totalAgents, bool contractInitialized);

Returns

Name
Type
Description

contractPaused

bool

Whether the contract is paused

ownerAddress

address

The current owner address

totalAgents

uint256

The total number of agents

contractInitialized

bool

Whether the contract is initialized

hasAdminRole

Check if an address has any administrative privileges

function hasAdminRole(address account) external view returns (bool);

Parameters

Name
Type
Description

account

address

The address to check

Returns

Name
Type
Description

<none>

bool

True if the address has admin privileges

emergencyTransferOwnership

Emergency function to transfer ownership (requires current owner)

function emergencyTransferOwnership(address newOwner) external;

Parameters

Name
Type
Description

newOwner

address

The new owner address

resetAllAgents

Reset all agents (emergency function)

This removes all agents but preserves the owner

function resetAllAgents() external view;

batchCheckAdminStatus

Check multiple addresses for admin status

function batchCheckAdminStatus(address[] calldata accounts) external view returns (bool[] memory);

Parameters

Name
Type
Description

accounts

address[]

Array of addresses to check

Returns

Name
Type
Description

<none>

bool[]

Array of booleans indicating admin status for each address

Events

AgentAdded

event AgentAdded(address indexed agent);

AgentRemoved

event AgentRemoved(address indexed agent);

PausedSet

event PausedSet(bool indexed paused);

Last updated

Was this helpful?