contract.texi (2092B)
1 @chapter Smart contract 2 3 There are primarily two distinct representations, one for the unique token and one for the batch. Both are expressed within the same data structure. 4 5 All serialized representations of numbers mentioned in the below are expressed in big-endian format. 6 7 8 @section Relational structure 9 10 At the highest level, a token is unambiguously identified by the sha256 hash of the json structure that describes it. 11 12 This is true regardless whether the token is a Unique Token or a Batched Token. 13 14 15 @subsection Token array 16 17 The tokens array contains every distinct token ever added to the contract. 18 19 The content of each entry is the sha256 content address of the token specification. 20 21 22 @subsection Token Allocation mapping 23 24 The token mapping defines the parameters for individual tokens allocations. 25 26 For a Unique Token there will only ever be one Token Allocation. 27 28 Every entry in the array defines how many tokens were issued for the batch, and a current count of how many individual tokens have been minted from that batch. 29 30 For a Token Batch, it also keeps track of whether or not sparse token minting has occurred. See below for more details on sparse minting. 31 32 33 @subsubsection Minted Token mapping 34 35 The mintedToken mapping defines the state of a minted token, e.g. the ownership and its position in the token issuance hierarchy. A minted token can be either unique or one of a batch. 36 37 For unique tokens, the key of this mapping will always be the same as the sha256 content address of the token specification. 38 39 For a batched token, the key will be the first 48 bytes of the content address, then 2 bytes describing the batch of the token, and 6 bytes describing its index within the batch. 40 41 The value of this mapping contains the remainder of the hash that has been supplanted by the batch and index in the key (bytes 2 through 10), as well as the owner address (bytes 12 through 32. 42 43 The first byte of the value is reserved for control bits. 44 45 The first bit, if set, disambiguates an actually set value from an empty value. 46 47 The second bit, if set, indicates a unique token.