661 Commits

Author SHA1 Message Date
Thales Lima
052d11b759 feat: Add tokens balance check and component diff 2025-09-03 08:55:29 -04:00
Thales Lima
2c8e349280 feat: Add methods to fetch state from Tycho RPC 2025-09-03 08:55:29 -04:00
Thales Lima
160523a888 feat: add test runner structure 2025-09-03 08:55:29 -04:00
Thales Lima
e3ae70ab43 feat: add Tycho Runner to run separate tycho processes 2025-09-03 08:55:29 -04:00
Thales Lima
4425fe1680 feat: add util to build SPKG with a modified start block 2025-09-03 08:55:29 -04:00
Thales Lima
0bc39aee55 feat: add RPC logic and config yaml parsing 2025-09-03 08:55:29 -04:00
Thales Lima
8b6beb0214 feat: create rust-testing module 2025-09-03 08:55:29 -04:00
Tamara
354f61a360 fix: Fix dockerfile and docker-compose for testing suite (#239)
- This was broken after the postgresql-partman update: https://github.com/dbsystel/postgresql-partman-container/pull/32
- Also needed to specify proper env variables

Co-authored-by: TAMARA LIPOWSKI <data.lipowski@extaccount.com>
2025-08-29 18:19:39 -04:00
Zizou
6fba0b3b3d fix: update sdk version for uniswapv3/v4 and ekubo (#227)
This is following the bugfix in https://github.com/propeller-heads/tycho-protocol-sdk/pull/213

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-06-30 16:40:00 +00:00
die-herdplatte
1ff97ff43f Ekubo TWAMM & MEV-resist integration (#192)
* Add Ekubo TWAMM support

* Change order of words

* Account TWAMM order balances

* Fix tracking wrong component balance deltas

Swapped and PositionUpdated are the only events affecting pool TVL

* Fix fee addition

Fees are a .64 instead of a .128 since v2 & the result is rounded

* Consistent naming

* cargo fmt

* Add method for selecting store method from change type

* Only store the affected sale rate delta on OrderUpdated events

* Remove unnecessary parameterization

* Index Ekubo MEV-resist pools

* cargo clippy
2025-06-30 14:45:08 +00:00
Louise Poole
ef6c826a8a feat: update test suite to support DCI enabled protocols (#225)
* feat: update tycho-client and support testing DCI enabled protocols

* refactor: improve python Typing

* test: update test suite tycho-simulation dependency

The updated version includes an account_balances fix.

* refactor: use sets instead of lists

* feat: update tycho-client test dependency
2025-06-30 11:44:33 +02:00
Zizou
08e5794de0 remove comments (#226)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-06-27 12:11:10 +02:00
Domenico
7f9a995e8a Curve Adapter (Stable and Crypto Swap) (#29)
* feat: Initial manifest structure

* feat: Adapter initial development and price function implementation

* feat: Implemented getPoolIDs

* feat: Implemented getTokens

* feat: Implemented getCapabilities

* feat: Implemented getLimits

* feat: Implemented swap

* feat: Created Adapter version for CurveV2 pools uint256

* fix: Review Fixes

* chore: Formatted code and code adjustments

* feat: Separated contracts and finished tests for Curve Exchange(Crypto and StableSwap)

* feat: Adjusted naming and formatted tests code

* chore: Initial merging of swaps

* merge CurveCryptoSwapAdapter and CurveStableSwapAdapter into CurveAdapter

* Fix and Test: fixes on CurveAdapter.sol and created CurveAdapter.t.sol

* review and fixes

* removed unused test and parameters

* chore: Initial MetaPool underlying swap and ETH native implementation

* chore: expanded swap and sell functions to support seap for underlying tokens and LPS

* chore: expanded functionalities of CurveAdapter and fixed getTokens function

* fix: fixed registry.is_meta

* chore: fixes

* chore: extended adapter and implementing tests for new pools

* chore: updated Adapter, implementing final tests

* fixing eth transfer

* fix and tests: fixed adapter and finishing tests implementation

* using adapter with try catch

* feat: Final fixes for pools support, using try-catch

* chore: Removed chunk files

* chore: Formatted code and removed unused condition

* fix: Fixed calculatedAmount in sell function when receiveToken=ETH

* chore: Adjusted ETH pools check

* corrected metaregistry address

* fix: fixed int128 conversion to unit256

* feat: Removed registry from adapter

* feat: Implemented price()

* fix: Propeller review fixes

* review fixes

* fix: Final fixes for custom custom int128 pools

* chore: Removed unused test

* fix: Fixed price error in custom pools

* feat: Improved isInt128Pool function to support any coin

* fix: Fixed price for custom pools using ETH balance when token0 is WETH

* fix: Fixed price function and added AdapterTest support in test

* fix: Fixed divisions in getPriceAt

* feat: Added secondary ETH pool support, e.g. stETH

* refactor(curve-adapter): Avoid calling WETH contract if possible. (#65)

* refactor(curve-adapter): Avoid calling WETH contract if possible.

This PR aims to use native ETH instead of WETH when possible, this is to avoid having to index WETH contract.

* style(adapter): apply `forge fmt`

* refactor(curve): change limit factor to 2

---------

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

* refactor: fix Curve Adapter test after rebase

* fix: remove PriceFunction capability for Curve

This was wrongly implemented: it return the price for a quote and not the marginal price after the swap.

* refactor: improve adapter test and fix failing test for etherfi

---------

Co-authored-by: domenicodev <domenico.romeo3919@gmail.com>
Co-authored-by: mp-web3 <mp.web3.t@gmail.com>
Co-authored-by: Zizou <111426680+zizou0x@users.noreply.github.com>
Co-authored-by: Florian Pellissier <111426680+flopell@users.noreply.github.com>
Co-authored-by: Diana Carvalho <diana@propellerheads.xyz>
2025-06-27 12:03:32 +02:00
Alan Höng
1885467616 Fix typo 2025-06-26 11:53:32 +01:00
kayibal
c31d4728cf docs: Clarify price as marginal price explicitly 2025-06-26 11:53:32 +01:00
Louise Poole
58324a199f chore: fix typos 2025-06-26 12:33:31 +02:00
Louise Poole
c2bb3a8ca8 chore: fix cargo auto-resolution of tycho dependencies 2025-06-26 12:33:01 +02:00
mrBovo
fc0fb1e540 BalancerV3: SwapAdapter and Substreams (#126)
* feat: add balancer swapAdapter and Substreams

* fix: undo tycho-substreams logs, ignore abi on rustmft

* ci: prevent warnings from failing CI

* ci: skip size check on CI

* chore: forge fmt

* feat: vault balance from storage

Vault contract tokenBalance message are set according to the vault
storage changes in the `_reserveOf` storage variable VaultStorage.sol
contract
This was the culprit that caused the failure in simulation since
balancer enforces the invariant that `token.balanceOf(vault_addr) == _reservesOf[token]`

* ci: warnings

* fix: avoid duplicated balance changes

* fix: order by ordinal

* chore: format

* feat: extract new contracts before extracting balance changes

* feat: skip unnecessary steps if no balance change is found

* refactor: filter out account balances for tokens that aren't part of any protocol components.

On the indexer side, when we receive an account balance, we need to know about the token. This commit ensure that the token was introduced before we emit any account balance with it.

* refactor: don't index liquidity buffers.

Liquidity buffers rely on rate providers. Therefore we need DCI (feature to be able to index previously created contract) to deal with them.

* refactor: cleanup tests and add docstrings

* chore: lock tycho-substreams version

* ci: set Foundry workflow to use stable foundry

* feat(DCI): Add DCI Entrypoints to BalancerV3 components (#218)

* refactor: fix typo in weighted_pool_factory_contract name

* feat: add rate_providers static attributes

* feat: add DCI entrypoints to BalancerV3 components

* fix: set default trade price to Fraction(0, 1)

* feat: remove buffers as components

Buffers are to be used internally by Boosted pools (stable/weighted pools that use ERC4626 tokens). They are not to be treated as a separate swap component.

* test: update test blocks

Extend tests some tests block range to ensure liquidity was added to the pool and can be simulated on

* feat: remove buffers as components

Remove balance updates for buffer components

* feat: listen for pool pause/unpause events

* chore: formating

* fix: encoding call data

* test: update Balancer V3 tests to use DCI

* test: set indexer log level to info

* docs: add comment on support of boosted pools

* feat: update balancer v3 package version

---------

Co-authored-by: Thales <thales@datarevenue.com>
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louise@datarevenue.com>
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
2025-06-26 12:19:39 +02:00
Louise Poole
dfa87f662d fix(balancer_v2): skip adding zero address rate_provider entrypoints (#224) 2025-06-25 15:52:49 +00:00
Louise Poole
1c6c2c53c7 chore: bump tycho-substreams crate version (#223)
* chore: bump tycho-substreams crate version

* chore: update cargo.lock
2025-06-25 17:48:46 +02:00
greendianasaur
cfbf6812bd chore: Remove old execution and encoding files (#221)
They are unused now. See https://github.com/propeller-heads/tycho-execution for the new workflow
2025-06-24 13:37:00 +00:00
Louise Poole
d4670d4312 chore: remove duplicate tycho-substreams from cargo.lock (#222) 2025-06-24 13:46:44 +02:00
Zizou
27f178de59 fix(sdk): properly handle deletion -> creation -> deletion sequence (#213)
* 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>
2025-06-24 09:41:10 +00:00
Louise Poole
648a3bf419 fix: skip processing balances of bpt tokens (#220) 2025-06-19 16:27:26 +02:00
tvinagre
3f1beeab7c fix: Make get_block_storage_changes public (#214)
* fix: Make get_block_storage_changes public

* Make RpcTraceData caller optional

* feat: Create function to decode list of addresses
2025-06-16 21:40:39 +00:00
Zizou
7da01c745b feat: Balancer V2 DCI integration (#219)
* feat: Add DCI Entrypoints to BalancerV2 components

* fix: miscellaneous fixes before Balancer V2 resync

This commit fixes the entrypoints created by Balancer v2 packages, removes some disabled factories and remove support for BPT tokens (this is still to be investigated but so far we won't be able to support them)

* refactor: fix CI and bump version

* chore: update comments

---------

Co-authored-by: Thales <thales@datarevenue.com>
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louise@datarevenue.com>
2025-06-16 11:35:59 +02:00
Louise Poole
de5c9503bc feat: improve test logs (#217)
* feat: improve test logs

* refactor: remove unused code
2025-06-10 10:26:30 +02:00
Zizou
2620a5442d chore: add repository URL to ethereum-maverick-v2.yaml (#212)
* chore: add repository URL to ethereum-maverick-v2.yaml

* chore: bump maverick-v2 version.

This bump is needed because we changed the version of `tycho-substreams` in a previous commit (to fix the bug with contract creation).

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-05-23 17:21:44 +02:00
Zach
fb0a57bf07 feat: Add Maverick V2 adapter and substreams (#167)
Co-authored-by: Thales <thales@datarevenue.com>
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-05-23 17:07:15 +02:00
dianacarvalho1
a7841af383 feat: Add entrypoint utils and define EntryPointParams (#211)
* feat: Add entrypoint utils and define EntryPointParams

#time 23m


#time 0m

* fix: Make TraceData mandatory

#time 2m

* fix: Make component_id in EntryPointParams optional

#time 1m
2025-05-20 17:47:25 +01:00
zizou
7e73061f8e chore: add repository URL to substreams.yaml for ethereum_balancer_v2 2025-05-19 13:49:34 +02:00
Louise Poole
c778e7dee2 feat: extend DCI message structs (#210)
* feat: extend DCI message structs

* chore: add entrypoint params placeholder to transaction builder

* fix: rename call_data as calldata
2025-05-16 11:04:55 +02:00
Louise Poole
b13360c92b fix: change Entrypoint signature type to string (#209) 2025-05-14 15:42:44 +02:00
Zizou
43764fa5cb refactor: update test config to include coins (#208)
* refactor: update test config to include `coins`

* refactor: rename package to `ethereum_curve` and add repository URL in substreams.yaml

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-05-14 12:37:12 +02:00
dianacarvalho1
edee4b0b6b feat: Add get_block_storage_changes (#203)
* 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>
2025-05-14 09:18:07 +00:00
Zizou
e8bde64a23 fix: update tycho-substreams version in all vm packages (#206)
This is needed after https://github.com/propeller-heads/tycho-protocol-sdk/pull/201

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-05-14 10:57:22 +02:00
Khramtsov Valentin
1442215c91 fix: fix for publish-swap-encoders-package workflow (#207) 2025-05-14 10:57:30 +03:00
Zizou
62b178ad8f feat(curve): add coins in static attributes (#205)
* feat(curve): add coins in static attributes

This will be used by tycho-execution when executing swaps on the pool. It is needed because the `exchange` function takes token indexes and not addresses as input.

* style: make clippy happy with `format!`

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-05-13 18:57:06 +02:00
dianacarvalho1
2a77cf965c feat: Add entrypoint (#202)
* 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>
2025-05-13 11:31:36 +00:00
Louise Poole
b13b2b3cc0 ci: also detect cargo files in nested directories (#204) 2025-05-13 13:26:26 +02:00
Zizou
52d502198e fix: stop using buggy account_creations for creation tagging. (#201)
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>
2025-05-13 12:25:14 +02:00
Louise Poole
ee41e63775 feat: Update uniswap v3 package to use big endian encoding (#199)
* feat: update uniswap v3 package to big endian encoding

* chore: update use of format macro to make clippy happy
2025-05-05 13:54:11 +00:00
Louise Poole
01d97193b2 ci: Run substream checks only on changed substream modules (#200)
* ci: run substream checks only on changed substream modules

* ci: move substream package extraction code to a composite action
2025-05-05 15:47:49 +02:00
kayibal
30a6e11363 Fix testing env stup script
- Fails now if any command errors
- Conda environment activation is more stable now
2025-04-30 00:03:08 +01:00
Louise Poole
0f5bbae78c ci: freeze CI cargo version (#197) 2025-04-29 16:53:47 +02:00
Louise Poole
409cf15864 Revert "chore: update format! macro use to satisfy latest clippy version (#194)" (#196)
This reverts commit f29de67f1f.
2025-04-25 18:09:38 +02:00
Louise Poole
f29de67f1f chore: update format! macro use to satisfy latest clippy version (#194) 2025-04-25 15:13:01 +00:00
Zach
9740c92129 chore: update simulation dep (#190) 2025-04-03 09:25:09 +02:00
Louise Poole
97cab90b58 fix: fix script dependency check and paths (#186)
Allows you to run the script from outside of the testing directory.
2025-03-27 16:55:37 +01:00
Zizou
63f9c89429 fix: small fix and refactor after testing EkuboV2 (#188)
* fix: add `balance_owner` attribute for ekubo_v2 components

* refactor: rename `ekubo` into `ekubo-v2`

* refactor: freeze `substreams-helper` version in ekubo V2 module

* docs: improve integration test comment

* docs: add TODO to remove `balance_owner` in favor of `AccountBalances`

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-03-27 13:45:03 +00:00