😜Role and RolesRepo

Function and Usage

The Roles repo is the basic component of the access control for writing operation at the smart contract's level, and it is also the core member of access control smart contracts. The roles repo is the access control of writing instruction for drafting and finalization process of investment agreements and shareholders agreement. Specifically, a shareholder can create a new contract as the owner, then appoint the account with a specific address as an Attorney, who can draft the body of the agreement and set the signature page. After the contract is drafted and approved by the shareholder, the shareholder can revoke the appointment of all contract attorneys as the owner of the contract at once and transfer the contract owner to "0 Address", thus finalizing the contract.

Members and Attributes

The roles repo mainly defines the owner and role objects, as well as the role object mapping with the structure of "Role Name -> Role Object".

Role Objects

Structure of Role Objects

The Attribute Meaning of Role Objects

Attribute
Commercial and Legal Meaning

admin

The account address of the role bookkeeper.

isMember

Determines whether the account with a specific address is a member of the role.

Roles Repo

Structure of Roles Repo

The Attribute Meaning of Role Objects

Attribute
Commercial and Legal Meaning

owner

Owner account address.

state

States of the roles repo. 0 - Setting up, 1 - Initialized, 2 - Finalized.

roles

Role mapping. mapping structure: "Role name (bytes32) -> Role object"

Query API

The query API well describes the function and use of the Roles Repo in the whole system, as shown in the table below.

getOwner

Query the owner's account address.

getRoleAdmin

Query the address of the bookkeeper account for a specific name role.

hasRole

Query if the account with a specific address is a member of a specific role.

Source Code

Last updated