Roles

Git Source

Inherits: Ownable, IRoles

Title: Role registry

Author: Malda Protocol

Ownable registry for assigning protocol roles to contracts.

State Variables

REBALANCER

Rebalancer role

bytes32 public constant REBALANCER = keccak256("REBALANCER")

PAUSE_MANAGER

Pause manager role

bytes32 public constant PAUSE_MANAGER = keccak256("PAUSE_MANAGER")

REBALANCER_EOA

Rebalancer EOA role

bytes32 public constant REBALANCER_EOA = keccak256("REBALANCER_EOA")

GUARDIAN_PAUSE

Guardian pause role

bytes32 public constant GUARDIAN_PAUSE = keccak256("GUARDIAN_PAUSE")

CHAINS_MANAGER

Chains manager role

bytes32 public constant CHAINS_MANAGER = keccak256("CHAINS_MANAGER")

PROOF_FORWARDER

Proof forwarder role

bytes32 public constant PROOF_FORWARDER = keccak256("PROOF_FORWARDER")

PROOF_BATCH_FORWARDER

Proof batch forwarder role

bytes32 public constant PROOF_BATCH_FORWARDER = keccak256("PROOF_BATCH_FORWARDER")

SEQUENCER

Sequencer role

bytes32 public constant SEQUENCER = keccak256("SEQUENCER")

GUARDIAN_BRIDGE

Bridge guardian role

bytes32 public constant GUARDIAN_BRIDGE = keccak256("GUARDIAN_BRIDGE")

GUARDIAN_ORACLE

Oracle guardian role

bytes32 public constant GUARDIAN_ORACLE = keccak256("GUARDIAN_ORACLE")

GUARDIAN_RESERVE

Reserve guardian role

bytes32 public constant GUARDIAN_RESERVE = keccak256("GUARDIAN_RESERVE")

GUARDIAN_BORROW_CAP

Borrow cap guardian role

bytes32 public constant GUARDIAN_BORROW_CAP = keccak256("GUARDIAN_BORROW_CAP")

GUARDIAN_SUPPLY_CAP

Supply cap guardian role

bytes32 public constant GUARDIAN_SUPPLY_CAP = keccak256("GUARDIAN_SUPPLY_CAP")

GUARDIAN_BLACKLIST

Blacklist guardian role

bytes32 public constant GUARDIAN_BLACKLIST = keccak256("GUARDIAN_BLACKLIST")

_roles

Role assignment mapping: contract => role => allowed

mapping(address contractAddress => mapping(bytes32 roleIdentifier => bool allowed)) private _roles

Functions

constructor

Initializes the role registry

constructor(address owner_) Ownable(owner_);

Parameters

NameTypeDescription
owner_addressOwner address

allowFor

Abiltity to allow a contract for a role or not

function allowFor(address _contract, bytes32 _role, bool _allowed) external onlyOwner;

Parameters

NameTypeDescription
_contractaddressthe contract's address.
_rolebytes32the bytes32 role.
_allowedboolthe new status.

isAllowedFor

Checks if a contract has a given role

function isAllowedFor(address _contract, bytes32 _role) external view override returns (bool);

Parameters

NameTypeDescription
_contractaddressContract address
_rolebytes32Role identifier

Returns

NameTypeDescription
<none>boolTrue if allowed

Events

Allowed

Emitted when role allowance is updated

event Allowed(address indexed _contract, bytes32 indexed _role, bool _allowed);

Parameters

NameTypeDescription
_contractaddressThe contract being updated
_rolebytes32The role identifier
_allowedboolNew allowance status