From ca80b08cf2fe91bef4f8b3b97a72e48c28181370 Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Thu, 11 Jul 2024 05:54:20 +0200 Subject: [PATCH] Create structure --- tycho/README.md | 0 tycho/requirements.txt | 0 tycho/tycho/__init__.py | 0 tycho/tycho/constants.py | 11 +++++++++++ tycho/tycho/decoders.py | 9 +++++++++ tycho/tycho/exceptions.py | 0 tycho/tycho/models.py | 20 ++++++++++++++++++++ 7 files changed, 40 insertions(+) create mode 100644 tycho/README.md create mode 100644 tycho/requirements.txt create mode 100644 tycho/tycho/__init__.py create mode 100644 tycho/tycho/constants.py create mode 100644 tycho/tycho/decoders.py create mode 100644 tycho/tycho/exceptions.py create mode 100644 tycho/tycho/models.py diff --git a/tycho/README.md b/tycho/README.md new file mode 100644 index 0000000..e69de29 diff --git a/tycho/requirements.txt b/tycho/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/tycho/tycho/__init__.py b/tycho/tycho/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tycho/tycho/constants.py b/tycho/tycho/constants.py new file mode 100644 index 0000000..1dc7c1a --- /dev/null +++ b/tycho/tycho/constants.py @@ -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""" diff --git a/tycho/tycho/decoders.py b/tycho/tycho/decoders.py new file mode 100644 index 0000000..73c1479 --- /dev/null +++ b/tycho/tycho/decoders.py @@ -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 diff --git a/tycho/tycho/exceptions.py b/tycho/tycho/exceptions.py new file mode 100644 index 0000000..e69de29 diff --git a/tycho/tycho/models.py b/tycho/tycho/models.py new file mode 100644 index 0000000..a71deb8 --- /dev/null +++ b/tycho/tycho/models.py @@ -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