Roles

View Source: @nomisma/elektro-protocol-aux/contracts/backward-compatibility/Roles.sol

Roles

Library for managing addresses assigned to a Role. Contract defines struct Role that keeps mapping for which address has requested Role

Structs

Role

struct Role {
 mapping(address => bool) bearer
}

Functions

  • add(struct Roles.Role role, address account)

  • remove(struct Roles.Role role, address account)

  • has(struct Roles.Role role, address account)

add

Function to grant role to account. New address is added to role mapping

function add(struct Roles.Role role, address account) internal nonpayable

Arguments

NameTypeDescription

role

struct Roles.Role

Role mapping of current roles to addresses

account

address

to grant role to

remove

Function to grant role to account. Address is removed from role mapping

function remove(struct Roles.Role role, address account) internal nonpayable

Arguments

NameTypeDescription

role

struct Roles.Role

Role mapping of current roles to addresses

account

address

to remove from the mapping

has

Function to check if address is present in roleMapping

function has(struct Roles.Role role, address account) internal view
returns(bool)

Arguments

NameTypeDescription

role

struct Roles.Role

Role mapping of current roles to addresses

account

address

to check if its present in the mapping

Last updated