Skip to main content

Role setup and revocation

After deployment, the admin can begin configuring the actors that are allowed to operate the project (contract instance). Equillar defines a set of roles, and every address involved in the contract's capital in/out flows must be granted one of these roles before it can interact with them.

Roles

  • Admin: The admin is the top-level authority over role management, payment processing, treasury actions, emergency close, and pausing/unpausing the contract. This role is established on the deploy (as we've learned in the previous section) and can be transferred to other address later.
  • Operator: The operator role is responsible for creating new deposits, i.e. new investments. This role is particularly useful for regulated actors, who typically share a single address across many end users.
  • Company: The company role isn't used to sign contract calls; instead, it's used to designate an address as a "project funds receiver". Any address that is meant to receive the funds raised by the project must be granted this role.
  • Manager: The manager role isn't used to sign contract calls; instead, it's used to designate an address as a "commissions receiver". Any address that is meant to receive the commissions earned by the integrator must be granted this role.

Grant and revoke flows

The admin can use:

  • grant_operator / revoke_operator
  • grant_company / revoke_company
  • grant_manager / revoke_manager

Revoking a role takes effect immediately at the contract layer. For example, a revoked operator can no longer create new investments.

The following commands show how to grant and revoke an operator by calling the corresponding functions via stellar-cli:

Create a new identity for the operator

stellar keys generate operator
stellar keys fund operator

Get the operator's public key

stellar keys public-key operator

Grant the operator role by calling the corresponding contract function

stellar contract invoke \
--id <YOUR_CONTRACT_ID> \
-s admin \
--network testnet \
-- \
grant_operator \
--operator <THE_OPERATOR_ADDRESS>

The <THE_OPERATOR_ADDRESS> value is the address returned by the stellar keys public-key operator command above.

Revoke the operator role by calling the corresponding contract function

stellar contract invoke \
--id <YOUR_CONTRACT_ID> \
-s admin \
--network testnet \
-- \
revoke_operator \
--operator <THE_OPERATOR_ADDRESS>

Note: granting and revoking the company and manager roles follows the exact same process described above, using the following functions instead:

  • grant_company / revoke_company
  • grant_manager / revoke_manager