Update readmes

This commit is contained in:
pistomat
2023-12-22 11:33:12 +01:00
parent e9ebf6f0c6
commit 03686d0dff
7 changed files with 29 additions and 23 deletions

View File

@@ -1,11 +1,10 @@
# Subtreams packages
This directory contains all substream packages that are used by the extractors to access certain data from diffrent
blockchains.
This directory contains all substream packages that are used to index integrated protocols across different blockchains.
## Adding a new package
To add a new package add folder. The naming convention is `[CHAIN]-[PROTOCOL_SYSTEM]`.
To add a new package add a folder. The naming convention is `[CHAIN]-[PROTOCOL_SYSTEM]`.
### Manifest
In this new folder add a manifest file `substreams.yaml`. You can use the template below to get started:
@@ -20,14 +19,11 @@ protobuf:
files:
- vm.proto
- common.proto
# You can specify any internal proto files here
importPaths:
# This is different compared to the substreams example,
# we need to share protobuf definitions with tycho you
# are invited to reuse existing definitions if they are
# useful to you.
- ../../proto/evm/v1
# any private message types only used in internal modules
# can remain local to the crate.
- ../../proto/tycho/evm/v1/
# Any private message types only used in internal modules
# can remain local to the folder.
- ./proto
binaries:
@@ -66,7 +62,11 @@ prost = "0.11"
```
There are already some generated rust files in the `src/pb` directory. These are generated from the protobuf files in the
There are already some generated rust files in the `src/pb` directory. These are generated
from the protobuf files in the `/proto/tycho/evm/v1` directory. They specify the output protobuf messages
we want to generate. The input Block is specified by the sustreams crate, specifically the [sf.ethereum.type.v2.Block](https://github.com/streamingfast/substreams-ethereum/blob/develop/core/src/pb/sf.ethereum.type.v2.rs) message.
You can define your own protobuf messages, make a new directory `/substreams/[CHAIN]-[PROTOCOL]/proto` for them.
Now we can generate the Rust protobuf code:

View File

@@ -82,7 +82,8 @@ fn map_changes(
.collect();
for block_tx in block.transactions() {
// Extract storage changes for all contracts relevant to this ProtocolComponent (i.e. Ambient)
// Extract storage changes for all contracts relevant to this protocol system.
// Ambient is a protocol system consisting of many ProtocolComponents (one for each pool), but they all share the same AMBIENT_CONTRACT contract.
let mut storage_changes = block_tx
.calls
.iter()