Features Implemented
This is a matrix that reports the current progress in implementing various TokenScript directives
Last updated
Was this helpful?
This is a matrix that reports the current progress in implementing various TokenScript directives
Last updated
Was this helpful?
Feature
iOS (AlphaWallet 3.05)
Android (AlphaWallet 3.1.1)
Tokenscript Debugger* (in development)
Distinct Attribute
n/a
n/a
n/a
Distinct Attributes are used to identify a token. A distinct attribute is defined by setting distinct
to true.
If there is only one distinct attribute in a token, then the number of unique values of this attribute determines how many token instances are there.
If there is no distinct attribute defined in a Token, TokenScript Engine takes a default value ownerAddress=${ownerAddress}
as its .
In this example, which is part of a TokenScript that defines a Car Ownership Toke. Vehicle Identification Number ("vin") is an attribute that identifies a car:
Since VIN is a distinct token, each distinct values of this attribute is used to create a distinct token. So, let's say that the function getCars()
in this example returns an array of two values:
Both are instances of the Car Token. If the TokenScript engine is running in a user's wallet, it would render two distinct cars.
The following code defines a distinct attribute called tokenId.
If the smart contract returns 2 values for it:
0x59a7a9fd49fabd07c0f8566ae4be96fcf20be5e1
0xd915c8AD3241F459a45AdcBBF8af42caA561A154
then the TokenScript engine identifies 2 tokens, each identified with:
tokenId=0x59a7a9fd49fabd07c0f8566ae4be96fcf20be5e1
tokenId=0xd915c8AD3241F459a45AdcBBF8af42caA561A154
In fact, this attribute can be found in all ERC721 tokens, as ERC721 requires an attribute tokenID to identify a token. However, such a design may not suit other tokens who doesn't benefit from being shoe-horned into ERC721.
Then, the TokenScript engine should interpret that there are 2Car Tokens, identified the following two :