dERP Base Contract

Managing Responsibilities

System Access Structure

SuperAdmin: Organizational leader of the system. Controls all access. Admin: A managerial user of the system. Create and group users. Users: The team. Generic access to the system.

Creating Users and Controlling Access

The dERP Base Contract is responsible for managing the creation and management of users, organizations, and SBT addresses. It defines several message types that are used to perform various actions such as minting new SBT, setting the SBT address for a user, changing the owner of the contract, creating new users, archiving, and unarchiving users, and enabling and disabling admin privileges for users. Each message type is defined using JSON-Schema which ensures that the input parameters are in the correct format and that all required fields are present.

The instantiate message type is used to create a new instance of the contract and requires the following fields: "denom", "id", "owner", "sbt_address", and "url".

  • 'denom' field: denomination of the SBT

  • 'id' field: unique identifier for the contract

  • 'owner' field: address of the owner of the contract

  • 'sbt_address' field: address of the SBT

  • 'url' field: URL of the contract's metadata

The execute message type is used to perform various actions on the contract and is defined as a ‘oneOf’ object, meaning that it can take one of several different forms depending on the action being performed. The ‘mint_sbt’ message type is used to mint new SBT and takes a single object as input. The ‘set_sbt_address’ message type is used to set the SBT address for a user and takes an object with a single field "addr" which is the address of the SBT. The ‘change_owner’ message type is used to change the owner of the contract and takes an object with a single field "addr" which is the address of the new owner. The ‘create_user’ message type is used to create a new user and takes an object with a single field "user_addr" which is the address of the user.

The ‘archive_user’ message type is used to archive a user, which means that the user will no longer have access to the dERP platform. The message type requires a single parameter, "addr", which is the address of the user to be archived. The ‘unarchive_user’ message type is used to unarchive a user, which means that the user will regain access to the dERP platform. This message type also requires a single parameter, "addr", which is the address of the user to be unarchived.

Both the ‘archive_user’ and ‘unarchive_user’ message types are typically used by the SuperAdmin or other authorized users to manage access to the dERP platform for specific users.

Additionally, the ‘enable_admin’ message type is used to enable admin access for a user, which means that the user will have access to the dERP platform with admin privileges. This message type also requires a single parameter, "addr", which is the address of the user to be granted admin access.

All these message types, along with the other available message types in the dERP Base Contract, work in conjunction to allow for the management and control of users, access, and privileges within the dERP platform.

Querying

This contract includes a query function that allows for querying certain information from the contract. The dERP Base Contract includes the "holds_sbt" query which takes an "addr" parameter, which is the address of the user to check if they hold any dERPs and returns a boolean indicating if they do or not. The "owner_of" query takes a "token_id" parameter, which is the unique identifier of a dERP token, and returns the address of the owner of that token.

Last updated