Skip to main content

Adminable

Git Source

Inherits: IAdminable

Title: Adminable

See the documentation in IAdminable.

State Variables

admin

The address of the admin account or contract.

address public override admin

Functions

onlyAdmin

Reverts if called by any account other than the admin.

modifier onlyAdmin() ;

constructor

Emits a {TransferAdmin} event.

constructor(address initialAdmin) ;

Parameters

NameTypeDescription
initialAdminaddressThe address of the initial admin.

transferAdmin

Transfers the contract admin to a new address.

Notes:

  • Does not revert if the admin is the same.
  • This function can potentially leave the contract without an admin, thereby removing any functionality that is only available to the admin. Requirements:
  • msg.sender must be the contract admin.
function transferAdmin(address newAdmin) public virtual override onlyAdmin;

Parameters

NameTypeDescription
newAdminaddressThe address of the new admin.

_transferAdmin

An internal function to transfer the admin.

function _transferAdmin(address oldAdmin, address newAdmin) internal;

_onlyAdmin

A private function is used instead of inlining this logic in a modifier because Solidity copies modifiers into every function that uses them.

function _onlyAdmin() private view;