state = JSONFileScanState("/tmp/uniswap-v3-price-scan.json") fetch_events_to_csv(json_rpc_url, state, start_block=start_block, end_block=end_block)
the fetch_events_to_csv fails from the start because it needs the files
uniswap-v3-swap.csvuniswap-v3-poolcreated.csvuniswap-v3-burn.csvuniswap-v3-mint.csv
Which I think should be created automatically if not existing. After creating them manually I still had difficulties. The program was not finding them in the /tmp folder which is the default folder according to the API.
It then also failed because it could not find "uniswap-v3-price-scan.json". Initially it at least detected there was no state, then afterwards it failed without state. Then I had to look into the code to actually see what is supposed to be in this file because I can't get the code to run without this state file.
Then I found out that uniswap-v3-price-scan.json just contains the block number...
After doing that, I finally get to scrape data which gets me into the following error:
File "C:\Python310\lib\site-packages\eth_defi\uniswap_v3\events.py", line 435, in fetch_events_to_csv raise RuntimeError(f"Could not decode {log_result}") from e RuntimeError: Could not decode {'address': '0x1f98431c8ad98523631ae4a59f267346ea31f984', 'blockHash': '0xe8228e3e736a42c7357d2ce6882a1662c588ce608897dd53c3053bcbefb4309a', 'blockNumber': 12369739, 'data': '0x000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000001d42064fc4beb5f8aaf85f4617ae8b3b5b8bd801', 'logIndex': '0x18', 'removed': False, 'topics': ['0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118', '0x0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000000000000000000000000000000000000000000bb8'], 'transactionHash': '0x37d8f4b1b371fde9e4b1942588d16a1cbf424b7c66e731ec915aca785ca2efcf', 'transactionIndex': '0x21', 'context': <eth_defi.uniswap_v3.events.TokenCache object at 0x000001DBE157D9F0>, 'event': <class 'web3._utils.datatypes.PoolCreated'>, 'chunk_id': 12369721, 'timestamp': 1620157956}
Hi,
I've tried working with this library but to me seems like most things do not work.
I'll just provide extra information
I am working on Windows 10 Python 3.10.6
Foremost installing this lib is very difficult on Windows. It is using ethash which is the problem. To install this you have to do some manual funky stuff found here: unable to install pyethash · Issue #131 · ethereum/ethash (github.com) for whoever encounters the same.
Then I tried to do this tutorial: https://web3-ethereum-defi.readthedocs.io/tutorials/uniswap-v3-price-analysis.html
Just scraping the data already fails:
state = JSONFileScanState("/tmp/uniswap-v3-price-scan.json") fetch_events_to_csv(json_rpc_url, state, start_block=start_block, end_block=end_block)
the
fetch_events_to_csv
fails from the start because it needs the filesuniswap-v3-swap.csv
uniswap-v3-poolcreated.csv
uniswap-v3-burn.csv
uniswap-v3-mint.csv
Which I think should be created automatically if not existing. After creating them manually I still had difficulties. The program was not finding them in the /tmp folder which is the default folder according to the API.
It then also failed because it could not find "uniswap-v3-price-scan.json". Initially it at least detected there was no state, then afterwards it failed without state. Then I had to look into the code to actually see what is supposed to be in this file because I can't get the code to run without this state file.
Then I found out that uniswap-v3-price-scan.json just contains the block number...
After doing that, I finally get to scrape data which gets me into the following error:
File "C:\Python310\lib\site-packages\eth_defi\uniswap_v3\events.py", line 435, in fetch_events_to_csv raise RuntimeError(f"Could not decode {log_result}") from e RuntimeError: Could not decode {'address': '0x1f98431c8ad98523631ae4a59f267346ea31f984', 'blockHash': '0xe8228e3e736a42c7357d2ce6882a1662c588ce608897dd53c3053bcbefb4309a', 'blockNumber': 12369739, 'data': '0x000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000001d42064fc4beb5f8aaf85f4617ae8b3b5b8bd801', 'logIndex': '0x18', 'removed': False, 'topics': ['0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118', '0x0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000000000000000000000000000000000000000000bb8'], 'transactionHash': '0x37d8f4b1b371fde9e4b1942588d16a1cbf424b7c66e731ec915aca785ca2efcf', 'transactionIndex': '0x21', 'context': <eth_defi.uniswap_v3.events.TokenCache object at 0x000001DBE157D9F0>, 'event': <class 'web3._utils.datatypes.PoolCreated'>, 'chunk_id': 12369721, 'timestamp': 1620157956}