diff --git a/mev_inspect/classifiers/specs/cryptopunks.py b/mev_inspect/classifiers/specs/cryptopunks.py index 3f53854..9fd283d 100644 --- a/mev_inspect/classifiers/specs/cryptopunks.py +++ b/mev_inspect/classifiers/specs/cryptopunks.py @@ -4,12 +4,18 @@ from mev_inspect.schemas.traces import ( from mev_inspect.schemas.classifiers import ( ClassifierSpec, + PunkBidClassifier, + PunkAcceptBidClassifier, ) CRYPTO_PUNKS_SPEC = ClassifierSpec( abi_name="cryptopunks", protocol=Protocol.cryptopunks, valid_contract_addresses=["0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB"], + classifiers={ + "enterBidForPunk(uint)": PunkBidClassifier, + "acceptBidForPunk(uint,uint)": PunkAcceptBidClassifier, + }, ) CRYPTOPUNKS_CLASSIFIER_SPECS = [CRYPTO_PUNKS_SPEC] diff --git a/mev_inspect/schemas/classifiers.py b/mev_inspect/schemas/classifiers.py index ab50271..b1ed7a5 100644 --- a/mev_inspect/schemas/classifiers.py +++ b/mev_inspect/schemas/classifiers.py @@ -5,6 +5,8 @@ from pydantic import BaseModel from .traces import Classification, DecodedCallTrace, Protocol from .transfers import Transfer +from .punk_bid import Punk_Bid +from .punk_accept_bid import Punk_Accept_Bid class Classifier(ABC): @@ -14,6 +16,28 @@ class Classifier(ABC): raise NotImplementedError() +class PunkBidClassifier(Classifier): + @staticmethod + def get_classification() -> Classification: + return Classification.punk_bid + + @staticmethod + @abstractmethod + def get_bid(trace: DecodedCallTrace) -> Punk_Bid: + raise NotImplementedError() + + +class PunkAcceptBidClassifier(Classifier): + @staticmethod + def get_classification() -> Classification: + return Classification.punk_accept_bid + + @staticmethod + @abstractmethod + def get_accept_bid(trace: DecodedCallTrace) -> Punk_Accept_Bid: + raise NotImplementedError() + + class TransferClassifier(Classifier): @staticmethod def get_classification() -> Classification: diff --git a/mev_inspect/schemas/punk_accept_bid.py b/mev_inspect/schemas/punk_accept_bid.py new file mode 100644 index 0000000..dce2d1f --- /dev/null +++ b/mev_inspect/schemas/punk_accept_bid.py @@ -0,0 +1,12 @@ +from typing import List + +from pydantic import BaseModel + + +class Punk_Accept_Bid(BaseModel): + block_number: int + transaction_hash: str + trace_address: List[int] + from_address: str + punk_index: int + min_price: int diff --git a/mev_inspect/schemas/punk_bid.py b/mev_inspect/schemas/punk_bid.py new file mode 100644 index 0000000..fe38528 --- /dev/null +++ b/mev_inspect/schemas/punk_bid.py @@ -0,0 +1,11 @@ +from typing import List + +from pydantic import BaseModel + +class Punk_Bid(BaseModel): + block_number: int + transaction_hash: str + trace_address: List[int] + from_address: str + punk_index: int + amount: int \ No newline at end of file