Commit Graph

32 Commits

Author SHA1 Message Date
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
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
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
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
Zizou
9e8e360889 refactor(substreams): improve logic to ignore updates (#96)
* 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>
2024-11-07 05:16:55 +00:00
zizou
e064ea7aae fix(substreams-sdk): fix a bug in aggregate_balances_changes that was causing some balance changes loss.
The `aggregate_balances_changes` was keeping a map of token -> balance_change per transaction. Therefore, if a transaction was causing a balance change for the same token but on differents components we would only keep the update for the last component updated and drop the others.
2024-10-25 16:10:14 +02:00
Mattia Papa
3013cd9bfd Sfraxeth adapter and substream with SDK integration (#87)
* first commit

* feat: implemented get tokens and improved modifier

* feat: added missing functions (to implement)

* feat: implemented getPoolIds

* feat: implemented getCapabilities

* feat: implemented getLimits function

* fix: fixed constructor

* feat and fix: implemented testGetLimitsFraxEthV3 and fixed getLimits

* feat: implementing getPriceAt function

* feat and fix: finished implementing getPriceAt, fixed modifier

* feat: price function and tests implemented

* fix: removed onlySupportedTokens modifier from getPriceAt and applied it in price and swap function

* feat: implemented sell, buy, and swap functions

* implementing final tests

* aligned with main branch

* fixes

* fix: Review Fixes

* feat: 🎨 sfraxeth substream initial scaffolding

* fix: 🎨 protocol component creation at deployment block

* build: 💚 cargo build

* feat: 🎨 map proper event to balance changes

* fix: 🚚 remove unnecessary files

* fix: 💚 ci checks

Due to the CI checks requiring the latest rust nightly, the rust-lang organisation
introduced new doc related rules. This commit fixes the CI errors by making
the necessary changes to the comments in substreams-balancer comments

* fix: 🐛 wasm output name

* fix: 🐛 update starting block = deployment block -1

* feat: 🎨 add store for reward cycles and update balances accounting after after deposit before Withdraw

* feat: 🎨 finish setting up block reward logic

* docs: 📝 add comments on extra module

* build: 📌 adapt dependencies to workspace dependencies

setting prost-types to workspace version causes build errors

* feat: 🎨 add support for several EVM compatible networks

* fix: 🐛 update balance delta accounting logic following the `NextRewardCycle` event only

* fix: 🐛 hex address string param encoding

* fix: 🐛 deployment transaction check

* ci: 💚 ci check passing

* fix: 🐛 issues with hex-binary encoding

* refactor: ♻️ address mappings for various networks

* fix: 💚 formatting

* feat: Implemented testPoolBehaviour

* chore: Removed unused comments

* feat: ⬆️ update to recent sdk

* feat: 🎨 testing setup

* test:  setup test environminte for sfraxeth

* fix: 🐛 unwrap error in map_protocol_changes

* build: ⬆️ update rust version

* build:  remove unnecessary deps

* build: 🚚 remove unnecessary pb/tycho

* fix: 🐛 remove balance owner attribute

* fix: 🐛 remove unnecessary static attributes

* fix: 🐛 remove manual updates

* fix: 🔥 remove unused data model from contract.proto

* fix: 🐛 filter by known components

* feat:  use store delta for reward change accounting

* refactor: ♻️ remove shallow create vault component

* feat:  replace is_deployment_tx logic with simpler txn match

* test:  manual testing with inspection against etherscan

https://etherscan.io/address/0xac3E018457B222d93114458476f3E3416Abbe38F#events

* ci: 💚 ci checks

* fix: 🐛 map_protocol_components output data

* fix: 🐛 output type on map_protocol_changes

* test: 🧪 skip balance checks

* fixed FraxV3FrxEthAdapter arguments for constructor in manifest.yaml

* fix: 🐛 adapter error with overflow/underflow and addresses

* restore: restored previous adater version

* fix: set minimum swap amount to prevent overflow/underflow

* fix: set minimum swap amount only for sfrxETH -> frxETH

* improve: added print block_number to runner.py when get_amout_out fails

* removed console.log

* alignment with propeller main

* Update forge-std submodule reference to include ds-test

* installed protosim_py 0.21.0

* commented out minimum swap amount for sfrxEth -> frxEth pair

* updated adapter limits

* working on fixes

* fix: Adjust getLimits according to protocol limitation.

Previously limits were estimated with token supplies, this commit simplifies limits and adjusts them so they correspond closely with what is supported by the sfrxETH contract.

* chore: fmt

* wip: Changed ubuntu to 20.04, fmt adapters

* wip: Updated python tests

* wip: Trying with ubuntu: latest

* chore: fmt adapters

* wip: Using ubuntu 20.04

* chore: Switched back to ubuntu-latest

---------

Co-authored-by: Ignazio Bovo <ignazio@jsgenesis.com>
Co-authored-by: domenicodev <domenico.romeo3919@gmail.com>
Co-authored-by: kayibal <alan@datarevenue.com>
Co-authored-by: domenicodev <domenico.rom3@gmail.com>
2024-10-23 14:17:45 +01:00
zizou
4c448e701a ci: make clippy happy 2024-10-14 18:16:18 +02:00
zizou
42f2f45aa7 refactor(substreams): Update ambient Substreams 2024-10-14 18:09:17 +02:00
zizou
aff76f8cc7 chore: fix CI 2024-10-11 14:24:55 +02:00
zizou
73d48236ba feat(substreams): add substreams for Uniswap v2 and v3 2024-10-11 14:00:52 +02:00
zizou
558d85d912 chore(clippy): ignore long paragraph in generated files 2024-09-06 11:11:03 +02:00
Florian Pellissier
65ac765284 refactor(curve): add utils functions on ProtocolComponent 2024-08-09 10:39:14 +02:00
kayibal
ac279502c8 chore(balancer): formatting 2024-08-01 12:34:38 +02:00
kayibal
f5b4c54a99 chore: code formatting 2024-07-25 14:11:29 +01:00
kayibal
148fac276c feat(balancer): Add rate providers to static attributes.
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.
2024-07-25 14:11:29 +01:00
kayibal
2eb41d82f0 feat(tycho-substreams): Add builder for TransactionChanges.
This builder allows easier access to already changed contract addresses, and entity attributes while avoiding duplicated entries.

This is needed to implement the update markers on balancer substreams.
2024-07-25 14:11:29 +01:00
Zizou
96f67362bf Merge pull request #37 from propeller-heads/zz/update-protobuf
Update protobuf and Balancer Substreams
2024-07-23 15:19:14 +02:00
Zizou
ead8e17082 Merge pull request #53 from propeller-heads/fp/fix-vm-indexing
fix(substreams): Fix storage changes indexing for DELEGATECALL
2024-07-22 10:25:14 +02:00
Florian Pellissier
47e6f08338 docs: add changelog 2024-07-22 03:48:47 +02:00
Florian Pellissier
c48532a5c4 feat: Update protobuf messages for Balancer, add pool_id and balance_owner as entity changes 2024-07-22 03:48:29 +02:00
Florian Pellissier
7db72c284c feat: Update proto files 2024-07-22 03:48:29 +02:00
Florian Pellissier
e6edcd1fa2 refactor: only include changes if we know call.caller AND the call type is delegatecall or callcode 2024-07-19 14:35:45 +02:00
Florian Pellissier
33e5f6a236 fix(substreams): Fix storage changes indexing for DELEGATECALL 2024-07-19 12:18:58 +02:00
Florian Pellissier
ec6e16f465 refactor: Clean code and update cargo.lock 2024-07-12 15:47:22 +02:00
Florian Pellissier
7dbf3ffac6 feat: Add a generic function to extract balance deltas from Transfer events. 2024-07-12 14:59:23 +02:00
kayibal
e70d5f0e86 Clip balances at 0.
In case we get negative balances, which happens sometimes e.g. in balancer and seems to be due to some rounding issues within the protocol, we simply clip the balance at 0 so we never emit negative balances as tycho-indexer the upstream system will interpret the balance bytes as unsigned integers.
2024-03-14 11:04:41 +00:00
kayibal
b0fe5bc4e1 Add github CI for substreams 2024-03-14 02:03:59 +00:00
kayibal
6b6e42e2f8 Run rustfmt 2024-03-14 00:27:52 +00:00
kayibal
425628ae97 Create a workspace and make clippy happy. 2024-03-14 00:19:54 +00:00
kayibal
e62cc13c0b Move crates under substreams directory.
This way we can run GHA jobs depending on what files changed.
2024-03-13 23:57:23 +00:00