661 Commits

Author SHA1 Message Date
die-herdplatte
e4609bed0b Ekubo Integration (#172)
* fix: Implement ethereum-ekubo

* fix: Remove unnecessary store

* fix: Correct balance accounting

* Adjust deltas by fee at PositionUpdated event

* Add partial Ekubo integration

* Generalize Hexable

* Native Ekubo integration

* cargo fmt & clippy

---------

Co-authored-by: kayibal <alan@datarevenue.com>
Co-authored-by: Zizou <111426680+zizou0x@users.noreply.github.com>
2025-03-27 12:29:39 +01:00
Zizou
002d42d100 feat: add Uniswap V2 config for Unichain (#187)
* feat: add Uniswap V2 config for Unichain

* refactor: add URLs for Uniswap V2 config

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-03-27 10:38:29 +01:00
kayibal
0313c9b498 chore: Publish tycho-substreams to crates.io 2025-03-26 17:47:26 +01:00
Zizou
e0b2977417 feat: Add UniswapV3 config for Unichain (#184)
* feat: Add UniswapV3 config for Unichain

* refactor: add url in UniswapV3 configs

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-03-26 11:41:33 +01:00
Zizou
7ec5f0fb1f feat: add unichain config for uniswapv4 (#180)
* feat: add unichain config for uniswapv4

* refactor: remove `sf/substreams` from excluded proto.

This folder has been removed because it was not used, so we don't need to have it in the excluded paths anymore.

* refactor: add url into substreams config for uniswap v4 modules

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-03-25 16:47:55 +00:00
Louise Poole
6acf16a8c6 fix: update tycho indexer testing dep to 0.60.0 (#183) 2025-03-25 17:01:09 +01:00
Louise Poole
494205b859 chore: update testing simulation dependency (#182)
Update to a version that supports account balances
2025-03-21 17:58:25 +02:00
Louise Poole
aa378e6ef5 fix: handle token balances on add_contract_changes (#181) 2025-03-21 11:34:37 +02:00
Zizou
18d8969227 refactor: better attribute name for Pancakeswapv3 module (#179)
Also fixes an issue with inconsistent version tag between cargo and substreams files

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-03-19 11:50:01 +01:00
Zizou
4c1e773b1b feat: add Pancakeswap v3 Substreams module (#178)
* feat: Add Pancakeswap V3 Substreams module

At this point it's just hard copy of Uniswap V3. It will be adapted in the following commits to make reviewing easier.

* refactor: adapt uniswapv3 module logic for pancakeswap v3

The main change is how they handle protocol fees. Protocol fees are set by default depending on the fee of the pool.

* refactor: use new protobuf structs

The "EntityChanges" got deprecated in favor of the hybrid messages. This commit makes PancakeswapV3 module use the new structs.

* fix: set correct factory address

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louise@datarevenue.com>
2025-03-17 14:39:05 +02:00
Zizou
503a83595e refactor: remove unnecessary clones in UniswapV3 module (#177)
Also fixes a bug that would lead to emitting wrong balances if there is a `CollectProtocol` event triggered (currently not affecting because it's not enabled)

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-03-13 15:24:48 +01:00
kayibal
d49b3f59cb Add new SwapAdapter interface.
This new interface allos the pool id to exceed 32 bytes. Some protocol have more complex pool ids that exceed 32 bytes this adds support for these.

 Additionally, it allows passing additional data if required. This allows more sophisticated features such as fee reduction or potentially offchain data that is required during swap simulation.
2025-03-11 18:39:32 -05:00
Louise Poole
a61be78007 docs: improve initialized_accounts docs (#175)
* docs: improve initialized_accounts docs

* docs: improve initialized_accounts docs
2025-03-11 12:45:02 +00:00
Louise Poole
ae10195bca chore: remove unused substreams protobuf files (#171) 2025-03-06 12:07:29 +02:00
Louise Poole
f13c1c263b refactor(uniswap_v4): remove costly clone calls (#169)
* Removed costly `TransactionTrace` clones calls and `.clone()` at a few other places

* style: formatting

* chore: bump uniswap v4 versions to 0.2.1

* fix: fix double referencing

---------

Co-authored-by: Matthieu Vachon <matt@streamingfast.io>
2025-03-04 14:51:13 +00:00
Louise Poole
04d14db719 feat: publicly expose protobuf module (#170) 2025-03-04 16:48:14 +02:00
Khramtsov Valentin
dcf7cb94c1 fix: changed on condition for swap encoders (#168) 2025-02-26 16:47:41 +02:00
Louise Poole
20165c271e feat: move initial lp fee to static attributes (#161)
This initial lp fee value is used for generating the PoolKey. It is static and should be part of the ProtocolComponent static attributes.
2025-02-18 15:01:38 +02:00
Zizou
b1e7ba9e2f refactor(substreams): add rust-toolchain to the templates and modules. (#155)
* refactor(substreams): add `rust-toolchain` to the templates and modules.

This freezes the wasm output for each module, allowing us to have full control over each packages and when we break the modules hashes.

* fix(testing): allow no `initialized_accounts` in tests

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-02-17 08:29:07 +00:00
Zizou
6da2141f66 chore(substreams): add base Uniswap v4 config (#157)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-02-13 14:44:17 +01:00
kayibal
a7e1dd9397 Use tycho-substreams erc20 abi. 2025-02-06 11:04:39 -06:00
kayibal
7302989617 Use manual updates on singleton template. 2025-02-06 11:04:39 -06:00
kayibal
22f70ca110 formatting & lints 2025-02-06 11:04:39 -06:00
kayibal
5eb08acf82 Update docs 2025-02-06 11:04:39 -06:00
kayibal
08d2c7a82e feat(template): Add template for singleton protocols.
Separate templates and add one for protocols with only a single contract.
2025-02-06 11:04:39 -06:00
kayibal
d0e73a20ea feat(template): More detailed template.
Add a more detailed protocol implementation in the template. This should allow more ppl to get started quicker. Additionally more people will follow a predetermined structure
2025-02-06 11:04:39 -06:00
tvinagre
4eea400af5 docs: remove local testing docs and point to web docs (#151) 2025-02-06 16:16:13 +00:00
Zizou
dceea46655 fmt(substreams): update auto generated files (#150)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-02-06 17:13:25 +01:00
tvinagre
dbb79a6dca feat(testing): Improve SDK Testing module (#148)
* feat: import to tycho simulation initialized accounts defined on yaml file

* feat: update tycho-simulation dep, black formatting

* feat: Add additional logging to test runner

* feat: Fail test if expected component fails to get decoded

* feat: Warn if initialized contracts are not specified on ProtocolComponent contracts
2025-02-05 15:48:45 -03:00
Thales Lima
52072849f6 feat: Remove testing Dockerfile as it's currently broken 2025-02-05 13:46:42 -03:00
tvinagre
af8643ecb4 feat: Implement UniswapV4 Native integration (#125)
* feat: initial data structure + ABI & buf models

* feat: initial modules: identify new pools and events

* feat: map liquidity and balance changes, introduce balance delta calculation from liquidity

* feat: map tick deltas

* chore: undo weird formatting

* chore: undo weird formatting

* feat: map fee changes and aggregate data to final block structure

* feat: reimplement math natively, remove alloy and univ3sdk dependencies

* chore: make clippy happy + misc improvements

* chore: add rust generated files from buf & ABI

* chore: make clippy happy

* feat: add all modules to ethereum-uniswap-v4.yaml

* chore: update yaml file to skip unnecessary buf paths

* fix: update pb mod.rs

* fix: fix hex / utf-8 encoding. working version

* fix: simplify error handling, rename yaml file to match chain & formatting

* fix: fix ChangeType for sqrt_price_x96 on Initialization

* fix: make fee a non-static attribute

* fix: add balance_owner to univ4 pool

* feat: add uniswap-v4 mainnet yaml

* fix(uniswap-v4): miscellaneous fixes for UniswapV4 (#147)

* fix(uniswap-v4): correctly decode swap event deltas.

Deltas are given from a user debt perspective by the event (negative if received by the pool, positive if sent by the pool). In our usecase we need the opposite of this. This commit uses `.neg()` on the amount to apply them correctly.

* fix(uniswap-v4): correctly compute token amounts.

We were using `get_sqrt_ratio_at_tick` at the current tick to compute the amounts. This was incorrect because it provides the price at the tick boundary, but we might be mid-tick, which could lead to erroneous balances.

We now track the current price (updated by `initialization` and `swap` events) and use it when calculating the amounts.

* fix(uniswapv4): do not account for fees in swaps.

Previously we were adding fees as balances. But they are actually not part of the TVL and we aren't accounting for fees in the position changes (withdrawals). This commit addresses this and remove the fees from the token balances.

* refactor: fix pb mod.rs

* refactor: bump version and update sepolia config

* ci: make clippy happy

* refactor: clean unimath tests

* refactor: make logic clearer and improve docstrings

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>

---------

Co-authored-by: Zizou <111426680+zizou0x@users.noreply.github.com>
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-02-05 14:19:09 +01:00
Khramtsov Valentin
e413284017 chore: fix for old aws account id (#149)
* chore: fix for old aws account id

* chore: fix for old aws account id

* chore: test with changed branch

* chore: test with changed branch

* chore: test with install dependencies

* chore: prepare to pr
2025-02-05 11:09:51 +01:00
tvinagre
53ae0729ed feat: add uniswap-v3 Base yaml config (#145)
feat: add uniswap-v3 Base yaml config
2025-01-31 11:54:58 -03:00
Louise Poole
3c08359cf1 fix: allow setting of tokens balances on InterimContractChanges (#139) 2025-01-27 16:06:19 +02:00
Louise Poole
ad0a391f72 chore: clean up ambient (#136)
* 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
2025-01-27 10:36:13 +02:00
Louise Poole
28dd2fc858 feat: add AccountBalanceChange proto message (#137) 2025-01-23 11:00:12 +02:00
Thales
53f764972d docs: update substreams Readme.md 2025-01-22 23:15:19 -03:00
Thales
bd8cfa352f docs: remove READMEs and point to online docs 2025-01-22 23:15:19 -03:00
Zizou
1400fd413a refactor(substreams): reexport ABIs in tycho-substreams (#138)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-01-22 14:26:49 +00:00
Zizou
28c3bb9640 feat(base): add base uniswapv2 spkg (#134)
* feat(base): add base uniswapv2 Substreams spkg

* refactor: fix outdated spkg version for every uniswap v2 packages

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-01-21 15:09:27 +01:00
Louise Poole
ffd6da916a docs: improve testing docs (#133) 2025-01-16 15:49:46 +02:00
Zizou
98c63c685f refactor: stop using private pypi (#132)
* 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>
2025-01-16 09:07:57 +00:00
Zizou
5f319a6875 refactor: ensure consistent ABI iteration order in build files (#131)
Previously, build files iterated through ABIs in an inconsistent order, causing unwanted changes when the build was rerun, as the iteration order would differ. This commit resolves the issue by sorting ABIs by name, ensuring consistent formatting and preventing unintended changes in future commits.

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-01-10 11:45:14 +01:00
Louise Poole
6caafff860 fix(release): fix support of non-forked protocols (#105)
These protocols have yaml files simply called substreams.yaml
2025-01-07 16:17:40 +00:00
Louise Poole
97a20b60c0 fix: address missed repo renaming (#128) 2025-01-07 16:13:01 +00:00
Zizou
39934347b3 refactor(substreams): remove workspace dependencies (#129)
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>
2025-01-07 16:04:17 +00:00
Zizou
b8aeaa3dc6 chore(curve): fix curve tests (#121)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-12-09 18:01:42 +02:00
tvinagre
3c54b1d68d chore: bump curve version to 0.3.2 (#120) 2024-12-06 16:31:08 -05:00
Zizou
4d4d05203a fix(curve-substreams): miscellaneous fixes for balances extractions in Curve (#118)
* fix(curve-substreams): filter out reverted calls in `emit_eth_deltas`

* feat(substreams-sdk): extract balances from `Deposit` events in `extract_balance_deltas_from_tx`

* ci: ignore fmt for abi files

* feat(sdk): also account for `Withdrawal` event from WETH

* chore: reorder mod.rs, remove unused import

* chore: cargo fmt

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Thales <thales@datarevenue.com>
2024-12-06 18:21:07 -03:00
Zizou
d766116421 fix: contract creation/update tagging (#117)
* 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>
2024-12-06 17:59:39 -03:00