Skip to content

Access

This is an instance of AccessControl, which the other contract in the platform will refer to for role management. Rather than having all contracts include their own access management, roles are centralized here to simplify things. For example, giving the ENS_MANAGER_ROLE here will give the corresponding ability on all contracts in one single transaction.

By default, all roles (including the one not defined yet) are administered by the DEFAULT_ADMIN_ROLE. The setNewRole function allows the DEFAULT_ADMIN_ROLE to updated role administration rules at any time. Note that this contract is mostly role agnostic and that roles identifiers that are not yet known/defined can be granted at any point without requiring an upgrade of this contract.

version

string version

constructor

constructor(address forwarder) public

initialize

function initialize(address __admin) external

Initializer method, access point to initialize inheritance tree.

Name Type Description
__admin address address to be the DEFAULT_ADMIN_ROLE.

setNewRole

function setNewRole(bytes32 role, bytes32 admin) external

Method for DEFAULT_ADMIN_ROLE to create new roles, and define their role admin.

Name Type Description
role bytes32 id of the new role. Should be keccak256("<ROLE_NAME>").
admin bytes32 role id that will be the role admin for the new role.

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal virtual

Access control for the upgrade process (UPGRADER_ROLE)

Name Type Description
newImplementation address address of the new deployed implementation.

setName

function setName(address ensRegistry, string ensName) public

Allow ENS_MANAGER_ROLE to set ENS reverse registration

Name Type Description
ensRegistry address address
ensName string the name to set in th registry

_msgSender

function _msgSender() internal view virtual returns (address sender)

Helper to get either msg msg.sender if not a meta transaction, signer of forwarder metatx if it is.

If the tx is sent by the trusted forwarded, we assume it is a meta transaction and the signer address is encoded in the last 20 bytes of msg.data.

Name Type Description
sender address address of sender of the transaction of signer if meta transaction.

_msgData

function _msgData() internal view virtual returns (bytes)

Helper to get msg.data if not a meta transaction, forwarder data in metatx if it is.

If the tx is sent by the trusted forwarded, we assume it is a meta transaction and msg.data must have the signer address (encoded in the last 20 bytes of msg.data) removed.

Name Type Description
[0] bytes msg.data of the transaction of msg.data - signer address if meta transaction.

__gap

uint256[50] __gap