Merge pull request #12516 from fulldecent/feature-docs-address

Document address members code and codehash. Fixes #12495
This commit is contained in:
Daniel Kirchner 2022-01-13 10:07:33 +01:00 committed by GitHub
commit f36a0eb545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,6 +329,10 @@ on ``call``.
regardless of whether state is read from or written to, as this can have many pitfalls. regardless of whether state is read from or written to, as this can have many pitfalls.
Also, access to gas might change in the future. Also, access to gas might change in the future.
* ``code`` and ``codehash``
You can query the deployed code for any smart contract. Use ``code`` to get the EVM bytecode as a string, which might be empty. Use ``codehash`` get the Keccak-256 hash of that code.
.. note:: .. note::
All contracts can be converted to ``address`` type, so it is possible to query the balance of the All contracts can be converted to ``address`` type, so it is possible to query the balance of the
current contract using ``address(this).balance``. current contract using ``address(this).balance``.