Merge pull request #23 from lukevs/project-structure
Add project structure
This commit is contained in:
commit
4571870de2
0
mev_inspect/__init__.py
Normal file
0
mev_inspect/__init__.py
Normal file
@ -4,7 +4,7 @@ from typing import List
|
|||||||
|
|
||||||
from web3 import Web3
|
from web3 import Web3
|
||||||
|
|
||||||
from schemas import Block, BlockCall, BlockCallType
|
from mev_inspect.schemas import Block, BlockCall, BlockCallType
|
||||||
|
|
||||||
|
|
||||||
cache_directory = './cache'
|
cache_directory = './cache'
|
13
mev_inspect/config.py
Normal file
13
mev_inspect/config.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import os
|
||||||
|
import configparser
|
||||||
|
|
||||||
|
|
||||||
|
THIS_FILE_DIRECTORY = os.path.dirname(__file__)
|
||||||
|
CONFIG_PATH = os.path.join(THIS_FILE_DIRECTORY, "config.ini")
|
||||||
|
|
||||||
|
|
||||||
|
def load_config():
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(CONFIG_PATH)
|
||||||
|
|
||||||
|
return config
|
@ -1,11 +1,11 @@
|
|||||||
from web3 import Web3
|
|
||||||
import configparser
|
|
||||||
import json
|
import json
|
||||||
import utils
|
|
||||||
|
|
||||||
## Config file is used for addresses/ABIs
|
from web3 import Web3
|
||||||
config = configparser.ConfigParser()
|
|
||||||
config.read('./utils/config.ini')
|
from mev_inspect import utils
|
||||||
|
from mev_inspect.config import load_config
|
||||||
|
|
||||||
|
config = load_config()
|
||||||
|
|
||||||
uniswap_router_abi = json.loads(config['ABI']['UniswapV2Router'])
|
uniswap_router_abi = json.loads(config['ABI']['UniswapV2Router'])
|
||||||
uniswap_router_address = (config['ADDRESSES']['UniswapV2Router'])
|
uniswap_router_address = (config['ADDRESSES']['UniswapV2Router'])
|
@ -1,4 +1,4 @@
|
|||||||
from schemas.utils import to_original_json_dict
|
from mev_inspect.schemas.utils import to_original_json_dict
|
||||||
|
|
||||||
|
|
||||||
class Processor:
|
class Processor:
|
@ -1,10 +1,10 @@
|
|||||||
# from web3 import Web3, HTTPProvider
|
|
||||||
from pathlib import Path
|
|
||||||
import json
|
import json
|
||||||
import configparser
|
from pathlib import Path
|
||||||
|
|
||||||
|
from mev_inspect.config import load_config
|
||||||
|
|
||||||
|
config = load_config()
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
|
||||||
config.read('./utils/config.ini')
|
|
||||||
rpc_url = config['RPC']['Endpoint']
|
rpc_url = config['RPC']['Endpoint']
|
||||||
weth_address = config['ADDRESSES']['WETH']
|
weth_address = config['ADDRESSES']['WETH']
|
||||||
# w3 = Web3(HTTPProvider(rpc_url))
|
# w3 = Web3(HTTPProvider(rpc_url))
|
||||||
@ -236,4 +236,4 @@ def get_gas_used_by_tx(txHash):
|
|||||||
# res = run_tokenflow("0x5ab21bfba50ad3993528c2828c63e311aafe93b40ee934790e545e150cb6ca73", 11931272)
|
# res = run_tokenflow("0x5ab21bfba50ad3993528c2828c63e311aafe93b40ee934790e545e150cb6ca73", 11931272)
|
||||||
# print(res)
|
# print(res)
|
||||||
|
|
||||||
# get_gas_used_by_tx("0x4121ce805d33e952b2e6103a5024f70c118432fd0370128d6d7845f9b2987922")
|
# get_gas_used_by_tx("0x4121ce805d33e952b2e6103a5024f70c118432fd0370128d6d7845f9b2987922")
|
@ -1,10 +1,12 @@
|
|||||||
from processor import Processor
|
|
||||||
from web3.providers import base
|
|
||||||
from inspector_uniswap import UniswapInspector
|
|
||||||
import block
|
|
||||||
from web3 import Web3
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
from web3.providers import base
|
||||||
|
from web3 import Web3
|
||||||
|
|
||||||
|
from mev_inspect import block
|
||||||
|
from mev_inspect.inspector_uniswap import UniswapInspector
|
||||||
|
from mev_inspect.processor import Processor
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Inspect some blocks.')
|
parser = argparse.ArgumentParser(description='Inspect some blocks.')
|
||||||
parser.add_argument('-block_number', metavar='b', type=int, nargs='+',
|
parser.add_argument('-block_number', metavar='b', type=int, nargs='+',
|
||||||
help='the block number you are targetting, eventually this will need to be changed')
|
help='the block number you are targetting, eventually this will need to be changed')
|
||||||
@ -23,4 +25,4 @@ uniswap_inspector = UniswapInspector(base_provider)
|
|||||||
## Create a processor, pass in an ARRAY of inspects
|
## Create a processor, pass in an ARRAY of inspects
|
||||||
processor = Processor(base_provider, [uniswap_inspector, uniswap_inspector])
|
processor = Processor(base_provider, [uniswap_inspector, uniswap_inspector])
|
||||||
|
|
||||||
processor.get_transaction_evaluations(block_data)
|
processor.get_transaction_evaluations(block_data)
|
||||||
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
@ -1,6 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import inspector_compound
|
|
||||||
import inspector_aave
|
from mev_inspect import inspector_compound
|
||||||
|
from mev_inspect import inspector_aave
|
||||||
|
|
||||||
class TestLiquidations (unittest.TestCase):
|
class TestLiquidations (unittest.TestCase):
|
||||||
def test_compound_liquidation(self):
|
def test_compound_liquidation(self):
|
||||||
@ -16,4 +17,4 @@ class TestLiquidations (unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import tokenflow
|
|
||||||
|
from mev_inspect import tokenflow
|
||||||
|
|
||||||
|
|
||||||
class TestTokenFlow (unittest.TestCase):
|
class TestTokenFlow (unittest.TestCase):
|
||||||
def test_simple_arb(self):
|
def test_simple_arb(self):
|
||||||
@ -24,4 +26,4 @@ class TestTokenFlow (unittest.TestCase):
|
|||||||
self.assertEqual(res['dollar_flows'], [0,0])
|
self.assertEqual(res['dollar_flows'], [0,0])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user