{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/web3.py/issues/1318","repository_url":"https://api.github.com/repos/ethereum/web3.py","labels_url":"https://api.github.com/repos/ethereum/web3.py/issues/1318/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/web3.py/issues/1318/comments","events_url":"https://api.github.com/repos/ethereum/web3.py/issues/1318/events","html_url":"https://github.com/ethereum/web3.py/issues/1318","id":430242396,"node_id":"MDU6SXNzdWU0MzAyNDIzOTY=","number":1318,"title":"AttributeError: type object 'Transfer' has no attribute 'getLogs'","user":{"login":"araa47","id":22760261,"node_id":"MDQ6VXNlcjIyNzYwMjYx","avatar_url":"https://avatars1.githubusercontent.com/u/22760261?v=4","gravatar_id":"","url":"https://api.github.com/users/araa47","html_url":"https://github.com/araa47","followers_url":"https://api.github.com/users/araa47/followers","following_url":"https://api.github.com/users/araa47/following{/other_user}","gists_url":"https://api.github.com/users/araa47/gists{/gist_id}","starred_url":"https://api.github.com/users/araa47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/araa47/subscriptions","organizations_url":"https://api.github.com/users/araa47/orgs","repos_url":"https://api.github.com/users/araa47/repos","events_url":"https://api.github.com/users/araa47/events{/privacy}","received_events_url":"https://api.github.com/users/araa47/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-04-08T03:45:41Z","updated_at":"2019-04-08T06:23:22Z","closed_at":null,"author_association":"NONE","body":"* Version: 4.9.1\r\n* Python: 3.7.3\r\n* OS: osx\r\n* `pip freeze` output\r\n```\r\nappdirs==1.4.3\r\nattrdict==2.0.1\r\nattrs==19.1.0\r\nblack==19.3b0\r\ncertifi==2019.3.9\r\nchardet==3.0.4\r\nClick==7.0\r\ncytoolz==0.9.0.1\r\neth-abi==1.3.0\r\neth-account==0.3.0\r\neth-hash==0.2.0\r\neth-keyfile==0.5.1\r\neth-keys==0.2.1\r\neth-rlp==0.1.2\r\neth-typing==2.1.0\r\neth-utils==1.4.1\r\nhexbytes==0.1.0\r\nidna==2.8\r\nlru-dict==1.1.6\r\nparsimonious==0.8.1\r\npycryptodome==3.8.1\r\nrequests==2.21.0\r\nrlp==1.1.0\r\nsix==1.12.0\r\ntoml==0.10.0\r\ntoolz==0.9.0\r\nurllib3==1.24.1\r\nweb3==4.9.1\r\nwebsockets==6.0\r\n```\r\n\r\n\r\n### What was wrong?\r\n\r\nCode\r\n```\r\nweb3 = Web3(\r\n WebsocketProvider(\"wss://mainnet.infura.io/ws/v3/myappid\")\r\n)\r\ntoken_contract = web3.eth.contract(address=tokenContractAddress, abi=contract_abi)\r\nfrom_block = max(token_contract.web3.eth.blockNumber - 10, 1)\r\nto_block = token_contract.web3.eth.blockNumber\r\nprint(f\"From: {from_block} To: {to_block}\")\r\nprint(token_contract.events.Transfer.getLogs(fromBlock=from_block, toBlock=to_block))\r\n```\r\nError:\r\n```\r\nFrom: 7525075 To: 7525085\r\nTraceback (most recent call last):\r\n  File \"app.py\", line 94, in <module>\r\n    print(token_contract.events.Transfer.getLogs(fromBlock=from_block, toBlock=to_block))\r\nAttributeError: type object 'Transfer' has no attribute 'getLogs'\r\n\r\n```\r\nI am currently trying to get a list of all the contract transfers, so I can get the balances for each wallet who owns this erc20 token for each block. Based on instructions in https://github.com/ethereum/web3.py/blob/master/web3/contract.py. \r\n\r\nIs there a better way to approach this problem? Basically I want to track all the balances of the erc20 token since creation date, and have snapshots for each block number, so I can easily search token balances for each wallet for certain dates. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ethereum/web3.py/issues/comments/480699469","html_url":"https://github.com/ethereum/web3.py/issues/1318#issuecomment-480699469","issue_url":"https://api.github.com/repos/ethereum/web3.py/issues/1318","id":480699469,"node_id":"MDEyOklzc3VlQ29tbWVudDQ4MDY5OTQ2OQ==","user":{"login":"araa47","id":22760261,"node_id":"MDQ6VXNlcjIyNzYwMjYx","avatar_url":"https://avatars1.githubusercontent.com/u/22760261?v=4","gravatar_id":"","url":"https://api.github.com/users/araa47","html_url":"https://github.com/araa47","followers_url":"https://api.github.com/users/araa47/followers","following_url":"https://api.github.com/users/araa47/following{/other_user}","gists_url":"https://api.github.com/users/araa47/gists{/gist_id}","starred_url":"https://api.github.com/users/araa47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/araa47/subscriptions","organizations_url":"https://api.github.com/users/araa47/orgs","repos_url":"https://api.github.com/users/araa47/repos","events_url":"https://api.github.com/users/araa47/events{/privacy}","received_events_url":"https://api.github.com/users/araa47/received_events","type":"User","site_admin":false},"created_at":"2019-04-08T06:23:22Z","updated_at":"2019-04-08T06:23:22Z","author_association":"NONE","body":"I have also tried another method to get all erc20 transactions for the token based on https://web3py.readthedocs.io/en/stable/contracts.html. \r\n\r\nCode: \r\n```\r\nweb3 = Web3(\r\n WebsocketProvider(\"wss://mainnet.infura.io/ws/v3/myappid\")\r\n)\r\ntoken_contract = web3.eth.contract(address=tokenContractAddress, abi=contract_abi)\r\ntransfer_filter = token_contract.eventFilter('Transfer')\r\nprint(transfer_filter.get_all_entries())\r\n```\r\n\r\nOutput: \r\n```\r\n[]\r\n```\r\n\r\nStill can't seem to pull the transactions for the particular erc20 token in order to calculate balances during different points of time. "}}
{"actor":{"display_login":"araa47"}}