Add zerox to classifier specs list. Load all specs from trace classifier
This commit is contained in:
parent
70d0502ac4
commit
f9ecea9d86
@ -3,11 +3,13 @@ from .curve import CURVE_CLASSIFIER_SPECS
|
|||||||
from .erc20 import ERC20_CLASSIFIER_SPECS
|
from .erc20 import ERC20_CLASSIFIER_SPECS
|
||||||
from .uniswap import UNISWAP_CLASSIFIER_SPECS
|
from .uniswap import UNISWAP_CLASSIFIER_SPECS
|
||||||
from .weth import WETH_CLASSIFIER_SPECS
|
from .weth import WETH_CLASSIFIER_SPECS
|
||||||
|
from .zerox import ZEROX_CONTRACT_SPECS
|
||||||
|
|
||||||
ALL_CLASSIFIER_SPECS = (
|
ALL_CLASSIFIER_SPECS = (
|
||||||
ERC20_CLASSIFIER_SPECS
|
ERC20_CLASSIFIER_SPECS
|
||||||
|
+ WETH_CLASSIFIER_SPECS
|
||||||
+ CURVE_CLASSIFIER_SPECS
|
+ CURVE_CLASSIFIER_SPECS
|
||||||
+ UNISWAP_CLASSIFIER_SPECS
|
+ UNISWAP_CLASSIFIER_SPECS
|
||||||
+ WETH_CLASSIFIER_SPECS
|
|
||||||
+ AAVE_CLASSIFIER_SPECS
|
+ AAVE_CLASSIFIER_SPECS
|
||||||
|
+ ZEROX_CONTRACT_SPECS
|
||||||
)
|
)
|
||||||
|
@ -5,95 +5,6 @@ from mev_inspect.schemas.classified_traces import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
ZEROX_CONTRACT_SPECS = [
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="exchangeProxy",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xDef1C0ded9bec7F1a1670819833240f027b25EfF"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="exchangeProxyAllowanceTarget",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xf740b67da229f2f10bcbd38a7979992fcc71b8eb"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="exchangeProxyFlashWallet",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x22f9dcf4647084d6c31b2765f6910cd85c178c18"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="exchangeProxyGovernor",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x618f9c67ce7bf1a50afa1e7e0238422601b0ff6e"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="exchangeProxyLiquidityProviderSandbox",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x407b4128e9ecad8769b2332312a9f655cb9f5f3a"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="exchangeProxyTransformerDeployer",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x39dce47a67ad34344eab877eae3ef1fa2a1d50bb"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="wethTransformer",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xb2bc06a4efb20fc6553a69dbfa49b7be938034a7"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="payTakerTransformer",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x4638a7ebe75b911b995d0ec73a81e4f85f41f24e"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="fillQuoteTransformer",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x5ce5174d7442061135ea849970ffc7763920e0fd"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="affiliateFeeTransformer",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xda6d9fc5998f550a094585cf9171f0e8ee3ac59f"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="staking",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x2a17c35ff147b32f13f19f2e311446eeb02503f3"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="stakingProxy",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xa26e80e7dea86279c6d778d702cc413e6cffa777"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="zrxToken",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xe41d2489571d322189246dafa5ebde1f4699f498"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="zrxVault",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xba7f8b5fb1b19c1211c5d49550fcd149177a5eaf"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="devUtils",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0x74134cf88b21383713e096a5ecf59e297dc7f547"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="etherToken",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
|
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="erc20BridgeSampler",
|
|
||||||
protocol=Protocol.zerox,
|
|
||||||
valid_contract_addresses=["0xd8c38704c9937ea3312de29f824b4ad3450a5e61"],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
UNISWAP_V3_CONTRACT_SPECS = [
|
UNISWAP_V3_CONTRACT_SPECS = [
|
||||||
ClassifierSpec(
|
ClassifierSpec(
|
||||||
abi_name="UniswapV3Factory",
|
abi_name="UniswapV3Factory",
|
||||||
|
93
mev_inspect/classifiers/specs/zerox.py
Normal file
93
mev_inspect/classifiers/specs/zerox.py
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
from mev_inspect.schemas.classified_traces import (
|
||||||
|
ClassifierSpec,
|
||||||
|
Protocol,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
ZEROX_CONTRACT_SPECS = [
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="exchangeProxy",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xDef1C0ded9bec7F1a1670819833240f027b25EfF"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="exchangeProxyAllowanceTarget",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xf740b67da229f2f10bcbd38a7979992fcc71b8eb"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="exchangeProxyFlashWallet",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x22f9dcf4647084d6c31b2765f6910cd85c178c18"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="exchangeProxyGovernor",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x618f9c67ce7bf1a50afa1e7e0238422601b0ff6e"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="exchangeProxyLiquidityProviderSandbox",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x407b4128e9ecad8769b2332312a9f655cb9f5f3a"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="exchangeProxyTransformerDeployer",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x39dce47a67ad34344eab877eae3ef1fa2a1d50bb"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="wethTransformer",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xb2bc06a4efb20fc6553a69dbfa49b7be938034a7"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="payTakerTransformer",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x4638a7ebe75b911b995d0ec73a81e4f85f41f24e"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="fillQuoteTransformer",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x5ce5174d7442061135ea849970ffc7763920e0fd"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="affiliateFeeTransformer",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xda6d9fc5998f550a094585cf9171f0e8ee3ac59f"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="staking",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x2a17c35ff147b32f13f19f2e311446eeb02503f3"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="stakingProxy",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xa26e80e7dea86279c6d778d702cc413e6cffa777"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="zrxToken",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xe41d2489571d322189246dafa5ebde1f4699f498"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="zrxVault",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xba7f8b5fb1b19c1211c5d49550fcd149177a5eaf"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="devUtils",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0x74134cf88b21383713e096a5ecf59e297dc7f547"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="etherToken",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="erc20BridgeSampler",
|
||||||
|
protocol=Protocol.zerox,
|
||||||
|
valid_contract_addresses=["0xd8c38704c9937ea3312de29f824b4ad3450a5e61"],
|
||||||
|
),
|
||||||
|
]
|
@ -6,14 +6,14 @@ from mev_inspect.schemas.blocks import CallAction, CallResult, Trace, TraceType
|
|||||||
from mev_inspect.schemas.classified_traces import (
|
from mev_inspect.schemas.classified_traces import (
|
||||||
Classification,
|
Classification,
|
||||||
ClassifiedTrace,
|
ClassifiedTrace,
|
||||||
ClassifierSpec,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from mev_inspect.classifiers.specs import ALL_CLASSIFIER_SPECS
|
||||||
|
|
||||||
|
|
||||||
class TraceClassifier:
|
class TraceClassifier:
|
||||||
def __init__(self, classifier_specs: List[ClassifierSpec]) -> None:
|
def __init__(self) -> None:
|
||||||
# TODO - index by contract_addresses for speed
|
self._classifier_specs = ALL_CLASSIFIER_SPECS
|
||||||
self._classifier_specs = classifier_specs
|
|
||||||
self._decoders_by_abi_name: Dict[str, ABIDecoder] = {}
|
self._decoders_by_abi_name: Dict[str, ABIDecoder] = {}
|
||||||
|
|
||||||
for spec in self._classifier_specs:
|
for spec in self._classifier_specs:
|
||||||
|
@ -5,7 +5,6 @@ from web3 import Web3
|
|||||||
|
|
||||||
from mev_inspect.arbitrages import get_arbitrages
|
from mev_inspect.arbitrages import get_arbitrages
|
||||||
from mev_inspect.block import create_from_block_number
|
from mev_inspect.block import create_from_block_number
|
||||||
from mev_inspect.classifiers.specs import ALL_CLASSIFIER_SPECS
|
|
||||||
from mev_inspect.classifiers.trace import TraceClassifier
|
from mev_inspect.classifiers.trace import TraceClassifier
|
||||||
from mev_inspect.crud.arbitrages import (
|
from mev_inspect.crud.arbitrages import (
|
||||||
delete_arbitrages_for_block,
|
delete_arbitrages_for_block,
|
||||||
@ -96,7 +95,7 @@ def _inspect_block(
|
|||||||
)
|
)
|
||||||
click.echo(f"Total transactions: {total_transactions}")
|
click.echo(f"Total transactions: {total_transactions}")
|
||||||
|
|
||||||
trace_clasifier = TraceClassifier(ALL_CLASSIFIER_SPECS)
|
trace_clasifier = TraceClassifier()
|
||||||
classified_traces = trace_clasifier.classify(block.traces)
|
classified_traces = trace_clasifier.classify(block.traces)
|
||||||
click.echo(f"Returned {len(classified_traces)} classified traces")
|
click.echo(f"Returned {len(classified_traces)} classified traces")
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from mev_inspect.arbitrages import get_arbitrages
|
from mev_inspect.arbitrages import get_arbitrages
|
||||||
from mev_inspect.classifiers.specs import ALL_CLASSIFIER_SPECS
|
|
||||||
from mev_inspect.classifiers.trace import TraceClassifier
|
from mev_inspect.classifiers.trace import TraceClassifier
|
||||||
from mev_inspect.swaps import get_swaps
|
from mev_inspect.swaps import get_swaps
|
||||||
|
|
||||||
@ -9,7 +8,7 @@ from .utils import load_test_block
|
|||||||
def test_arbitrage_real_block():
|
def test_arbitrage_real_block():
|
||||||
block = load_test_block(12914944)
|
block = load_test_block(12914944)
|
||||||
|
|
||||||
trace_clasifier = TraceClassifier(ALL_CLASSIFIER_SPECS)
|
trace_clasifier = TraceClassifier()
|
||||||
classified_traces = trace_clasifier.classify(block.traces)
|
classified_traces = trace_clasifier.classify(block.traces)
|
||||||
|
|
||||||
swaps = get_swaps(classified_traces)
|
swaps = get_swaps(classified_traces)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user