* 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>
Substreams Testing
This package provides a comprehensive testing suite for Substreams modules. The testing suite is designed to facilitate end-to-end testing, ensuring that your Substreams modules function as expected.
Overview
The testing suite builds the .spkg for your Substreams module, indexes a specified block range, and verifies that the
expected state has been correctly indexed in PostgreSQL.
Additionally, it will also try to simulate some transactions using the SwapAdapter interface.
Prerequisites
- Latest version of our indexer, Tycho. Please contact us to obtain the latest version. Once acquired, place it in a directory that is included in your system’s PATH.
- Access to PropellerHeads' private PyPI repository. Please contact us to obtain access.
- Docker installed on your machine.
- Conda and AWS cli installed
Test Configuration
Tests are defined in a yaml file. A documented template can be found at
substreams/ethereum-template/integration_test.tycho.yaml. The configuration file should include:
- The target Substreams config file.
- The corresponding SwapAdapter and args to build it.
- The expected protocol types.
- The tests to be run.
Each test will index all blocks between start-block and stop-block, verify that the indexed state matches the
expected state and optionally simulate transactions using SwapAdapter interface.
You will also need the VM Runtime file for the adapter contract.
Our testing script should be able to build it using your test config.
The script to generate this file manually is available under evm/scripts/buildRuntime.sh.
Setup testing environment
Step 1: Export Environment Variables
DOMAIN_OWNER
- Description: The domain owner identifier for Propellerhead's AWS account, used for authenticating on the private PyPI repository.
- Example:
export DOMAIN_OWNER=123456789
Step 2: Create python virtual environment for testing
Run setup env script. It will create a conda virtual env and install all dependencies.
This script must be run from within the propeller-protocol-lib/testing directory.
Please note that some dependencies require access to our private PyPI repository.
setup_env.sh
Running Tests
Prerequisites
This section requires a testing environment setup. If you don’t have it yet, please refer to the setup testing environment section
Step 1: Export Environment Variables
Export the required environment variables for the execution. You can find the available environment variables in the
.env.default file.
Please create a .env file in the testing directory and set the required environment variables.
Environment Variables
RPC_URL
- Description: The URL for the Ethereum RPC endpoint. This is used to fetch the storage data. The node needs to be an archive node, and support debug_storageRangeAt.
- Example:
export RPC_URL="https://ethereum-mainnet.core.chainstack.com/123123123123"
SUBSTREAMS_API_TOKEN
- Description: The API token for accessing Substreams services. This token is required for authentication.
- Example:
export SUBSTREAMS_API_TOKEN=eyJhbGci...
Step 2: Run tests
Run local postgres database using docker compose
docker compose up -d db
Run tests for your package.
python ./testing/src/runner/cli.py --package "your-package-name"
Example
If you want to run tests for ethereum-balancer, use:
conda activate propeller-protocol-lib-testing
export RPC_URL="https://ethereum-mainnet.core.chainstack.com/123123123123"
export SUBSTREAMS_API_TOKEN=eyJhbGci...
docker compose up -d db
python ./testing/src/runner/cli.py --package "ethereum-balancer"
Testing CLI args
A list and description of all available CLI args can be found using:
python ./testing/src/runner/cli.py --help