* fix(sdk): properly handle deletion -> creation -> deletion sequence
This commit resolves a bug that occurred when an attribute underwent a deletion, followed by creation, and then another deletion. The system would incorrectly ignore the final deletion because the attribute was mistakenly marked as newly created during the process.
* docs: fix typo
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* feat: add DCI message definitions
#time 4m
#time 2m
* fix: Make entrypoints into a HashSet instead of Vec
#time 0m
* fix: Rollback on message index change in ContractSlot
#time 5m
* feat: Add get_block_storage_changes
#time 34m
#time 0m
* Update substreams/crates/tycho-substreams/src/block_storage.rs
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* Update substreams/crates/tycho-substreams/src/block_storage.rs
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* fix: Filter out calls that are reverted and sort change by ordinal
#time 0m
* fix: Improve performance of get_block_storage_changes
We expect this util function to collect and handle a lot of information repeatedly (on every single block). So top performance optimisation (both memory and computation) is vital to minimise substream lags.
#time 6m
* fix: Use filter and flat_map instead of if and for loops
#time 1m
---------
Co-authored-by: Louise Poole <louise@datarevenue.com>
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
* feat: add DCI message definitions
#time 4m
#time 0m
* feat: Add add_entrypoint to TransactionChangesBuilder
#time 15m
#time 0m
* fix: Make entrypoints into a HashSet instead of Vec
#time 0m
* fix: Rollback on message index change in ContractSlot
#time 5m
* fix: Ignore examples in docstrings when running cargo test
---------
Co-authored-by: Louise Poole <louise@datarevenue.com>
the `call.account_creations` field had been deprecated by Substreams because of some edge cases where a new account wasn't detected.
This commit removes the usage of this field in our sdk contract extraction logic and some others specific places. We decided to rely on the call type instead. This approach should be much more robust.
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
* fix: remove unnecessary tx field in ProtocolComponent
* chore: move ambient protobuf files to ambient module
* chore: remove dependency on common message types
This allows us to isolate the ambient specific messages within the ambient module
* feat: update ambient substream with new message structs
* chore: update substream configs
And remove use of deprecated BlockContractChanges.
* feat: implement From for AmbientProtocolComponent to ProtocolComponent
* refactor: stop using private pypi
This was required because our repos were not public. Now that they are, people can directly access our Python packages and therefore they don't need access to our private codeartifact anymore
* docs: add a list of dependencies in the readme and early check in the setup env script
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
This is to make each substreams completely independent, before when we would need a new version of a dependency, we would have to change it for every crate which would lead to a change of every substreams module hash. We want to make every Substreams completely independant and frozen, this also helps to maintain a correct versionning.
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
* chore: add sfrax to rust fmt ignore
* fix(substreams-sdk): correctly mark contract creation.
Previously we would mark a contract as created if it was created in any transaction in this block. This would lead to some unexpected behavior if the contract was created and updated in the same block but in different transactions. In that case the update would be tagged as creation.
* feat: extract asset types for ng factory
This will allow us to detect pools with rebasing tokens and blacklist them until we can support them in `tycho-simulation`
* fix: correctly index math implementation for twocrypto factory
This implementation is immutable and not dynamic.
* fix: index cryptopool factory
This factory is needed for simulations by pools that have admin fees.
* chore: fix build sfrax abi contract
* Bump curve version
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: tvinagre <tvinagre@gmail.com>
Co-authored-by: Thales <thales@datarevenue.com>
* refactor(substreams): ignore transaction if contracts update are ignored.
There are some cases where we ignore contracts updates (for example if the old and new values are the same). In that case if the transaction only contains ignored updates we don't emit it.
* refactor(substreams): ignore deletions for freshly created attributes.
There are cases where an attribute can be created and deleted during the same transaction. To avoid sending a confusing deletion for something that was never created before, we just ignore the deletion in that particular case.
* feat(substreams): Add uniswap V3 logs only module (#98)
* feat(substreams): add uniswapV3 logs only Substreams module
* refactor(substreams): encode everything as big endian
* refactor(substreams): mark changes as creation when a tick liq is updated from 0
This will allow the SDK to detect cases where a tick is created and deleted in the same transaction and ignore it.
* ci(substreams): ignore built files for uniswapv3 logs only module and clean code
* refactor(substreams): update uniswapv3 substreams with new SDK interface
* feat(subtreams): emit default token balances value for uniswapv3
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
The `aggregate_balances_changes` was keeping a map of token -> balance_change per transaction. Therefore, if a transaction was causing a balance change for the same token but on differents components we would only keep the update for the last component updated and drop the others.
Adds the rate providers and additional attributes to balancers static attributes. These will help in the future to migrate some of the components to use the DCI.
Adds a small attributes module to tycho-substreams to make json encoding a bit easier.
This builder allows easier access to already changed contract addresses, and entity attributes while avoiding duplicated entries.
This is needed to implement the update markers on balancer substreams.
In case we get negative balances, which happens sometimes e.g. in balancer and seems to be due to some rounding issues within the protocol, we simply clip the balance at 0 so we never emit negative balances as tycho-indexer the upstream system will interpret the balance bytes as unsigned integers.