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