General Permission Manager

Introduced in

1.3.0

Contract name

GeneralPermissionManager.sol

Compatible ST Protocol version range

^3.0.0

Type

Permission Manager Module

How it works

The GPM allows the issuer to add wallets as delegates and to give them permission to use restricted functions on other modules. Every time one of these functions is called on a module, it will check if the sender is allowed to do it. For example, the issuer can give an associate the ability to work on the tokens whitelist by giving his address the WHITELIST permission on the GeneralTransferManager.

Key functionalities (as defined in the Smart Contract)

Initialization

This module is initialized without any parameters.

Checking permissions

Called by modules when restricted functions are called by a non-owner wallet. If the address passed is a delegate and it has the required permission for the given module and function, it returns true and it allows to execute the restricted function on that module. Otherwise, it returns false.

    /**
     * @notice Used to check the permission on delegate corresponds to module contract address
     * @param _delegate Ethereum address of the delegate
     * @param _module Ethereum contract address of the module
     * @param _perm Permission flag
     * @return bool
     */
    function checkPermission(address _delegate, address _module, bytes32 _perm) external view returns(bool)

Adding delegates

To change permission, it is necessary to have added a delegate previously. This can be done by calling the following function, where _details is a required description (I.E: “Business partner”, “KYC Partner”) for the _delegate. Some required checks:-

  • _delgate address shouldn’t be 0x0.

  • _details shouldn’t be bytes32(0).

  • _delegate shouldn’t already exist.

This means the order of the right operations is:

  1. Add a delegate

  2. Add as many permissions as needed on different modules to an existing delegate.

Note: Only the issuer or a designated ADMIN (through this module) can add delegates.

Adding delegates Multi

This is a batch version of the addDelegate() function with the same checks.

Changing permissions

Once delegates are added, this module can change the permissions assigned to them (allow or disallow).

  • Change single permission for a single module for a delegate by calling:

  • Change multiple permissions for multiple modules for a delegate by calling:

Note: An only issuer or a designated ADMIN (through this module) can change permissions.

Removing delegates

By removing a delegate, all its permission will be removed too. This means that if the delegate is a delegate is added again in the future, it will be necessary to change its permissions again.

Note: An only issuer or a designated ADMIN (through this module) can change permissions.

Remove delegate Multi

Batch version of the deleteDelegate() function with the same check.

Getters

This module provides several functions to access delegates and permissions:

  • Check if an address is a delegate or not by calling:

  • Get all delegates with a given permission and module by calling:

Note: Should be called off-chain only

  • Get all permissions for a delegate through all modules of the given types for a security token by calling:

Note: Should be called off-chain only

  • Get all delegates by calling

Last updated

Was this helpful?