* 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>
* 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>
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>
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.
* 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>
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
* 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
* 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>
* 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
* 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>
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>