Permission Manager module for core permissioning functionality (GeneralPermissionManager.sol)

View Source: contracts/modules/PermissionManager/GeneralPermissionManager.solโ€‹

โ†— Extends: GeneralPermissionManagerStorage, IPermissionManager, Moduleโ€‹

GeneralPermissionManager

Events

event ChangePermission(address indexed _delegate, address _module, bytes32 _perm, bool _valid);
event AddDelegate(address indexed _delegate, bytes32 _details);

Functions

constructor

function (address _securityToken, address _polyToken) public nonpayable Module

Arguments

Name

Type

Description

_securityToken

address

โ€‹

_polyToken

address

โ€‹

getInitFunction

โคพ overrides IModule.getInitFunctionโ€‹

Init function i.e generalise function to maintain the structure of the module contract

function getInitFunction() public pure
returns(bytes4)

Returns

bytes4

Arguments

Name

Type

Description

checkPermission

โคพ overrides IPermissionManager.checkPermissionโ€‹

Used to check the permission on delegate corresponds to module contract address

function checkPermission(address _delegate, address _module, bytes32 _perm) external view
returns(bool)

Returns

bool

Arguments

Name

Type

Description

_delegate

address

Ethereum address of the delegate

_module

address

Ethereum contract address of the module

_perm

bytes32

Permission flag

addDelegate

โคพ overrides IPermissionManager.addDelegateโ€‹

Used to add a delegate

function addDelegate(address _delegate, bytes32 _details) external nonpayable withPerm

Arguments

Name

Type

Description

_delegate

address

Ethereum address of the delegate

_details

bytes32

Details about the delegate i.e Belongs to financial firm

deleteDelegate

โคพ overrides IPermissionManager.deleteDelegateโ€‹

Used to delete a delegate

function deleteDelegate(address _delegate) external nonpayable withPerm

Arguments

Name

Type

Description

_delegate

address

Ethereum address of the delegate

checkDelegate

โคพ overrides IPermissionManager.checkDelegateโ€‹

Used to check if an address is a delegate or not

function checkDelegate(address _potentialDelegate) external view
returns(bool)

Returns

bool

Arguments

Name

Type

Description

_potentialDelegate

address

the address of potential delegate

changePermission

โคพ overrides IPermissionManager.changePermissionโ€‹

Used to provide/change the permission to the delegate corresponds to the module contract

function changePermission(address _delegate, address _module, bytes32 _perm, bool _valid) public nonpayable withPerm

Returns

bool

Arguments

Name

Type

Description

_delegate

address

Ethereum address of the delegate

_module

address

Ethereum contract address of the module

_perm

bytes32

Permission flag

_valid

bool

Bool flag use to switch on/off the permission

changePermissionMulti

โคพ overrides IPermissionManager.changePermissionMultiโ€‹

Used to change one or more permissions for a single delegate at once

function changePermissionMulti(address _delegate, address[] _modules, bytes32[] _perms, bool[] _valids) public nonpayable withPerm

Returns

nothing

Arguments

Name

Type

Description

_delegate

address

Ethereum address of the delegate

_modules

address[]

Multiple module matching the multiperms, needs to be same length

_perms

bytes32[]

Multiple permission flag needs to be changed

_valids

bool[]

Bool array consist the flag to switch on/off the permission

getAllDelegatesWithPerm

โคพ overrides IPermissionManager.getAllDelegatesWithPermโ€‹

Used to return all delegates with a given permission and module

function getAllDelegatesWithPerm(address _module, bytes32 _perm) external view
returns(address[])

Returns

address[]

Arguments

Name

Type

Description

_module

address

Ethereum contract address of the module

_perm

bytes32

Permission flag

getAllModulesAndPermsFromTypes

โคพ overrides IPermissionManager.getAllModulesAndPermsFromTypesโ€‹

Used to return all permission of a single or multiple module

function getAllModulesAndPermsFromTypes(address _delegate, uint8[] _types) external view
returns(address[], bytes32[])

Returns

address[] the address array of Modules this delegate has permission

Arguments

Name

Type

Description

_delegate

address

Ethereum address of the delegate

_types

uint8[]

uint8[] of types

_changePermission

Used to provide/change the permission to the delegate corresponds to the module contract

function _changePermission(address _delegate, address _module, bytes32 _perm, bool _valid) internal nonpayable

Returns

bool

Arguments

Name

Type

Description

_delegate

address

Ethereum address of the delegate

_module

address

Ethereum contract address of the module

_perm

bytes32

Permission flag

_valid

bool

Bool flag use to switch on/off the permission

getAllDelegates

โคพ overrides IPermissionManager.getAllDelegatesโ€‹

Used to get all delegates

function getAllDelegates() external view
returns(address[])

Returns

address[]

Arguments

Name

Type

Description

getPermissions

โคพ overrides IModule.getPermissionsโ€‹

Returns the Permission flag related the this contract

function getPermissions() public view
returns(bytes32[])

Returns

Array of permission flags

Arguments

Name

Type

Description