Skip to content

Replaced all public address #2785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions docs/contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ Methods

>>> math_contract.functions.increment(5).build_transaction({'maxFeePerGas': 2000000000, 'maxPriorityFeePerGas': 1000000000})
{
'to': '0x6Bc272FCFcf89C14cebFC57B8f1543F5137F97dE',
'to': 'account_address',
'data': '0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005',
'value': 0,
'gas': 43242,
Expand Down Expand Up @@ -966,7 +966,7 @@ For example:
'logIndex': 0,
'transactionIndex': 0,
'transactionHash': HexBytes('0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa'),
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
'address': 'account_address',
'blockHash': HexBytes('0xd74c3e8bdb19337987b987aee0fa48ed43f8f2318edfc84e3a8643e009592a68'),
'blockNumber': 3
})
Expand Down Expand Up @@ -1015,7 +1015,7 @@ For example:
'logIndex': 0,
'transactionIndex': 0,
'transactionHash': HexBytes('0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa'),
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
'address': 'account_address',
'blockHash': HexBytes('0xd74c3e8bdb19337987b987aee0fa48ed43f8f2318edfc84e3a8643e009592a68'),
'blockNumber': 3
})
Expand Down Expand Up @@ -1050,12 +1050,12 @@ Event Log Object
ABI = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"inputs":[{"name":"_totalSupply","type":"uint256"}],"payable":false,"type":"constructor","stateMutability":"nonpayable"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]'
my_token_contract = w3.eth.contract(abi=ABI, bytecode=bytecode)
alice, bob = w3.eth.accounts[0], w3.eth.accounts[1]
assert alice == '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', alice
assert bob == '0x2B5AD5c4795c026514f8317c7a215E218DcCD6cF', bob
assert alice == 'account_address', alice
assert bob == 'account_address', bob
tx_hash = my_token_contract.constructor(1000000).transact({'from': alice, 'gas': 899000, 'gasPrice': Web3.to_wei(1, 'gwei')})
assert tx_hash == HexBytes('0x49e3da72a95e4074a9eaea7b438c73ca154627d317e58abeae914e3769a15044'), tx_hash
txn_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
assert txn_receipt['contractAddress'] == '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', txn_receipt['contractAddress']
assert txn_receipt['contractAddress'] == 'account_address', txn_receipt['contractAddress']
contract_address = txn_receipt['contractAddress']
contract = w3.eth.contract(contract_address, abi=ABI)
total_supply = contract.functions.totalSupply().call()
Expand All @@ -1069,49 +1069,49 @@ Event Log Object
>>> transfer_filter = my_token_contract.events.Transfer.create_filter(fromBlock="0x0", argument_filters={'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf'})
>>> transfer_filter.get_new_entries()
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
'to': 'account_address',
'value': 10}),
'event': 'Transfer',
'logIndex': 0,
'transactionIndex': 0,
'transactionHash': HexBytes('0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678'),
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
'address': 'account_address',
'blockHash': HexBytes('...'),
'blockNumber': 2})]
>>> transfer_filter.get_new_entries()
[]
>>> tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': 674302241})
>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
>>> transfer_filter.get_new_entries()
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
[AttributeDict({'args': AttributeDict({'from': 'sender_account_address',
'to': 'account_address',
'value': 10}),
'event': 'Transfer',
'logIndex': 0,
'transactionIndex': 0,
'transactionHash': HexBytes('0xa23e7ef4d2692c5cf34ee99123c9c73099e9c3b68c7850f91c1cbcb91ac327e0'),
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
'address': 'account_address',
'blockHash': HexBytes('...'),
'blockNumber': 3})]
>>> transfer_filter.get_all_entries()
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
[AttributeDict({'args': AttributeDict({'from': 'sender_account_address',
'to': 'account_address',
'value': 10}),
'event': 'Transfer',
'logIndex': 0,
'transactionIndex': 0,
'transactionHash': HexBytes('0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678'),
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
'address': 'account_address',
'blockHash': HexBytes('...'),
'blockNumber': 2}),
AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
AttributeDict({'args': AttributeDict({'from': 'sender_account_address',
'to': 'account_address',
'value': 10}),
'event': 'Transfer',
'logIndex': 0,
'transactionIndex': 0,
'transactionHash': HexBytes('0xa23e7ef4d2692c5cf34ee99123c9c73099e9c3b68c7850f91c1cbcb91ac327e0'),
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
'address': 'account_address',
'blockHash': HexBytes('...'),
'blockNumber': 3})]

Expand All @@ -1130,7 +1130,7 @@ Utils
'0x612e45a3000000000000000000000000b656b2a9c3b2416437a811e07466ca712f5a5b5a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000116c6f6e656c792c20736f206c6f6e656c7900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
>>> contract.decode_function_input(transaction.input)
(<Function newProposal(address,uint256,string,bytes,uint256,bool)>,
{'_recipient': '0xB656b2a9c3b2416437A811e07466cA712F5a5b5a',
{'_recipient': 'account_address',
'_amount': 0,
'_description': b'lonely, so lonely',
'_transactionData': b'',
Expand Down
18 changes: 9 additions & 9 deletions docs/ens_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Get the Address for an ENS Name

from ens.auto import ns
eth_address = ns.address('jasoncarver.eth')
assert eth_address == '0x5B2063246F2191f18F2675ceDB8b28102e957458'
assert eth_address == 'account_address'

The ``ENS`` module has no opinion as to which TLD you can use,
but will not infer a TLD if it is not provided with the name.
Expand All @@ -86,13 +86,13 @@ Get the ENS Name for an Address

.. code-block:: python

domain = ns.name('0x5B2063246F2191f18F2675ceDB8b28102e957458')
domain = ns.name('account_address')

# name() also accepts the bytes version of the address
assert ns.name(b'[ c$o!\x91\xf1\x8f&u\xce\xdb\x8b(\x10.\x95tX') == domain

# confirm that the name resolves back to the address that you looked up:
assert ns.address(domain) == '0x5B2063246F2191f18F2675ceDB8b28102e957458'
assert ns.address(domain) == 'account_address'

.. note:: For accuracy, and as a recommendation from the ENS documentation on
`reverse resolution <https://docs.ens.domains/dapp-developer-guide/resolving-names#reverse-resolution>`_,
Expand Down Expand Up @@ -120,7 +120,7 @@ you must already be the owner of the domain (or its parent).

.. code-block:: python

ns.setup_address('jasoncarver.eth', '0x5B2063246F2191f18F2675ceDB8b28102e957458')
ns.setup_address('jasoncarver.eth', 'account_address')

In the common case where you want to point the name to the owning address, you can skip the address.

Expand All @@ -137,7 +137,7 @@ You can claim arbitrarily deep subdomains.
# wait for the transaction to be mined, then:
assert (
ns.address('supreme.executive.power.derives.from.a.mandate.from.the.masses.jasoncarver.eth')
== '0x5B2063246F2191f18F2675ceDB8b28102e957458'
== 'account_address'
)

.. warning:: Gas costs scale up with the number of subdomains!
Expand All @@ -152,7 +152,7 @@ this is referred to as "reverse" resolution. The ENS Reverse Resolver is used fo

.. code-block:: python

ns.setup_name('jasoncarver.eth', '0x5B2063246F2191f18F2675ceDB8b28102e957458')
ns.setup_name('jasoncarver.eth', 'account_address')

If you don't supply the address, :meth:`~ens.ENS.setup_name` will assume you want the
address returned by :meth:`~ens.ENS.address`.
Expand All @@ -168,7 +168,7 @@ Wait for the transaction to be mined, then:

.. code-block:: python

assert ns.name('0x5B2063246F2191f18F2675ceDB8b28102e957458') == 'jasoncarver.eth'
assert ns.name('account_address') == 'jasoncarver.eth'

....

Expand All @@ -185,7 +185,7 @@ You'll need to setup the address first, and then the text can be set:

.. code-block:: python

ns.setup_address('jasoncarver.eth', '0x5B2063246F2191f18F2675ceDB8b28102e957458')
ns.setup_address('jasoncarver.eth', 'account_address')
ns.set_text('jasoncarver.eth', 'url', 'https://example.com')

A transaction dictionary can be passed as the last argument if desired:
Expand Down Expand Up @@ -223,7 +223,7 @@ You can get the resolver for an ENS name via the :meth:`~ens.ENS.resolver` metho

>>> resolver = ns.resolver('jasoncarver.eth')
>>> resolver.address
'0x5FfC014343cd971B7eb70732021E26C35B744cc4'
'account_address'

....

Expand Down
4 changes: 2 additions & 2 deletions docs/ethpm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ This is the simplest builder function for adding a deployment to a manifest. All
... 'blockchain://1234567890123456789012345678901234567890123456789012345678901234/block/1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef': {
... 'Owned': {
... 'contractType': 'Owned',
... 'address': '0x4F5B11C860B37B68De6d14FB7e7b5f18A9a1BD00',
... 'address': 'account_address',
... }
... }
... }
Expand All @@ -804,7 +804,7 @@ This is the simplest builder function for adding a deployment to a manifest. All
... block_uri='blockchain://1234567890123456789012345678901234567890123456789012345678901234/block/1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
... contract_instance='Owned',
... contract_type='Owned',
... address='0x4F5B11C860B37B68De6d14FB7e7b5f18A9a1BD00',
... address='account_address',
... ),
... )
>>> assert expected_manifest == built_manifest
Expand Down
Loading