Add ABIs for Uniswap V3. Move abis to hierarchy
This commit is contained in:
parent
654b416336
commit
1ccd076881
@ -5,14 +5,19 @@ from typing import Optional
|
|||||||
from pydantic import parse_obj_as
|
from pydantic import parse_obj_as
|
||||||
|
|
||||||
from mev_inspect.schemas import ABI
|
from mev_inspect.schemas import ABI
|
||||||
|
from mev_inspect.schemas.classified_traces import Protocol
|
||||||
|
|
||||||
|
|
||||||
THIS_FILE_DIRECTORY = Path(__file__).parents[0]
|
THIS_FILE_DIRECTORY = Path(__file__).parents[0]
|
||||||
ABI_DIRECTORY_PATH = THIS_FILE_DIRECTORY / "abis"
|
ABI_DIRECTORY_PATH = THIS_FILE_DIRECTORY / "abis"
|
||||||
|
|
||||||
|
|
||||||
def get_abi(abi_name: str) -> Optional[ABI]:
|
def get_abi(abi_name: str, protocol: Optional[Protocol]) -> Optional[ABI]:
|
||||||
abi_path = ABI_DIRECTORY_PATH / f"{abi_name}.json"
|
abi_filename = f"{abi_name}.json"
|
||||||
|
abi_path = (
|
||||||
|
ABI_DIRECTORY_PATH / abi_filename if protocol is None
|
||||||
|
else ABI_DIRECTORY_PATH / protocol.value / abi_filename
|
||||||
|
)
|
||||||
|
|
||||||
if abi_path.is_file():
|
if abi_path.is_file():
|
||||||
with abi_path.open() as abi_file:
|
with abi_path.open() as abi_file:
|
||||||
|
1
mev_inspect/abis/UniswapV3Pool.json
Normal file
1
mev_inspect/abis/UniswapV3Pool.json
Normal file
File diff suppressed because one or more lines are too long
1
mev_inspect/abis/uniswap_v2/UniswapV2Router.json
Normal file
1
mev_inspect/abis/uniswap_v2/UniswapV2Router.json
Normal file
File diff suppressed because one or more lines are too long
1
mev_inspect/abis/uniswap_v3/Multicall2.json
Normal file
1
mev_inspect/abis/uniswap_v3/Multicall2.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall2.Call[]","name":"calls","type":"tuple[]"}],"name":"aggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall2.Call[]","name":"calls","type":"tuple[]"}],"name":"blockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall2.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockCoinbase","outputs":[{"internalType":"address","name":"coinbase","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockDifficulty","outputs":[{"internalType":"uint256","name":"difficulty","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockGasLimit","outputs":[{"internalType":"uint256","name":"gaslimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockTimestamp","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getEthBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall2.Call[]","name":"calls","type":"tuple[]"}],"name":"tryAggregate","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall2.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall2.Call[]","name":"calls","type":"tuple[]"}],"name":"tryBlockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall2.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"nonpayable","type":"function"}]
|
1
mev_inspect/abis/uniswap_v3/NFTDescriptor.json
Normal file
1
mev_inspect/abis/uniswap_v3/NFTDescriptor.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"quoteTokenAddress","type":"address"},{"internalType":"address","name":"baseTokenAddress","type":"address"},{"internalType":"string","name":"quoteTokenSymbol","type":"string"},{"internalType":"string","name":"baseTokenSymbol","type":"string"},{"internalType":"uint8","name":"quoteTokenDecimals","type":"uint8"},{"internalType":"uint8","name":"baseTokenDecimals","type":"uint8"},{"internalType":"bool","name":"flipRatio","type":"bool"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"int24","name":"tickCurrent","type":"int24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"poolAddress","type":"address"}],"internalType":"struct NFTDescriptor.ConstructTokenURIParams","name":"params","type":"tuple"}],"name":"constructTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]
|
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"int256","name":"priority","type":"int256"}],"name":"UpdateTokenRatioPriority","type":"event"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"}],"name":"flipRatio","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"}],"name":"tokenRatioPriority","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract INonfungiblePositionManager","name":"positionManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
|
1
mev_inspect/abis/uniswap_v3/ProxyAdmin.json
Normal file
1
mev_inspect/abis/uniswap_v3/ProxyAdmin.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract TransparentUpgradeableProxy","name":"proxy","type":"address"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
|
1
mev_inspect/abis/uniswap_v3/Quoter.json
Normal file
1
mev_inspect/abis/uniswap_v3/Quoter.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"quoteExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"name":"quoteExactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"quoteExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"name":"quoteExactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"path","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"view","type":"function"}]
|
1
mev_inspect/abis/uniswap_v3/SwapRouter.json
Normal file
1
mev_inspect/abis/uniswap_v3/SwapRouter.json
Normal file
File diff suppressed because one or more lines are too long
1
mev_inspect/abis/uniswap_v3/TickLens.json
Normal file
1
mev_inspect/abis/uniswap_v3/TickLens.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"int16","name":"tickBitmapIndex","type":"int16"}],"name":"getPopulatedTicksInWord","outputs":[{"components":[{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint128","name":"liquidityGross","type":"uint128"}],"internalType":"struct ITickLens.PopulatedTick[]","name":"populatedTicks","type":"tuple[]"}],"stateMutability":"view","type":"function"}]
|
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address","name":"_logic","type":"address"},{"internalType":"address","name":"admin_","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"admin_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"implementation_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
|
1
mev_inspect/abis/uniswap_v3/UniswapV3Factory.json
Normal file
1
mev_inspect/abis/uniswap_v3/UniswapV3Factory.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":true,"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"FeeAmountEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":false,"internalType":"int24","name":"tickSpacing","type":"int24"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"enableFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"feeAmountTickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
1
mev_inspect/abis/uniswap_v3/V3Migrator.json
Normal file
1
mev_inspect/abis/uniswap_v3/V3Migrator.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"},{"internalType":"address","name":"_nonfungiblePositionManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"createAndInitializePoolIfNecessary","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pair","type":"address"},{"internalType":"uint256","name":"liquidityToMigrate","type":"uint256"},{"internalType":"uint8","name":"percentageToMigrate","type":"uint8"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"refundAsETH","type":"bool"}],"internalType":"struct IV3Migrator.MigrateParams","name":"params","type":"tuple"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"nonfungiblePositionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
|
@ -5,29 +5,87 @@ from mev_inspect.schemas.classified_traces import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
SUSHISWAP_ROUTER_ADDRESS = "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F"
|
UNISWAP_V3_CONTRACT_SPECS = [
|
||||||
UNISWAP_V2_ROUTER_ADDRESS = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
|
ClassifierSpec(
|
||||||
|
abi_name="UniswapV3Factory",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0x1F98431c8aD98523631AE4a59f267346ea31F984"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="Multicall2",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="ProxyAdmin",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0xB753548F6E010e7e680BA186F9Ca1BdAB2E90cf2"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="TickLens",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0xbfd8137f7d1516D3ea5cA83523914859ec47F573"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="Quoter",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="SwapRouter",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0xE592427A0AEce92De3Edee1F18E0157C05861564"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="NFTDescriptor",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0x42B24A95702b9986e82d421cC3568932790A48Ec"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="NonfungibleTokenPositionDescriptor",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0x91ae842A5Ffd8d12023116943e72A606179294f3"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="TransparentUpgradeableProxy",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0xEe6A57eC80ea46401049E92587E52f5Ec1c24785"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="NonfungiblePositionManager",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0xC36442b4a4522E871399CD717aBDD847Ab11FE88"],
|
||||||
|
),
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="V3Migrator",
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
|
valid_contract_addresses=["0xA5644E29708357803b5A882D272c41cC0dF92B34"],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
UNISWAP_V3_GENERAL_SPECS = [
|
||||||
|
ClassifierSpec(
|
||||||
|
abi_name="UniswapV3Pool",
|
||||||
|
classifications={
|
||||||
|
"swap(address,bool,int256,uint160,bytes)": Classification.swap,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
CLASSIFIER_SPECS = [
|
UNISWAPPY_V2_CONTRACT_SPECS = [
|
||||||
ClassifierSpec(
|
ClassifierSpec(
|
||||||
abi_name="UniswapV2Router",
|
abi_name="UniswapV2Router",
|
||||||
protocol=Protocol.uniswap_v2,
|
protocol=Protocol.uniswap_v2,
|
||||||
valid_contract_addresses=[UNISWAP_V2_ROUTER_ADDRESS],
|
valid_contract_addresses=["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"],
|
||||||
),
|
),
|
||||||
ClassifierSpec(
|
ClassifierSpec(
|
||||||
abi_name="UniswapV2Router",
|
abi_name="UniswapV2Router",
|
||||||
protocol=Protocol.sushiswap,
|
protocol=Protocol.sushiswap,
|
||||||
valid_contract_addresses=[SUSHISWAP_ROUTER_ADDRESS],
|
valid_contract_addresses=["0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F"],
|
||||||
),
|
|
||||||
ClassifierSpec(
|
|
||||||
abi_name="ERC20",
|
|
||||||
classifications={
|
|
||||||
"transferFrom(address,address,uint256)": Classification.transfer,
|
|
||||||
"transfer(address,uint256)": Classification.transfer,
|
|
||||||
"burn(address)": Classification.burn,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
UNISWAPPY_V2_GENERAL_SPECS = [
|
||||||
ClassifierSpec(
|
ClassifierSpec(
|
||||||
abi_name="UniswapV2Pair",
|
abi_name="UniswapV2Pair",
|
||||||
classifications={
|
classifications={
|
||||||
@ -35,3 +93,21 @@ CLASSIFIER_SPECS = [
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ERC20_SPEC = ClassifierSpec(
|
||||||
|
abi_name="ERC20",
|
||||||
|
classifications={
|
||||||
|
"transferFrom(address,address,uint256)": Classification.transfer,
|
||||||
|
"transfer(address,uint256)": Classification.transfer,
|
||||||
|
"burn(address)": Classification.burn,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
CLASSIFIER_SPECS = (
|
||||||
|
UNISWAP_V3_CONTRACT_SPECS +
|
||||||
|
UNISWAPPY_V2_CONTRACT_SPECS +
|
||||||
|
[ERC20_SPEC] +
|
||||||
|
UNISWAP_V3_GENERAL_SPECS +
|
||||||
|
UNISWAPPY_V2_GENERAL_SPECS
|
||||||
|
)
|
||||||
|
@ -15,6 +15,7 @@ class Classification(Enum):
|
|||||||
|
|
||||||
class Protocol(Enum):
|
class Protocol(Enum):
|
||||||
uniswap_v2 = "uniswap_v2"
|
uniswap_v2 = "uniswap_v2"
|
||||||
|
uniswap_v3 = "uniswap_v3"
|
||||||
sushiswap = "sushiswap"
|
sushiswap = "sushiswap"
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class TraceClassifier:
|
|||||||
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:
|
||||||
abi = get_abi(spec.abi_name)
|
abi = get_abi(spec.abi_name, spec.protocol)
|
||||||
|
|
||||||
if abi is None:
|
if abi is None:
|
||||||
raise ValueError(f"No ABI found for {spec.abi_name}")
|
raise ValueError(f"No ABI found for {spec.abi_name}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user