* refactor: Misc improvements to code
- Decouple validating logic from TychoRunner
- Move all data fetching and decoding the tycho message into the same method
- Split validate_state into validate_state, validate_token_balances and simulate_and_execute
- Make rpc_provider and runtime attributes of TestRunner
- Add references where possible to avoid clones
- Remove unnecessary code
- Make clippy happy
#time 2h 36m
#time 0m
#time 3m
* chore: Use tycho deps and foundry from tycho_simulation
This is to try to decrease the risk of using conflicting versions in the different repositories
#time 32m
#time 0m
* chore: Read RPC_URL in main.rs
#time 10m
* fix: Support eth trades (skip balance and allowance overwrites) and set balance overwrite to amount in
For tokens like USDC setting the balance super high was making us getting blacklisted
#time 1h 12m
* fix: Fix curve tests and filter components_by_id with the expected_component_ids
#time 1h 30m
#time 0m
* fix: Don't use all the possible executor addresses. Hardcode just one for the test
Refactor overwrites logic:
- renamed functions
- moved logic around that fits together
- don't use StateOverrides and then convert to alloy overrides. Use alloy's directly
#time 1h 21m
* fix: Assume that the executors mapping starts at storage value 1
Move setup_router_overwrites away from the rpc and into the execution file
Delete unnecessary get_storage_at
#time 33m
It's not good to keep this in the test_runner because then we have multiple points that we need to edit the test config, which can be hard to find.
We need this because the module name for uniswap_v2 is so far different from the rest of the protocols.
* 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>
* 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>
* 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>
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>
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>
* chore(lib): update testing suite with new naming
* refactor(curve): remove metapool
These pools aren't compatible yet due to how they are created (first the lp token and then later the pool). We will need DCI to handle this properly.
* chore(lib): use correct package name for tycho-simulation
---------
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
The bug occurred when a Transfer event involved both the sender and recipient being pools. In such cases, the previous implementation only created a BalanceDelta for the "to" address and missed accounting for the "from" address.