Commit Graph

477 Commits

Author SHA1 Message Date
Louise Poole
ad0a391f72 chore: clean up ambient (#136)
* 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
2025-01-27 10:36:13 +02:00
Louise Poole
28dd2fc858 feat: add AccountBalanceChange proto message (#137) 2025-01-23 11:00:12 +02:00
Thales
53f764972d docs: update substreams Readme.md 2025-01-22 23:15:19 -03:00
Thales
bd8cfa352f docs: remove READMEs and point to online docs 2025-01-22 23:15:19 -03:00
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
28c3bb9640 feat(base): add base uniswapv2 spkg (#134)
* feat(base): add base uniswapv2 Substreams spkg

* refactor: fix outdated spkg version for every uniswap v2 packages

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-01-21 15:09:27 +01:00
Louise Poole
ffd6da916a docs: improve testing docs (#133) 2025-01-16 15:49:46 +02: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
5f319a6875 refactor: ensure consistent ABI iteration order in build files (#131)
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>
2025-01-10 11:45:14 +01:00
Louise Poole
6caafff860 fix(release): fix support of non-forked protocols (#105)
These protocols have yaml files simply called substreams.yaml
2025-01-07 16:17:40 +00:00
Louise Poole
97a20b60c0 fix: address missed repo renaming (#128) 2025-01-07 16:13:01 +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
b8aeaa3dc6 chore(curve): fix curve tests (#121)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-12-09 18:01:42 +02:00
tvinagre
3c54b1d68d chore: bump curve version to 0.3.2 (#120) 2024-12-06 16:31:08 -05: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
ae7203025c chore: rename pancakeswap to pancakeswap_v2 (#115)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-11-26 14:47:44 +07:00
Zizou
9561cc9b8a fix(curve): index two crypto factory (#114)
* fix: index two crypto factory

* ci: make clippy happy

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-11-18 18:16:08 +01:00
Zizou
fa9e5180fc chore(curve): bump version to 0.3.0 (#110)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-11-07 12:22:47 +07: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
aca3bc4f71 refactor(curve): Update testing suite and remove metapools factories (#109)
* 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>
2024-11-07 05:05:37 +00:00
Alan Höng
723f4678bf Merge pull request #108 from propeller-heads/ah/add-license
chore: Create LICENSE
2024-11-06 12:44:43 +07:00
Alan Höng
e17a2412db Create LICENSE 2024-11-06 12:41:18 +07:00
Markus
7518459421 Name change in readme to protocol SDK 2024-11-04 19:15:10 +07:00
Zizou
baadd0212d fix(balancer): Ignore PoolBalanceManaged for not indexed pools (#106)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-11-01 11:13:56 +07:00
Zizou
eea8b27112 fix(balancer): miscellaneous improvements before resync (#104)
* fix(balancer): ignore self balance change

Euler pool emit a balance change for the pool itself. We don't want to have it because it's an unknown token from Tycho's perspective.

example: https://etherscan.io/tx/0x4a9ea683052afefdae3d189862868c3a7dc8f431d1d9828b6bfd9451a8816426#eventlog#338

* refactor(balancer): rename balancer module to balancer-v2

* ci: make clippy happy

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-10-31 15:12:37 +02:00
Zizou
64ca72cfa9 feat(balancer): add missing weighted factories (#103)
* feat(balancer): add weigthed pool factory v1

* feat(balancer): add weigthed pool factory v2 and v3

* fix(evm): fix compilation bug due to a bugged solc version

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-10-31 11:24:10 +00:00
Louise Poole
d12834cfc5 fix: improve handling of forked protocols on substreams release workflow (#95)
* fix: improve pre-release naming and handling of forked protocols

* fix: build packages for all forked protocols on a new release
2024-10-31 13:00:30 +02:00
Zizou
9f75d47202 fix(sfrax): update aggregate_balances_changes usage to the new interface (#101)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-10-30 15:46:08 +07:00
Louise Poole
c4bb7418b9 Merge pull request #99 from propeller-heads/lp/uniswap-v2-default-balances
feat(uniswap_v2): set default balances on pool creation
2024-10-28 13:42:05 +02:00
Domenico
e484ea28ca Sdk implementation: Sfrax adapter and substream (#91)
* feat: initial setup

* feat: implemented getCapabilities and getTokens

* chore: adjusted getPoolIds

* feat: Initial implementation of getLimits()

* feat: implemented getLimits, getTokens and internal functions for amounts

* feat: implemented price

* feat: implemented swap function

* fix and test: fixed minor issues on adapter and setup test

* debugging price function

* fix: debugged price function and fixed getPriceAt function

* test: testOneIncreasingPriceFoundFraxV3SFrax

* fix: debugging and fixing buy function

* fix: fixed getPriceAt

* test: testing post trade price

* fix: Fixed getPriceAt

* fix: Fixed getLimits

* fix: Fixed prices and improved readability

* fix: Fixed price and transfers in swap

* feat: Finished tests

* chore: Changed approve to safeIncreaseAllowance

* feat: created substream for staked frax

* feat: remove useless files

* feat: fixed dependencies in cargo.toml

* feat: rename folder

* feat: updated cargo.lock

* feat: changed lib.rs, added modules.rs

* feat: update modules.rs with corrects addresses

* feat: rename folder in ethereum-sfrax

* feat: remove useless comments, change locked asset address, rename

* feat: undo changes on mod.rs in ethereum-balancer

* feat: rename variable

* feat: update substreams/cargo.toml

* feat: modify ristfmt.toml

* feat: performed code formatting

* feat: modify src/abi

* feat: performed formatting with nightly

* feat: fix addition opeation

* feat: adjust code with for i, f

* feat: performed fmt inside ethereum-sfrax folder

* feat: performed clippy

* feat: fix with clippy warning suggests

* feat: undo any change in ethereum-balancer

* feat: change stakedfrax_contract.rs

* fix: stakedfrax_contract.rs

* feat: add blank line

* feat: add #[allow(clippy::all)] on ethereum-sfrax/src/abi/mod.rs

* feat: update comments on pool_factories.rs

* feat: update cargo.toml and substreams.yaml

* feat: add tycho evm in pb folder

* feat: add params to take contracts' addresses

* feat: add logic to map rewards_cycle

* feat: performed fmt and fix versioning

* feat: remove useless functions

* feat: add logic to track rewards_to_distribute

* feat: passing CI

* fix: substreams.yaml

* feat: fixed params in manifest

Co-authored-by: mrBovo <bovo.ignazio@proton.me>

* feat: fixed error in map_relative_balances function

* feat: passing CI checks

* fix: 🐛 hex-binary address encoding + refactoring vault-> underlying map

* style: 💄 fix formatting

* feat: Implemented testPoolBehaviour

* alignment with propeller main

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

* files update to match propeller/main

* creating integration_test fir sfrax

* fixed FraxV3SFraxAdapter.sol import paths

* updated with correct addresses FraxV3SFraxAdapter manifest.yaml

* updated sfrax manifest.yaml

* updated to support sdk

* integration_test sfrax updated

* fix: 🐛 add reward processing

* chore: ♻️ minor cleanups

* fix: Fixed adapter limits

* fix: fix adapter and substream sdk tests

* fix: Fixed CI errors

* chore: fmt

* chore: Removed unused line

* fix: Fixed clippy warnings

* chore: formatted with rustup

* chore: Removed unused line

* chore: post-build formatting

* chore: Formatting using different toolchain vesion

* chore: 💄 format

* chore: 💄 format 2

* chore: Using static address for frax

* feat: Added second constructor param for sfrax

* fix: Fixed limits on frax sell

* chore: Fixed merge conflict with sfraxeth

* chore: Remove sfraxeth_contract changes

* chore: Fixed EOFs

* fix: Fixed fmt on stakedfrax contract

---------

Co-authored-by: mp-web3 <mp.web3.t@gmail.com>
Co-authored-by: gabrir99 <gabri.ruini@gmail.com>
Co-authored-by: mrBovo <bovo.ignazio@proton.me>
Co-authored-by: Ignazio Bovo <ignazio@jsgenesis.com>
Co-authored-by: mrBovo <bovoignazio.dev@gmail.com>
Co-authored-by: Mattia <mp.web3@gmail.com>
2024-10-25 18:53:06 +01:00
Zizou
549ca39d1a Merge pull request #100 from propeller-heads/zz/substreams/fix-balance-aggregation-bug
fix(substreams-sdk): fix a bug in `aggregate_balances_changes`
2024-10-25 16:20:23 +02:00
zizou
660d4895fc chore(substreams): update autogenerated code format 2024-10-25 16:10:21 +02: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
Louise Poole
ef985f5ff4 fix(usv2): correctly encode the component_id in balances 2024-10-25 15:32:26 +02:00
Louise Poole
430375f035 fix(usv2): fix pancakeswap binary path 2024-10-25 15:25:02 +02:00
Louise Poole
09bf076631 chore: update usv2 forks configs 2024-10-25 15:16:13 +02:00
Louise Poole
02227937ad feat(usv2): set default balances on pool creation 2024-10-25 15:15:49 +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
Alan Höng
0dda680ab2 Merge pull request #93 from propeller-heads/ah/test-multiple-amounts
feat(testing): Test multiple amounts.
2024-10-23 13:11:32 +01:00
kayibal
3a93a55a46 doc: fix formatting 2024-10-23 13:00:59 +01:00
kayibal
378c1c2786 feat(testing): Test multiple amounts. 2024-10-23 12:54:15 +01:00
Alan Höng
163296bceb Merge pull request #92 from propeller-heads/ah/docs/clarification-limits
docs: Document the meaning of limits array
2024-10-23 10:45:36 +01:00
kayibal
f129f217e5 docs: Document the meaning of limits array 2024-10-23 10:45:22 +01:00
kayibal
42f66c22cf docs: Document the meaning of limits array 2024-10-23 10:44:53 +01:00
Louise Poole
eddb46ccbd Merge pull request #90 from propeller-heads/lp/improve-release-script
ci: allow numbers in substream release version tag
2024-10-21 23:02:16 +02:00
Louise Poole
7f262c3994 ci: allow numbers in substream release version tag 2024-10-21 17:56:32 +02:00
Louise Poole
d616481c4a Merge pull request #89 from propeller-heads/lp/uniswap-v2-be-encoding
feat: Convert uniswap v2 attributes to big endian encoding
2024-10-21 17:28:04 +02:00
Louise Poole
5c38cd6fb3 feat: improve substream release script
Improvements include:
- exit the script if any non-recoverable step fails
- fix bug where cargo version was hardcoded to be detected in balancer package
- allow optional input of substream config file. This is necessary for protocols with forks as they will have multiple configs in one directory
2024-10-17 19:43:07 +02:00
Louise Poole
3c3b5195f7 fix: update uniswap v2 configs and package name 2024-10-17 19:43:07 +02:00