You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section should show someone how to check their Unicorn token balance.
Rough approach:
Show how to create a python contract object bound to the ERC20 Unicorn token (you can use the ABI from ethtoken linked below)
Retrieve the token balance for an address 0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb appears to be the first address to have received a unicorn, so could be a good candidate.
Show how to retrieve the decimals(), and how to adjust the token balance to get the token count: dividing by 10^decimals plus a brief explainer of the difference between the token balance and token count (token balance is always an integer, token count may be a fraction)
This repository has some example code that might be helpful if you're not sure how to connect to an ERC20 token: https://github.com/carver/ethtoken.py (You can footnote the repo if you want, but it's best to copy in anything that the reader might need).
ERC20 probably deserves its own whole page with different use case examples, but that is out of scope.
The text was updated successfully, but these errors were encountered:
What was wrong?
ERC20 is one of the most common use cases, and there are no explicit examples for interacting with them.
How can it be fixed?
Add a section to the Examples section of the docs that shows how to check the balance of a given token. The new section can be added at the end of this source: https://github.com/ethereum/web3.py/blob/master/docs/examples.rst
This section should show someone how to check their Unicorn token balance.
Rough approach:
ethtoken
linked below)0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb
appears to be the first address to have received a unicorn, so could be a good candidate.decimals()
, and how to adjust the token balance to get the token count: dividing by10^decimals
plus a brief explainer of the difference between the token balance and token count (token balance is always an integer, token count may be a fraction)This repository has some example code that might be helpful if you're not sure how to connect to an ERC20 token: https://github.com/carver/ethtoken.py (You can footnote the repo if you want, but it's best to copy in anything that the reader might need).
ERC20 probably deserves its own whole page with different use case examples, but that is out of scope.
The text was updated successfully, but these errors were encountered: