๐Ÿ”ŽMRV Document Operations

For a demo example of following steps, here is the policy timestamp: 1675164736.675731674

Task Summary

There are two roles: โ€˜Userโ€™ and โ€˜Approverโ€™. User can create projects and send project definition documents to the selected Approvers. After the approval, User can add MRV reports to the project. On the basis of this documents the policy will be minting tokens into the account configured in the project.

Preparation

  1. Create 2 roles โ€˜Userโ€™ and โ€˜Approverโ€™ and the corresponding containers

(See example 1 for the more detailed description of how to work with roles)

  1. Create all needed document schemas:

2.1 Schema for โ€˜Userโ€™ containing the fields: First name, Last name

2.2 Schema for โ€˜Approverโ€™ containing the fields: First name, Last name

2.3 Schema for โ€™Projectโ€™ containing the fields: Project name, Account ID

In order to mint tokens into another account (not into the account of the minting user) setup the required field

2.4 Schema for โ€™Reportโ€™ containing the following fields: Start Date, End Date, Amount

(Please see example 2 for the more detailed description of how to work with Documents)

  1. Add blocks for registering โ€˜Userโ€™ and โ€˜Approverโ€™ into the containers created in the step 1

Note: it is important that DID of the user is used for ID of the documents as this value will be used further in the document for filtration

  1. Add simplified grids for displaying Projects, Reports and Tokens

  1. Create the token

Document Operations

1. Project Definition

1.1 Create a project

1.2 Save the project

1.3.1 Since another (not current user) account is used for minted tokens โ€™tokenActionBlockโ€™ cannot be used, instead we will use โ€˜tokenConfirmationBlockโ€™

1.3.2 To configure the target account for mixed tokens select โ€˜Customโ€™ value for โ€˜Typeโ€™ and the filed in the document from which to take the value for the Account ID (this field must have type: โ€˜Accountโ€™)

1.3.3 By default โ€™tokenConfirmationBlockโ€™ does not have a link to the next block, thus it needs to be manually added

1.4 Add an approver as after the creation the project is not assigned to anyone

1.4.1 Add โ€™interfaceActionBlockโ€™ wrapped into a container.

1.4.2 Select Dropdown value for Type

1.4.3 Use system field assignedTo to filter documents based on users they are assigned to.

Record value from assignedTo into Field (This field will be changing our block)

1.4.4 Configure values from which fields from the document would be labels, and which ones would be values

1.4.5 Use โ€˜documentsSourceAddonโ€™ for data for Dropdown.

1.4.6 Save the changed document

1.4.7 As โ€˜documentsSourceAddonโ€™ does not have default events, we need manually add them.

1.4.8 Return to grid settings and add Dropdown into the target column.

1.5 Project Approval. Setting up the grid for project approvals.

1.5.1 To select only the projects assigned to the current Approver set the โ€˜Assigned to Userโ€™ flag

1.5.2 Add document approval block

(Please see example 2 for the more detailed description of this workflow)

1.5.3 Add Approve button into the grid

1.5.4 After the Approve, setup the KYC for the account connected to the project

Use โ€˜tokenActionBlockโ€™ with the appropriate settings

1.5.5 Configure the signing/verification of the document with the Approver signature by adding โ€˜reassigningBlockโ€™. This block creates a copy of the source document and re-signs it with the key of the selected user.

1.5.6 Add Status attribute for easy filtering

2. Report.

To enable report creation only for approved projects, add create button into the grid selectively for documents with โ€˜Approvedโ€™ status

2.1 Add a โ€˜documentsSourceAddon' block to differentiate the documents on the basis of their status

2.2 Repeat the sequence for project creation to create the report

Note: switch off โ€˜Default Activeโ€™ since create report button does not need to be an independent object

2.3 Add the button for creating reports into the grid

2.4 Use โ€˜mintDocumentBlockโ€™ for creating (minting) tokens

3. Results

3.1 Reports

3.1.1 Add grid to display reports

3.1.2 To filter reports on the basis of their project add dynamic filter โ€˜filtersAddonโ€™

3.1.3 Documents created on the basis of other documents are automatically linked via the ref field. Use it for filtration

3.1.4 Add the data source for the filter which will display all approved projects of the current user

3.1.5 Add display of all minted tokens

Demo

Choose a role

Create Approver

Create User

Create Project

Associate token

Choose an approver

Approve project

Create report

Last updated