# 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**)

<figure><img src="/files/Wz8IVagBNY3R0Onj79C0" alt=""><figcaption></figcaption></figure>

**Please see** **example 2** **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

<figure><img src="/files/Y3LG176pRMdDm5LBWkMS" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/Pu0DMeLGLwL8yoh4AdNt" alt=""><figcaption></figcaption></figure>

2.1.2 Select token and action type

<figure><img src="/files/whGty85uxmGG1UvtnLrr" alt=""><figcaption></figcaption></figure>

2.2 Set user KYC

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

<figure><img src="/files/qOmnid8MGEhUOAg8jwEH" alt=""><figcaption></figcaption></figure>

2.2.2 Select token and the action type

<figure><img src="/files/0Xub8eirXYwNg3vH4Xy8" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/iFErxIribyL5BYkQ39xz" alt=""><figcaption></figcaption></figure>

3.2 Select token which will be minted

<figure><img src="/files/zJGNhVuLtn6lCThKA48m" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/0CZ63nuE9aTGwHyEpWfs" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/DLpuFTXQKgFUEoPedf94" alt=""><figcaption></figcaption></figure>

#### **Document Display**

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

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

<figure><img src="/files/r2h2Ca5yFhAmmfeEBgaD" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/75TiPls4VlheGc8u747E" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/7UKAMMldWgsUHXVmxIj5" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/cg0UG6oBnFmvCXoBi1jy" alt=""><figcaption></figcaption></figure>

### **Result:**

#### Create User

<figure><img src="/files/1NGri98ZmWKsOkQ741Dt" alt=""><figcaption></figcaption></figure>

#### Create Project

<figure><img src="/files/f6fc646Afo45qT5ZuUq3" alt=""><figcaption></figcaption></figure>

#### Mint Token

<figure><img src="/files/z6LaUevZivvysyAqIfQK" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.guardianservice.app/technical-information/library-of-policy-examples/token-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
