Skip to content

Commit 54667ab

Browse files
prernaadev01gitbook-bot
authored andcommitted
GITBOOK-228: dynamic token creation
1 parent b316d24 commit 54667ab

File tree

6 files changed

+43
-0
lines changed

6 files changed

+43
-0
lines changed

docs/.gitbook/assets/0 (20).png

29.5 KB
Loading

docs/.gitbook/assets/1 (22).png

21.6 KB
Loading

docs/.gitbook/assets/2 (24).png

19.3 KB
Loading

docs/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,8 @@
551551
* [Creating Token through UI using Token Template](guardian/tokens/token-template/creating-token-through-ui.md)
552552
* [📖 Token Authenticity](guardian/tokens/token-authenticity/README.md)
553553
* [ℹ️ Establishing Token Authenticity](guardian/tokens/token-authenticity/how-to-establish-token-authenticity.md)
554+
* [Dynamic Token Creation in Policies](guardian/tokens/dynamic-token-creation-in-policies/README.md)
555+
* [Dynamic Token Creation in Guardian Policies using UI](guardian/tokens/dynamic-token-creation-in-policies/dynamic-token-creation-in-guardian-policies-using-ui.md)
554556
* [🛠️ Token Operations](guardian/tokens/token-operations/README.md)
555557
* [⚙️ Token APIs](guardian/tokens/token-operations/token-apis/README.md)
556558
* [Token Listing](guardian/tokens/token-operations/token-apis/token-listing.md)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
icon: hexagon-image
3+
---
4+
5+
# Dynamic Token Creation in Policies
6+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
icon: sidebar-flip
3+
---
4+
5+
# Dynamic Token Creation in Guardian Policies using UI
6+
7+
For cases, when it is not known “a priori” how many different tokens will be created by the policy during its execution, the following facilities of CreateTokenBlock could be used to configure dynamic creation of the tokens triggered by policy events. Note that when this approach is used, each token is created and used for minting instances of, on the basis of MRVs produced by/for a specific device, which was represented by a VC passed into the CreateTokenBlock. In other words, the VC of the device becomes 1-to-1 linked with such token ID and later, when Issue Requests are delivered to the MintBlock, the system recognises the device these requests are produced for and mints instances of the corresponding tokens.
8+
9+
## To configure dynamic token creation:
10+
11+
1. In template configuration set **wipeContractId** property:
12+
13+
![Wipe contract property in token template configuration](<../../../.gitbook/assets/0 (20).png>)
14+
15+
2. In template configuration populate variables for token name and token symbol.&#x20;
16+
17+
**Examples:**
18+
19+
* tokenName: Device\_Token\_**${document.credentialSubject.0.id}**
20+
* tokenSymbol: DT\_**${index}**
21+
22+
**${index}** - is predefined variable and allows users to set up the additional variable part of the token number in tokenName or tokenSymbol dynamically at run-time. The value is auto-incremented witch each token mint so users can later differentiate such tokens if they are automatically created.
23+
24+
3. Set **autorun** property in the createTokenBlock - block will automatically create a token without requiring user’s actions (no manual approval will be required).&#x20;
25+
26+
**Requirements:**
27+
28+
* **defaultActive** should be false (preventing showing UI for createTokenBlock)
29+
* All fields in token template must be filled in
30+
31+
![Autorun property in createTokenBlock configuration](<../../../.gitbook/assets/1 (22).png>)
32+
33+
4. Populate **useTemplate** property in the tokenActionBlock, tokenConfirmationBlock
34+
35+
![useTemplate property in tokenActionBlock configuration](<../../../.gitbook/assets/2 (24).png>)

0 commit comments

Comments
 (0)