# Token Operations

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

## **Task Summary**

Create a token with which newly registered users would be automatically linked. After the registration these users would be able to create documents which would be used for minting tokens at the rate of 1 token to 1000 units of value in the document.

## **Preparation**

First step in the execution of the policy would be user registration. To enable this we will create a corresponding schema which would contain ‘**First name***’ and ‘***Last name***’* fields.

Second step of policy execution is data input and document submission. To enable this we will create a corresponding schema containing ‘**Organization name***’* and ‘**Amount’** fields

To enable document submission we will use document input block (**requestVcDocumentBlock**) and document persistence block (**sendToGuardianBlock**)

![creating new\_user\_registration Block](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-9cb09d304567a2b6480ea5f7ca39668844ce9f88%2F0%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

**Please see** [**example 2**](https://guardian.hedera.com/guardian/standard-registry/policies/library-of-policy-examples/data-input-via-forms-using-roles-to-partition-user-activities.) **for the more in-depth guide of working with documents in Guardian Policies.**

### **Token operations**

1. Create a token instances of which will be minted.

Switch to the ‘**Tokens**’ tab and create a new token

![Creating a New Token](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-659c79e8adac0bd92b54b64d04a1cde6041ac08c%2F1%20\(2\)%20\(2\).png?alt=media)

2. Please note we created a token with ‘*KYC’* flag as ‘on’. This imposes the requirement to perform a KYC action on users before they can receive the token:

2.1 Link the token to the user via the ‘**tokenActionBlock*****'***

2.1.1 Add ‘**tokenActionBlock*****’*** immediately after the user registration

![Adding TokenActionBlock](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-f73bfe2cc077015c307a1782a31e4d40e7aac520%2F2%20\(2\).png?alt=media)

2.1.2 Select token and action type

![Selecting Token and Token Action Type](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-3cab3c610ffc460d1c8e3e6c34fe36cb41ca3436%2F3%20\(1\)%20\(3\).png?alt=media)

2.2 Set user KYC

2.2.1 Add ‘***tokenActionBlock’*** immediately after ‘*token\_associate’*

![Adding tokenActionBlock](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-6a2f958268415770d8ddd38a308e4f234a6c0b38%2F4%20\(1\)%20\(1\)%20\(3\).png?alt=media)

2.2.2 Select token and the action type

![Selecting Token and Action Type](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-8c2ff12172e639372310611be4581093e36c2210%2F5%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

3. User ‘**tokenActionBlock*****’*** to mint tokens

3.1 Add ‘**mintDocumentBlock*****’*** immediately after saving the new document (**save\_new\_documents**)

![Adding mintDocumentBlock](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-850d1598feeac4d8f9b0f9513080531c298cdd46%2F6%20\(7\).png?alt=media)

3.2 Select token which will be minted

![Selecting Token from dropdown](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-4e05db45ca82b8da176628368d457a96d69f91b6%2F7%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

3.3 Configure the formula which would define the amount of tokens minted

![Adding formula for tokens](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-8c0a0827278d8952729211b97d135a54de8c6106%2F8%20\(3\)%20\(1\)%20\(1\).png?alt=media)

3.4 Configure the account where tokens will be sent to upon minting

![Configuring Account type](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-984175c6db8d584fe5e3cf2d5427bb586be7ac78%2F9%20\(1\).png?alt=media\&token=60d6c9e0-cd2a-4a13-a0cc-5d88d21febb2)

### **Document Display**

1. To show documents use ‘**interfaceDocumentsSourceBlock*****'***

1.1 Add a new container in which the grid containing results would be placed

![Adidng Container Block](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-d9c27bdb1da8c002d7a6c5e232bb6ac526964136%2F10%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

1.2 Ensure that ‘*documents’ and ‘tokens’ are displayed in separate tabs*

1.2.1 In the parent block set property ‘**Type’** to ‘Tabs’

![Setting the Property Type to TABS](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-f651cb0ab1ef3e023d37a8fef371d85e4441a6fa%2F11%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

1.2.2 Set the property ‘**Title’** to configure tab titles

1.3 Add **‘interfaceDocumentsSourceBlock*****’** into the ‘tokens’* container and configure its columns

![Adding interfaceDocumentsSourceBlock](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-1a2951561d539e5dc2880947f6d24cabea98309c%2F12%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

1.4 Use ‘***documentsSourceAddon’*** block to retrieve data from the database.

![Adding documentSourceAddon Block](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-8065af77a7c364c90cdd023b66798b9e9a4dbf77%2F13%20\(1\).png?alt=media)

## **Result:**

### Create User

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-d36fca86adf588c4c8a7820c443b507cea7e91c1%2FTemplate_3_demot_01.png?alt=media" alt=""><figcaption></figcaption></figure>

### Create Project

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-cddf478a6539927c0b790d7de1dc1fac188609f6%2FTemplate_3_demot_02.png?alt=media" alt=""><figcaption></figcaption></figure>

### Mint Token

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-3e1454b43e5ddd9ea0648433d0fa86485600bfb0%2FTemplate_3_demot_03.png?alt=media" alt=""><figcaption></figcaption></figure>
