Create structure

This commit is contained in:
Thales Lima
2024-07-11 05:54:20 +02:00
committed by tvinagre
parent 96f67362bf
commit ca80b08cf2
7 changed files with 40 additions and 0 deletions

0
tycho/README.md Normal file
View File

0
tycho/requirements.txt Normal file
View File

0
tycho/tycho/__init__.py Normal file
View File

11
tycho/tycho/constants.py Normal file
View File

@@ -0,0 +1,11 @@
from pathlib import Path
from typing import Final
TYCHO_CLIENT_FOLDER = Path(__file__) / "bins"
TYCHO_CLIENT_LOG_FOLDER = TYCHO_CLIENT_FOLDER / "logs"
EXTERNAL_ACCOUNT: Final[str] = "0xf847a638E44186F3287ee9F8cAF73FF4d4B80784"
"""This is a dummy address used as a transaction sender"""
UINT256_MAX: Final[int] = 2 ** 256 - 1
MAX_BALANCE: Final[int] = UINT256_MAX // 2
"""0.5 of the maximal possible balance to avoid overflow errors"""

9
tycho/tycho/decoders.py Normal file
View File

@@ -0,0 +1,9 @@
from tycho.tycho.models import EVMBlock
class ThirdPartyPoolTychoDecoder:
"""ThirdPartyPool decoder for protocol messages from the Tycho feed"""
def decode_snapshot(self, message, block: EVMBlock):
"""Decode a message from the Tycho feed"""
pass

View File

20
tycho/tycho/models.py Normal file
View File

@@ -0,0 +1,20 @@
import datetime
from enum import Enum
from pydantic import BaseModel, Field
class Blockchain(Enum):
ethereum = "ethereum"
arbitrum = "arbitrum"
polygon = "polygon"
zksync = "zksync"
class EVMBlock(BaseModel):
id: int
ts: datetime.datetime = Field(default_factory=datetime.datetime.utcnow)
hash_: str
class ThirdPartyPool:
pass