Rename tycho to tycho_client

This commit is contained in:
Thales Lima
2024-07-18 22:13:46 +02:00
committed by tvinagre
parent 7229f1fca0
commit 13c1db8171
21 changed files with 60 additions and 7 deletions

View File

@@ -5,7 +5,9 @@ FROM --platform=linux/amd64 continuumio/miniconda3:24.4.0-0
WORKDIR /app
# Add current directory code to /app in container
ADD . /app/testing
ADD ./testing /app/testing
ADD ./tycho_client /app/tycho_client
RUN chmod +x /app/testing/tycho-indexer
# Create a new conda environment and install pip
@@ -20,7 +22,7 @@ RUN apt-get update \
&& pip install psycopg2 \
&& apt-get clean
RUN /bin/bash -c "source activate myenv && pip install --no-cache-dir -r testing/requirements.txt"
RUN /bin/bash -c "source activate myenv && pip install --no-cache-dir -r testing/requirements.txt && cd /app/tycho_client && pip install -r requirements-docker.txt && cd -"
# Make port 80 available to the world outside this container
EXPOSE 80

View File

@@ -15,8 +15,8 @@ services:
- postgres_data:/var/lib/postgresql/data
app:
build:
context: .
dockerfile: Dockerfile
context: ..
dockerfile: testing/Dockerfile
volumes:
- ${SUBSTREAMS_PATH}:/app/substreams/my_substream
- ../substreams:/app/substreams

View File

@@ -15,9 +15,7 @@ from evm import get_token_balance, get_block_header
from tycho import TychoRunner
from tycho_client.tycho.decoders import ThirdPartyPoolTychoDecoder
from tycho_client.tycho.models import Blockchain, EVMBlock
from tycho_client.tycho.tycho_adapter import (
TychoPoolStateStreamAdapter,
)
from tycho_client.tycho.tycho_adapter import TychoPoolStateStreamAdapter
class TestResult:

View File

@@ -0,0 +1,38 @@
# Tycho Adapter
This repository contains the Tycho Adapter, a tool that allows you to interact with the Tycho API.
## Installation
### Prerequisites
- Python 3.9
### Install with pip
```shell
# Create conda environment
conda create -n tycho pip python=3.9
# Activate environment
conda activate tycho
# Install packages
pip install -r requirements.txt
```
## Usage
```python
from tycho_client.tycho.decoders import ThirdPartyPoolTychoDecoder
from tycho_client.tycho.models import Blockchain
from tycho_client.tycho.tycho_adapter import TychoPoolStateStreamAdapter
decoder = ThirdPartyPoolTychoDecoder(
"MyProtocolSwapAdapter.evm.runtime", minimum_gas=0, hard_limit=False
)
stream_adapter = TychoPoolStateStreamAdapter(
tycho_url="0.0.0.0:4242",
protocol="my_protocol",
decoder=decoder,
blockchain=Blockchain.ethereum,
)
```

View File

@@ -0,0 +1,7 @@
./tycho/bins/protosim_py-0.4.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
requests==2.32.2
eth-abi==2.2.0
eth-typing==2.3.0
eth-utils==1.9.5
hexbytes==0.3.1
pydantic==2.8.2

View File

@@ -0,0 +1,7 @@
./tycho/bins/protosim_py-0.4.9-cp39-cp39-macosx_11_0_arm64.whl
requests==2.32.2
eth-abi==2.2.0
eth-typing==2.3.0
eth-utils==1.9.5
hexbytes==0.3.1
pydantic==2.8.2

View File

@@ -343,3 +343,4 @@ class TychoPoolStateStreamAdapter:
block_header = BlockHeader(block.id, block.hash_, int(block.ts.timestamp()))
TychoDBSingleton.get_instance().update(vm_updates, block_header)