Skip to content

Commit b37e583

Browse files
committed
docs: Add declared calls to the manifest spec
1 parent 7405863 commit b37e583

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: docs/subgraph-manifest.md

+25
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ The `mapping` field may be one of the following supported mapping manifests:
7474
| **event** | *String* | An identifier for an event that will be handled in the mapping script. For Ethereum contracts, this must be the full event signature to distinguish from events that may share the same name. No alias types can be used. For example, uint will not work, uint256 must be used.|
7575
| **handler** | *String* | The name of an exported function in the mapping script that should handle the specified event. |
7676
| **topic0** | optional *String* | A `0x` prefixed hex string. If provided, events whose topic0 is equal to this value will be processed by the given handler. When topic0 is provided, _only_ the topic0 value will be matched, and not the hash of the event signature. This is useful for processing anonymous events in Solidity, which can have their topic0 set to anything. By default, topic0 is equal to the hash of the event signature. |
77+
| **calls** | optional [*CallDecl*](#153-declaring-calls) | A list of predeclared `eth_calls` that will be made before running the handler |
7778

7879
#### 1.5.2.3 CallHandler
7980

@@ -95,6 +96,30 @@ The `mapping` field may be one of the following supported mapping manifests:
9596
| --- | --- | --- |
9697
| **kind** | *String* | The selected block handler filter. Only option for now: `call`: This will only run the handler if the block contains at least one call to the data source contract. |
9798

99+
### 1.5.3 Declaring calls
100+
101+
_Available from spec version 1.2.0_
102+
103+
Declared calls are performed in parallel before the handler is run and can
104+
greatly speed up syncing. Mappings access the call results simply by using
105+
`ethereum.call` from the mappings. The **calls** are a map of key value pairs:
106+
107+
| Field | Type | Description |
108+
| --- | --- | --- |
109+
| **label** | *String* | A label for the call for error messages etc. |
110+
| **call** | *String* | See below |
111+
112+
Each call is of the form `<ABI>[<address>].<function>(<args>)`:
113+
114+
| Field | Type | Description |
115+
| --- | --- | --- |
116+
| **ABI** | *String* | The name of an ABI from the `abis` section |
117+
| **address** | *Expr* | The address of a contract that follows the `ABI` |
118+
| **function** | *String* | The name of a view function in the contract |
119+
| **args** | *[Expr]* | The arguments to pass to the function |
120+
121+
The `Expr` can be either `event.address` or `event.params.<name>`.
122+
98123
## 1.6 Path
99124
A path has one field `path`, which either refers to a path of a file on the local dev machine or an [IPLD link](https://github.com/ipld/specs/).
100125

0 commit comments

Comments
 (0)