tradingstrategy-ai / web3-ethereum-defi

A Python library for trading automation on DeFi, data research and integration. Supporting Uniswap, Aave, Chainlink, USDC and other protocols.
https://tradingstrategy.ai
MIT License
604 stars 129 forks source link

Something wierd with the log #150

Closed SpacedDot closed 1 year ago

SpacedDot commented 1 year ago

I run the uniswap-v2-swaps-live.py, and a problem occurs to me.

The filtered log is: {'address': '0x3e13f23bbc3fb4c7ea5bc5421344a163a0d00b0c', 'topics': ['0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822', '0x00000000000000000000000007c4b115ddc6cc66526394629c22dda907795e57', '0x0000000000000000000000006fd80b18d73cd2f5f972b3c2829456cc16d6d543'], 'data': '0x00000000000000000000000000000000000000000000000002e75474d14644000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e75474d1464400', 'blockNumber': 17975651, 'transactionHash': '0x583f6a5890883dd69bc4713b00bf6697b0cac7a6c3445e589a7ad24ada6be595', 'transactionIndex': '0x47', 'blockHash': '0x081be90f9e290f9b670d9fa057185b1abe62da96c610ae08a566a97867a5e887', 'logIndex': '0x94', 'removed': False, 'context': None, 'event': <class 'web3._utils.datatypes.Swap'>, 'chunk_id': 17975650, 'timestamp': 1692772487}

And this should be a uniswap v2 swap log 'topics': ['0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822'

But the weird thing is that the address is a ERC20 address: 'address': '0x3e13f23bbc3fb4c7ea5bc5421344a163a0d00b0c'

Then this script got an error, because it try to decode it as an uniswap v2 contract.

Why the address in this log is ERC20 contract address, not its pool address?

SpacedDot commented 1 year ago

OK. I get it. This contract have a swap function which is exactly the same as uniswap v2.

Closed.