Dynamic Token Creation in Guardian Policies
Last updated
Last updated
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.
In template configuration set wipeContractId property:
In template configuration populate variables for token name and token symbol.
Examples:
tokenName: Device_Token_${document.credentialSubject.0.id}
tokenSymbol: DT_${index}
${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.
Set autorun property in the createTokenBlock - block will automatically create a token without requiring userâs actions (no manual approval will be required).
Requirements:
defaultActive should be false (preventing showing UI for createTokenBlock)
All fields in token template must be filled in
Populate useTemplate property in the tokenActionBlock, tokenConfirmationBlock