feat: add punk classifiers
This commit is contained in:
parent
c5ab2be4e3
commit
5766abb9fe
@ -4,12 +4,18 @@ from mev_inspect.schemas.traces import (
|
|||||||
|
|
||||||
from mev_inspect.schemas.classifiers import (
|
from mev_inspect.schemas.classifiers import (
|
||||||
ClassifierSpec,
|
ClassifierSpec,
|
||||||
|
PunkBidClassifier,
|
||||||
|
PunkAcceptBidClassifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
CRYPTO_PUNKS_SPEC = ClassifierSpec(
|
CRYPTO_PUNKS_SPEC = ClassifierSpec(
|
||||||
abi_name="cryptopunks",
|
abi_name="cryptopunks",
|
||||||
protocol=Protocol.cryptopunks,
|
protocol=Protocol.cryptopunks,
|
||||||
valid_contract_addresses=["0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB"],
|
valid_contract_addresses=["0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB"],
|
||||||
|
classifiers={
|
||||||
|
"enterBidForPunk(uint)": PunkBidClassifier,
|
||||||
|
"acceptBidForPunk(uint,uint)": PunkAcceptBidClassifier,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
CRYPTOPUNKS_CLASSIFIER_SPECS = [CRYPTO_PUNKS_SPEC]
|
CRYPTOPUNKS_CLASSIFIER_SPECS = [CRYPTO_PUNKS_SPEC]
|
||||||
|
@ -5,6 +5,8 @@ from pydantic import BaseModel
|
|||||||
|
|
||||||
from .traces import Classification, DecodedCallTrace, Protocol
|
from .traces import Classification, DecodedCallTrace, Protocol
|
||||||
from .transfers import Transfer
|
from .transfers import Transfer
|
||||||
|
from .punk_bid import Punk_Bid
|
||||||
|
from .punk_accept_bid import Punk_Accept_Bid
|
||||||
|
|
||||||
|
|
||||||
class Classifier(ABC):
|
class Classifier(ABC):
|
||||||
@ -14,6 +16,28 @@ class Classifier(ABC):
|
|||||||
raise NotImplementedError()
|
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):
|
class TransferClassifier(Classifier):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_classification() -> Classification:
|
def get_classification() -> Classification:
|
||||||
|
12
mev_inspect/schemas/punk_accept_bid.py
Normal file
12
mev_inspect/schemas/punk_accept_bid.py
Normal file
@ -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
|
11
mev_inspect/schemas/punk_bid.py
Normal file
11
mev_inspect/schemas/punk_bid.py
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user