Skip to main content

AccessControlled

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​

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​

NameTypeDescription
adminaddressThe new admin.

_admin​

address _admin

The admin address.

constructor​

constructor(address admin_) public

AccessControlled's constructor

Parameters​

NameTypeDescription
admin_addressThe address of the admin that can access privileged functions and also allowed to change the admin. Cannot be address(0).

onlyAdmin​

modifier onlyAdmin()

This modifier verifies that msg.sender is the admin.

onlyCaller​

modifier onlyCaller(address caller)

This modifier verifies that msg.sender is the caller.

Parameters​

NameTypeDescription
calleraddressThe address of the caller that can access the modified function.

adminOrCaller​

modifier adminOrCaller(address caller)

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

Parameters​

NameTypeDescription
calleraddressThe address of a caller that can access the modified function.

admin​

function admin() public view returns (address current)

Retrieves the current admin.

Return Values​

NameTypeDescription
currentaddressadmin.

setAdmin​

function setAdmin(address admin_) public

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

Parameters​

NameTypeDescription
admin_addressThe new admin. Cannot be address(0).