Skip to main content

GlobalAccessControl

Git Source

Inherits: Pausable, AccessControl

Allows inheriting contracts to leverage global access control permissions conveniently, as well as granting contract-specific pausing functionality

Inspired from https://github.com/Citadel-DAO/citadel-contracts

State Variables

PAUSER

bytes32 public constant PAUSER = keccak256("PAUSER");

KEEPER

bytes32 public constant KEEPER = keccak256("KEEPER");

POLICY_OPS

bytes32 public constant POLICY_OPS = keccak256("POLICY_OPS");

GOVERNANCE

bytes32 public constant GOVERNANCE = keccak256("GOVERNANCE");

FACTORY

bytes32 public constant FACTORY = keccak256("FACTORY");

MINTER

bytes32 public constant MINTER = keccak256("MINTER");

TREASURY_OPS

bytes32 public constant TREASURY_OPS = keccak256("TREASURY_OPS");

WHITELISTED

bytes32 public constant WHITELISTED = keccak256("WHITELISTED");

WHITELIST_MANAGER

bytes32 public constant WHITELIST_MANAGER = keccak256("WHITELIST_MANAGER");

PRODUCT

bytes32 public constant PRODUCT = keccak256("PRODUCT");

DISTRIBUTION_MANAGER

bytes32 public constant DISTRIBUTION_MANAGER = keccak256("DISTRIBUTION_MANAGER");

CREATOR

bytes32 public constant CREATOR = keccak256("CREATOR");

KEEPER_WHITELISTED

bytes32[] private KEEPER_WHITELISTED = [KEEPER, WHITELISTED];

Functions

constructor

constructor(address _defaultAdmin);

pause

Pause the protocol globally

function pause() public;

unpause

Unpause the protocol if paused

function unpause() public;

setRoleAdmin

Used to set admin role for a role

function setRoleAdmin(bytes32 role, bytes32 adminRole) public onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
rolebytes32The role that will have adminRole as its admin
adminRolebytes32The hash of the role string

initializeNewRole

Setup a new role via contract governance, without upgrade

Note that no constant will be available on the contract here to search role, but we can delegate viewing to another contract

function initializeNewRole(bytes32 role, string memory roleString, bytes32 adminRole) public;

Parameters

NameTypeDescription
rolebytes32The new role being initialized
roleStringstringThe string of the role being initialized
adminRolebytes32The admin of the new role

keeperWhitelistedRoles

function keeperWhitelistedRoles() external view returns (bytes32[] memory);