Commit 8ac4f90c authored by Michael Zaikin's avatar Michael Zaikin
Browse files

Fixup: links and minor improvements

parent ef6a7f0c
Pipeline #249298151 passed with stage
in 53 seconds
......@@ -4,7 +4,7 @@ Writing an off-chain event is quite simple, the main difficulty is to carefully
## Inferred events
First of all, make sure that you really need to implement an off-chain event: if you are using one of the [predefined types](./tzip-20.md) for storing token balances/metadata, indexers (or other consumers) will be able to infer updates on their own.
First of all, make sure that you really need to implement an off-chain event: if you are using one of the [predefined types](./tzip-20.md#basic-approach) for storing token balances/metadata, indexers (or other consumers) will be able to infer updates on their own.
## Event kind
......
......@@ -84,8 +84,8 @@ Example:
The `"michelsonParameterEvent"` field is a JSON object describing a sequence of Michelson instructions to run on a pair formed by a transaction parameter and an empty storage of the type implied by the event name in order to leave the execution stack with the event logs.
For this object we define 4 fields (all required):
- `"parameter"`: either `parameter` type of the contract, or a "reduced" type — a subset of contract entrypoints (requires [data normalization](./invoking-events.md)).
- `"returnType"`: Michelson type of the value left on the stack (must have an unambiguous [initial value](./invoking-events.md)).
- `"parameter"`: either `parameter` type of the contract, or a "reduced" type — a subset of contract entrypoints (requires [data normalization](./invoking-events.md#resolving-entrypoint-ambiguity)).
- `"returnType"`: Michelson type of the value left on the stack (must have an unambiguous [initial value](./invoking-events.md#empty-initial-value)).
- `"code"`: Michelson code expression implementing the event (a sequence of instructions).
- `"entrypoints"`: list of entrypoints that trigger this event implementation.
......@@ -125,7 +125,7 @@ Example:
The `"michelsonInitialStorageEvent"` accepts initial contract storage at the origination as a parameter. For this object we define 3 fields (all required):
- `"parameter"`: equals to the contract `storage` type except for *Big_maps* that should be replaced by plain *Maps*, it allows you to iterate over lazily stored data (see [data normalization](./invoking-events.md)).
- `"parameter"`: equals to the contract `storage` type except for *Big_maps* that should be replaced by plain *Maps*, it allows you to iterate over lazily stored data (see [data normalization](./invoking-events.md#data-normalization)).
- `"returnType"`: Michelson type of the event logs (i.e. for the value left on the stack).
- `"code"`: Michelson code expression implementing the event (a sequence of instructions).
......@@ -149,9 +149,9 @@ The `"michelsonInitialStorageEvent"` accepts initial contract storage at the ori
### Michelson extended storage event
The `"michelsonExtendedStorageEvent"` accepts storage from the operation result where all *Big_map* pointers are replaced with *Big_map_diffs* aggregated by *Big_map_id***extended storage** (see [data normalization](./invoking-events.md)). For this object we define 4 fields (all required):
The `"michelsonExtendedStorageEvent"` accepts storage from the operation result where all *Big_map* pointers are replaced with *Big_map_diffs* aggregated by *Big_map_id***extended storage** (see [data normalization](./invoking-events.md#data-normalization)). For this object we define 4 fields (all required):
- `"parameter"`: equals to the contract `storage` type except for *Big_maps* that should be replaced by plain *Maps*, it allows you to iterate over lazily stored data and work with storage as a whole (see [data normalization](./invoking-events.md)). Additionally *Big_map* values have to be wrapped with options in order not to lose information about removals.
- `"parameter"`: equals to the contract `storage` type except for *Big_maps* that should be replaced by plain *Maps*, it allows you to iterate over lazily stored data and work with storage as a whole (see [data normalization](./invoking-events.md#data-normalization)). Additionally *Big_map* values have to be wrapped with options in order not to lose information about removals.
- `"returnType"`: Michelson type of the event logs (i.e. for the value left on the stack).
- `"code"`: Michelson code expression implementing the event (a sequence of instructions).
- `"entrypoints"`: list of entrypoints that trigger this event implementation.
......@@ -196,19 +196,27 @@ NOTE that this specification doesn't linked to any particular token standard.
This method sets restrictions on the name (field annotation) and type of the ledger containing token balances. In order to cover more cases and be consistent with other standards, three common token workflows are addressed in this spec.
#### Single asset balance updates
`big_map %ledger address nat`
```
big_map %ledger address nat
```
where key is the owner's address and value is the amount of tokens owned.
#### Multi asset balance updates
`big_map %ledger (pair address nat) nat`
```
big_map %ledger (pair address nat) nat
```
where key is the pair [owner's address, token ID] and value is the amount of tokens owned.
#### NFT asset balance updates
`big_map %ledger nat address`
```
big_map %ledger nat address
```
where key is the token ID and value is owner's address.
#### Metadata updates
`big_map %token_metadata nat (pair nat (map string bytes))`
```
big_map %token_metadata nat (pair nat (map string bytes))
```
where key is the token ID and the value is the pair [token ID, token information]
### Custom approach
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment