From 68b5bff992fc983ff2590ac09700418083e5c7a3 Mon Sep 17 00:00:00 2001 From: fselmo Date: Thu, 19 Jan 2023 16:18:08 -0700 Subject: [PATCH 1/5] Updates and refactoring to test contracts - Update test contracts to compile with Solidity v0.8.17 - Refactor some of the logic using test contracts for efficiency --- tests/core/contracts/conftest.py | 512 +++++++++--------- .../test_contract_ambiguous_functions.py | 6 +- .../test_contract_build_transaction.py | 80 +-- .../contracts/test_contract_call_interface.py | 72 +-- .../test_contract_caller_interface.py | 8 +- .../test_contract_class_construction.py | 32 +- .../contracts/test_contract_constructor.py | 119 ++-- .../test_contract_constructor_encoding.py | 38 +- .../contracts/test_contract_deployment.py | 70 +-- .../contracts/test_contract_estimate_gas.py | 18 +- .../test_contract_events_build_filter.py | 25 +- tests/core/contracts/test_contract_init.py | 38 +- .../test_contract_transact_interface.py | 46 +- .../contracts/test_extracting_event_data.py | 8 +- .../test_extracting_event_data_old.py | 4 +- tests/core/eth-module/conftest.py | 27 - tests/core/filtering/conftest.py | 28 +- .../filtering/test_contract_data_filters.py | 28 +- .../filtering/test_contract_topic_filters.py | 24 +- tests/integration/conftest.py | 6 +- .../generate_fixtures/go_ethereum.py | 8 +- .../contract_sources/AddressReflector.sol | 11 + .../contract_sources/BytesContracts.sol | 43 ++ .../contract_sources/ConstructorContracts.sol | 23 + web3/_utils/contract_sources/Emitter.sol | 2 +- web3/_utils/contract_sources/MathContract.sol | 31 ++ .../contract_sources/StringContract.sol | 22 + .../_utils/module_testing/emitter_contract.py | 6 +- web3/_utils/module_testing/eth_module.py | 18 +- web3/_utils/module_testing/event_contract.py | 6 +- 30 files changed, 742 insertions(+), 617 deletions(-) create mode 100644 web3/_utils/contract_sources/AddressReflector.sol create mode 100644 web3/_utils/contract_sources/BytesContracts.sol create mode 100644 web3/_utils/contract_sources/ConstructorContracts.sol create mode 100644 web3/_utils/contract_sources/MathContract.sol create mode 100644 web3/_utils/contract_sources/StringContract.sol diff --git a/tests/core/contracts/conftest.py b/tests/core/contracts/conftest.py index 630f49d3e7..c7d0745b18 100644 --- a/tests/core/contracts/conftest.py +++ b/tests/core/contracts/conftest.py @@ -15,14 +15,14 @@ async_partial, ) from web3._utils.module_testing.emitter_contract import ( - CONTRACT_EMITTER_ABI, - CONTRACT_EMITTER_CODE, - CONTRACT_EMITTER_RUNTIME, + EMITTER_CONTRACT_ABI, + EMITTER_CONTRACT_BYTECODE, + EMITTER_CONTRACT_RUNTIME, ) from web3._utils.module_testing.event_contract import ( - EVNT_CONTRACT_ABI, - EVNT_CONTRACT_CODE, - EVNT_CONTRACT_RUNTIME, + EVENT_CONTRACT_ABI, + EVENT_CONTRACT_CODE, + EVENT_CONTRACT_RUNTIME, ) from web3._utils.module_testing.fallback_contract import ( CONTRACT_FALLBACK_FUNCTION_ABI, @@ -149,240 +149,261 @@ def TupleContract(w3, TUPLE_CONTRACT): return w3.eth.contract(**TUPLE_CONTRACT) -CONTRACT_CODE = "0x606060405261022e806100126000396000f360606040523615610074576000357c01000000000000000000000000000000000000000000000000000000009004806316216f391461007657806361bc221a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d578063dcf537b11461014057610074565b005b610083600480505061016c565b6040518082815260200191505060405180910390f35b6100a6600480505061017f565b6040518082815260200191505060405180910390f35b6100d26004808035906020019091905050610188565b6040518082815260200191505060405180910390f35b61010760048080359060200190919080359060200190919050506101ea565b6040518082815260200191505060405180910390f35b61012a6004805050610201565b6040518082815260200191505060405180910390f35b6101566004808035906020019091905050610217565b6040518082815260200191505060405180910390f35b6000600d9050805080905061017c565b90565b60006000505481565b6000816000600082828250540192505081905550600060005054905080507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5816040518082815260200191505060405180910390a18090506101e5565b919050565b6000818301905080508090506101fb565b92915050565b600061020d6001610188565b9050610214565b90565b60006007820290508050809050610229565b91905056" # noqa: E501 -CONTRACT_RUNTIME = "0x60606040523615610074576000357c01000000000000000000000000000000000000000000000000000000009004806316216f391461007657806361bc221a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d578063dcf537b11461014057610074565b005b610083600480505061016c565b6040518082815260200191505060405180910390f35b6100a6600480505061017f565b6040518082815260200191505060405180910390f35b6100d26004808035906020019091905050610188565b6040518082815260200191505060405180910390f35b61010760048080359060200190919080359060200190919050506101ea565b6040518082815260200191505060405180910390f35b61012a6004805050610201565b6040518082815260200191505060405180910390f35b6101566004808035906020019091905050610217565b6040518082815260200191505060405180910390f35b6000600d9050805080905061017c565b90565b60006000505481565b6000816000600082828250540192505081905550600060005054905080507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5816040518082815260200191505060405180910390a18090506101e5565b919050565b6000818301905080508090506101fb565b92915050565b600061020d6001610188565b9050610214565b90565b60006007820290508050809050610229565b91905056" # noqa: E501 -CONTRACT_ABI = json.loads( - '[{"constant":false,"inputs":[],"name":"return13","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[],"name":"counter","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"amt","type":"uint256"}],"name":"increment","outputs":[{"name":"result","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"},{"name":"b","type":"int256"}],"name":"add","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":false,"inputs":[],"name":"increment","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"}],"name":"multiply7","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"event"}]' # noqa: E501 +# source: web3/_utils/contract_sources/MathContract.sol +# compiled with Solidity 0.8.17 +MATH_CONTRACT_CODE = "0x60806040526000805534801561001457600080fd5b5061055b806100246000396000f3fe6080604052600436106100555760003560e01c806316216f391461005a5780635b34b9661461008557806361bc221a146100a35780636abbb3b4146100ce578063a5f3c23b146100fe578063dcf537b11461012e575b600080fd5b34801561006657600080fd5b5061006f61015e565b60405161007c9190610260565b60405180910390f35b61008d610167565b60405161009a9190610294565b60405180910390f35b3480156100af57600080fd5b506100b86101be565b6040516100c59190610294565b60405180910390f35b6100e860048036038101906100e391906102e0565b6101c4565b6040516100f59190610294565b60405180910390f35b61011860048036038101906101139190610339565b61021b565b6040516101259190610260565b60405180910390f35b61014860048036038101906101439190610379565b610231565b6040516101559190610260565b60405180910390f35b6000600d905090565b6000600160005461017891906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c560016040516101ae919061044e565b60405180910390a1600054905090565b60005481565b6000816000546101d491906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5826040516102099190610294565b60405180910390a16000549050919050565b600081836102299190610469565b905092915050565b600060078261024091906104ad565b9050919050565b6000819050919050565b61025a81610247565b82525050565b60006020820190506102756000830184610251565b92915050565b6000819050919050565b61028e8161027b565b82525050565b60006020820190506102a96000830184610285565b92915050565b600080fd5b6102bd8161027b565b81146102c857600080fd5b50565b6000813590506102da816102b4565b92915050565b6000602082840312156102f6576102f56102af565b5b6000610304848285016102cb565b91505092915050565b61031681610247565b811461032157600080fd5b50565b6000813590506103338161030d565b92915050565b600080604083850312156103505761034f6102af565b5b600061035e85828601610324565b925050602061036f85828601610324565b9150509250929050565b60006020828403121561038f5761038e6102af565b5b600061039d84828501610324565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e08261027b565b91506103eb8361027b565b9250828201905080821115610403576104026103a6565b5b92915050565b6000819050919050565b6000819050919050565b600061043861043361042e84610409565b610413565b61027b565b9050919050565b6104488161041d565b82525050565b6000602082019050610463600083018461043f565b92915050565b600061047482610247565b915061047f83610247565b9250828201905082811215600083121683821260008412151617156104a7576104a66103a6565b5b92915050565b60006104b882610247565b91506104c383610247565b92508282026104d181610247565b91507f80000000000000000000000000000000000000000000000000000000000000008414600084121615610509576105086103a6565b5b828205841483151761051e5761051d6103a6565b5b509291505056fea2646970667358221220607cd99eabba12e9d39e526a2c5ee82f4af77472608174275cd751b1d4bc047164736f6c63430008110033" # noqa: E501 +MATH_CONTRACT_RUNTIME = "0x6080604052600436106100555760003560e01c806316216f391461005a5780635b34b9661461008557806361bc221a146100a35780636abbb3b4146100ce578063a5f3c23b146100fe578063dcf537b11461012e575b600080fd5b34801561006657600080fd5b5061006f61015e565b60405161007c9190610260565b60405180910390f35b61008d610167565b60405161009a9190610294565b60405180910390f35b3480156100af57600080fd5b506100b86101be565b6040516100c59190610294565b60405180910390f35b6100e860048036038101906100e391906102e0565b6101c4565b6040516100f59190610294565b60405180910390f35b61011860048036038101906101139190610339565b61021b565b6040516101259190610260565b60405180910390f35b61014860048036038101906101439190610379565b610231565b6040516101559190610260565b60405180910390f35b6000600d905090565b6000600160005461017891906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c560016040516101ae919061044e565b60405180910390a1600054905090565b60005481565b6000816000546101d491906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5826040516102099190610294565b60405180910390a16000549050919050565b600081836102299190610469565b905092915050565b600060078261024091906104ad565b9050919050565b6000819050919050565b61025a81610247565b82525050565b60006020820190506102756000830184610251565b92915050565b6000819050919050565b61028e8161027b565b82525050565b60006020820190506102a96000830184610285565b92915050565b600080fd5b6102bd8161027b565b81146102c857600080fd5b50565b6000813590506102da816102b4565b92915050565b6000602082840312156102f6576102f56102af565b5b6000610304848285016102cb565b91505092915050565b61031681610247565b811461032157600080fd5b50565b6000813590506103338161030d565b92915050565b600080604083850312156103505761034f6102af565b5b600061035e85828601610324565b925050602061036f85828601610324565b9150509250929050565b60006020828403121561038f5761038e6102af565b5b600061039d84828501610324565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e08261027b565b91506103eb8361027b565b9250828201905080821115610403576104026103a6565b5b92915050565b6000819050919050565b6000819050919050565b600061043861043361042e84610409565b610413565b61027b565b9050919050565b6104488161041d565b82525050565b6000602082019050610463600083018461043f565b92915050565b600061047482610247565b915061047f83610247565b9250828201905082811215600083121683821260008412151617156104a7576104a66103a6565b5b92915050565b60006104b882610247565b91506104c383610247565b92508282026104d181610247565b91507f80000000000000000000000000000000000000000000000000000000000000008414600084121615610509576105086103a6565b5b828205841483151761051e5761051d6103a6565b5b509291505056fea2646970667358221220607cd99eabba12e9d39e526a2c5ee82f4af77472608174275cd751b1d4bc047164736f6c63430008110033" # noqa: E501 +MATH_CONTRACT_ABI = json.loads( + '[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Increased","type":"event"},{"inputs":[{"internalType":"int256","name":"a","type":"int256"},{"internalType":"int256","name":"b","type":"int256"}],"name":"add","outputs":[{"internalType":"int256","name":"result","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"counter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incrementCounter","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"incrementCounter","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"a","type":"int256"}],"name":"multiply7","outputs":[{"internalType":"int256","name":"result","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"return13","outputs":[{"internalType":"int256","name":"result","type":"int256"}],"stateMutability":"nonpayable","type":"function"}]' # noqa: E501 ) @pytest.fixture(scope="session") -def MATH_CODE(): - return CONTRACT_CODE +def math_contract_bytecode(): + return MATH_CONTRACT_CODE @pytest.fixture(scope="session") -def MATH_RUNTIME(): - return CONTRACT_RUNTIME +def math_contract_runtime(): + return MATH_CONTRACT_RUNTIME @pytest.fixture(scope="session") -def MATH_ABI(): - return CONTRACT_ABI +def math_contract_abi(): + return MATH_CONTRACT_ABI @pytest.fixture() -def MathContract(w3, MATH_ABI, MATH_CODE, MATH_RUNTIME): +def math_contract_instance( + w3, math_contract_abi, math_contract_bytecode, math_contract_runtime +): return w3.eth.contract( - abi=MATH_ABI, - bytecode=MATH_CODE, - bytecode_runtime=MATH_RUNTIME, + abi=math_contract_abi, + bytecode=math_contract_bytecode, + bytecode_runtime=math_contract_runtime, ) @pytest.fixture() -def math_contract(w3, MathContract, address_conversion_func): - return deploy(w3, MathContract, address_conversion_func) +def math_contract(w3, math_contract_instance, address_conversion_func): + return deploy(w3, math_contract_instance, address_conversion_func) -CONTRACT_SIMPLE_CONSTRUCTOR_CODE = "0x60606040526003600055602c8060156000396000f3606060405260e060020a600035046373d4a13a8114601a575b005b602260005481565b6060908152602090f3" # noqa: E501 -CONTRACT_SIMPLE_CONSTRUCTOR_RUNTIME = "0x606060405260e060020a600035046373d4a13a8114601a575b005b602260005481565b6060908152602090f3" # noqa: E501 -CONTRACT_SIMPLE_CONSTRUCTOR_ABI = json.loads( - '[{"constant":true,"inputs":[],"name":"data","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"inputs":[],"type":"constructor"}]' # noqa: E501 -) +# source: web3/_utils/contract_sources/ConstructorContracts.sol:SimpleConstructor +# compiled with Solidity 0.8.17 +SIMPLE_CONSTRUCTOR_BYTECODE = "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea264697066735822122034ed61fab7939a9b4f373acbbdb1df0be80fb7f7ffb35d8b25d6e4deff947b4d64736f6c63430008110033" # noqa: E501 +SIMPLE_CONSTRUCTOR_RUNTIME = "0x6080604052600080fdfea264697066735822122034ed61fab7939a9b4f373acbbdb1df0be80fb7f7ffb35d8b25d6e4deff947b4d64736f6c63430008110033" # noqa: E501 +SIMPLE_CONSTRUCTOR_ABI = json.loads('[{"inputs":[],"type":"constructor"}]') @pytest.fixture(scope="session") -def SIMPLE_CONSTRUCTOR_CODE(): - return CONTRACT_SIMPLE_CONSTRUCTOR_CODE +def simple_constructor_contract_bytecode(): + return SIMPLE_CONSTRUCTOR_BYTECODE @pytest.fixture(scope="session") -def SIMPLE_CONSTRUCTOR_RUNTIME(): - return CONTRACT_SIMPLE_CONSTRUCTOR_RUNTIME +def simple_constructor_contract_runtime(): + return SIMPLE_CONSTRUCTOR_RUNTIME @pytest.fixture(scope="session") -def SIMPLE_CONSTRUCTOR_ABI(): - return CONTRACT_SIMPLE_CONSTRUCTOR_ABI +def simple_constructor_contract_abi(): + return SIMPLE_CONSTRUCTOR_ABI @pytest.fixture() -def SimpleConstructorContract( - w3, SIMPLE_CONSTRUCTOR_CODE, SIMPLE_CONSTRUCTOR_RUNTIME, SIMPLE_CONSTRUCTOR_ABI +def simple_constructor_contract_instance( + w3, + simple_constructor_contract_bytecode, + simple_constructor_contract_runtime, + simple_constructor_contract_abi, ): return w3.eth.contract( - abi=SIMPLE_CONSTRUCTOR_ABI, - bytecode=SIMPLE_CONSTRUCTOR_CODE, - bytecode_runtime=SIMPLE_CONSTRUCTOR_RUNTIME, + abi=simple_constructor_contract_abi, + bytecode=simple_constructor_contract_bytecode, + bytecode_runtime=simple_constructor_contract_runtime, ) -CONTRACT_WITH_CONSTRUCTOR_ARGUMENTS_CODE = "0x60606040818152806066833960a09052516080516000918255600155603e908190602890396000f3606060405260e060020a600035046388ec134681146024578063d4c46c7614602c575b005b603460005481565b603460015481565b6060908152602090f3" # noqa: E501 -CONTRACT_WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME = "0x606060405260e060020a600035046388ec134681146024578063d4c46c7614602c575b005b603460005481565b603460015481565b6060908152602090f3" # noqa: E501 -CONTRACT_WITH_CONSTRUCTOR_ARGUMENTS_ABI = json.loads( - '[{"constant":true,"inputs":[],"name":"data_a","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"data_b","outputs":[{"name":"","type":"bytes32"}],"type":"function"},{"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"bytes32"}],"type":"constructor"}]' # noqa: E501 +# source: web3/_utils/contract_sources/ConstructorContracts.sol:ConstructorWithArguments +# compiled with Solidity 0.8.17 +CONTRACT_WITH_CONSTRUCTOR_ARGS_BYTECODE = "0x608060405234801561001057600080fd5b50604051610214380380610214833981810160405281019061003291906100b8565b816000819055508060018190555050506100f8565b600080fd5b6000819050919050565b61005f8161004c565b811461006a57600080fd5b50565b60008151905061007c81610056565b92915050565b6000819050919050565b61009581610082565b81146100a057600080fd5b50565b6000815190506100b28161008c565b92915050565b600080604083850312156100cf576100ce610047565b5b60006100dd8582860161006d565b92505060206100ee858286016100a3565b9150509250929050565b61010d806101076000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806388ec1346146037578063d4c46c76146051575b600080fd5b603d606b565b60405160489190608e565b60405180910390f35b60576071565b6040516062919060be565b60405180910390f35b60005481565b60015481565b6000819050919050565b6088816077565b82525050565b600060208201905060a160008301846081565b92915050565b6000819050919050565b60b88160a7565b82525050565b600060208201905060d1600083018460b1565b9291505056fea264697066735822122035bd964aa6a147f69a8ae5b1fd3a4f2994de267d538a55ec4252b912b39cbb5064736f6c63430008110033" # noqa: E501 +CONTRACT_WITH_CONSTRUCTOR_ARGS_RUNTIME = "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806388ec1346146037578063d4c46c76146051575b600080fd5b603d606b565b60405160489190608e565b60405180910390f35b60576071565b6040516062919060be565b60405180910390f35b60005481565b60015481565b6000819050919050565b6088816077565b82525050565b600060208201905060a160008301846081565b92915050565b6000819050919050565b60b88160a7565b82525050565b600060208201905060d1600083018460b1565b9291505056fea264697066735822122035bd964aa6a147f69a8ae5b1fd3a4f2994de267d538a55ec4252b912b39cbb5064736f6c63430008110033" # noqa: E501 +CONTRACT_WITH_CONSTRUCTOR_ARGS_ABI = json.loads( + '[{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"bytes32","name":"b","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"data_a","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"data_b","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]' # noqa: E501 ) @pytest.fixture() -def WITH_CONSTRUCTOR_ARGUMENTS_CODE(): - return CONTRACT_WITH_CONSTRUCTOR_ARGUMENTS_CODE +def contract_with_constructor_args_bytecode(): + return CONTRACT_WITH_CONSTRUCTOR_ARGS_BYTECODE @pytest.fixture() -def WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME(): - return CONTRACT_WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME +def contract_with_constructor_args_runtime(): + return CONTRACT_WITH_CONSTRUCTOR_ARGS_RUNTIME @pytest.fixture() -def WITH_CONSTRUCTOR_ARGUMENTS_ABI(): - return CONTRACT_WITH_CONSTRUCTOR_ARGUMENTS_ABI +def contract_with_constructor_args_abi(): + return CONTRACT_WITH_CONSTRUCTOR_ARGS_ABI @pytest.fixture() -def WithConstructorArgumentsContract( +def contract_with_constructor_args_instance( w3, - WITH_CONSTRUCTOR_ARGUMENTS_CODE, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, - WITH_CONSTRUCTOR_ARGUMENTS_ABI, + contract_with_constructor_args_bytecode, + contract_with_constructor_args_runtime, + contract_with_constructor_args_abi, ): return w3.eth.contract( - abi=WITH_CONSTRUCTOR_ARGUMENTS_ABI, - bytecode=WITH_CONSTRUCTOR_ARGUMENTS_CODE, - bytecode_runtime=WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + abi=contract_with_constructor_args_abi, + bytecode=contract_with_constructor_args_bytecode, + bytecode_runtime=contract_with_constructor_args_runtime, ) -@pytest.fixture() -def NonStrictWithConstructorArgumentsContract( +@pytest.fixture +def non_strict_contract_with_constructor_args_instance( w3_non_strict_abi, - WITH_CONSTRUCTOR_ARGUMENTS_CODE, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, - WITH_CONSTRUCTOR_ARGUMENTS_ABI, + contract_with_constructor_args_bytecode, + contract_with_constructor_args_runtime, + contract_with_constructor_args_abi, ): return w3_non_strict_abi.eth.contract( - abi=WITH_CONSTRUCTOR_ARGUMENTS_ABI, - bytecode=WITH_CONSTRUCTOR_ARGUMENTS_CODE, - bytecode_runtime=WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + abi=contract_with_constructor_args_abi, + bytecode=contract_with_constructor_args_bytecode, + bytecode_runtime=contract_with_constructor_args_runtime, ) -CONTRACT_WITH_CONSTRUCTOR_ADDRESS_CODE = "0x6060604052604051602080607683395060806040525160008054600160a060020a031916821790555060428060346000396000f3606060405260e060020a600035046334664e3a8114601a575b005b603860005473ffffffffffffffffffffffffffffffffffffffff1681565b6060908152602090f3" # noqa: E501 -CONTRACT_WITH_CONSTRUCTOR_ADDRESS_RUNTIME = "0x606060405260e060020a600035046334664e3a8114601a575b005b603860005473ffffffffffffffffffffffffffffffffffffffff1681565b6060908152602090f3" # noqa: E501 +# source: web3/_utils/contract_sources/ConstructorContracts.sol:ConstructorWithAddressArgument # noqa: E501 +# compiled with Solidity 0.8.17 +CONTRACT_WITH_CONSTRUCTOR_ADDRESS_BYTECODE = "0x608060405234801561001057600080fd5b5060405161020d38038061020d833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b60f7806101166000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806334664e3a14602d575b600080fd5b60336047565b604051603e919060a8565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000609482606b565b9050919050565b60a281608b565b82525050565b600060208201905060bb6000830184609b565b9291505056fea2646970667358221220405a81c137def72f9de1e09c28e163d7f76ed721346c9d7c7761c6d923dfcb9364736f6c63430008110033" # noqa: E501 +CONTRACT_WITH_CONSTRUCTOR_ADDRESS_RUNTIME = "0x6080604052348015600f57600080fd5b506004361060285760003560e01c806334664e3a14602d575b600080fd5b60336047565b604051603e919060a8565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000609482606b565b9050919050565b60a281608b565b82525050565b600060208201905060bb6000830184609b565b9291505056fea2646970667358221220405a81c137def72f9de1e09c28e163d7f76ed721346c9d7c7761c6d923dfcb9364736f6c63430008110033" # noqa: E501 CONTRACT_WITH_CONSTRUCTOR_ADDRESS_ABI = json.loads( - '[{"constant":true,"inputs":[],"name":"testAddr","outputs":[{"name":"","type":"address"}],"type":"function"},{"inputs":[{"name":"_testAddr","type":"address"}],"type":"constructor"}]' # noqa: E501 + '[{"inputs":[{"internalType":"address","name":"_testAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"testAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]' # noqa: E501 ) -@pytest.fixture() -def WITH_CONSTRUCTOR_ADDRESS_CODE(): - return CONTRACT_WITH_CONSTRUCTOR_ADDRESS_CODE +@pytest.fixture +def contract_with_constructor_address_bytecode(): + return CONTRACT_WITH_CONSTRUCTOR_ADDRESS_BYTECODE -@pytest.fixture() -def WITH_CONSTRUCTOR_ADDRESS_RUNTIME(): +@pytest.fixture +def contract_with_constructor_address_runtime(): return CONTRACT_WITH_CONSTRUCTOR_ADDRESS_RUNTIME -@pytest.fixture() -def WITH_CONSTRUCTOR_ADDRESS_ABI(): +@pytest.fixture +def contract_with_constructor_address_abi(): return CONTRACT_WITH_CONSTRUCTOR_ADDRESS_ABI -@pytest.fixture() -def WithConstructorAddressArgumentsContract( +@pytest.fixture +def contract_with_constructor_address_instance( w3, - WITH_CONSTRUCTOR_ADDRESS_CODE, - WITH_CONSTRUCTOR_ADDRESS_RUNTIME, - WITH_CONSTRUCTOR_ADDRESS_ABI, + contract_with_constructor_address_bytecode, + contract_with_constructor_address_runtime, + contract_with_constructor_address_abi, ): return w3.eth.contract( - abi=WITH_CONSTRUCTOR_ADDRESS_ABI, - bytecode=WITH_CONSTRUCTOR_ADDRESS_CODE, - bytecode_runtime=WITH_CONSTRUCTOR_ADDRESS_RUNTIME, + abi=contract_with_constructor_address_abi, + bytecode=contract_with_constructor_address_bytecode, + bytecode_runtime=contract_with_constructor_address_runtime, ) -@pytest.fixture() -def address_contract( - w3, WithConstructorAddressArgumentsContract, address_conversion_func +@pytest.fixture +def contract_with_constructor_address( + w3, contract_with_constructor_address_instance, address_conversion_func ): return deploy( w3, - WithConstructorAddressArgumentsContract, + contract_with_constructor_address_instance, address_conversion_func, args=["0xd3CdA913deB6f67967B99D67aCDFa1712C293601"], ) -CONTRACT_ADDRESS_REFLECTOR_CODE = "6060604052341561000f57600080fd5b6101ca8061001e6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630b816c1614610048578063c04d11fc146100c157600080fd5b341561005357600080fd5b61007f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610170565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100cc57600080fd5b61011960048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061017a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561015c578082015181840152602081019050610141565b505050509050019250505060405180910390f35b6000819050919050565b61018261018a565b819050919050565b6020604051908101604052806000815250905600a165627a7a723058206b15d98a803b91327d94f943e9712291539701b2f7370e10f5873633941484930029" # noqa: 501 -CONTRACT_ADDRESS_REFLECTOR_RUNTIME = "60606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630b816c1614610048578063c04d11fc146100c157600080fd5b341561005357600080fd5b61007f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610170565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100cc57600080fd5b61011960048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061017a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561015c578082015181840152602081019050610141565b505050509050019250505060405180910390f35b6000819050919050565b61018261018a565b819050919050565b6020604051908101604052806000815250905600a165627a7a723058206b15d98a803b91327d94f943e9712291539701b2f7370e10f5873633941484930029" # noqa: 501 -CONTRACT_ADDRESS_REFLECTOR_ABI = json.loads( - '[{"constant":true,"inputs":[{"name":"arg","type":"address"}],"name":"reflect","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"arg","type":"address[]"}],"name":"reflect","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"pure","type":"function"}]' # noqa: 501 +# source: web3/_utils/contract_sources/AddressReflector.sol:AddressReflector +# compiled with Solidity 0.8.17 +ADDRESS_REFLECTOR_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50610430806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea2646970667358221220371edff19873fdfb0d5f8053a775ef099ccb159b5f09b58d9f0efaf186cbda4e64736f6c63430008110033" # noqa: 501 +ADDRESS_REFLECTOR_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea2646970667358221220371edff19873fdfb0d5f8053a775ef099ccb159b5f09b58d9f0efaf186cbda4e64736f6c63430008110033" # noqa: 501 +ADDRESS_REFLECTOR_CONTRACT_ABI = json.loads( + '[{"inputs":[{"internalType":"address","name":"arg","type":"address"}],"name":"reflect","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"arg","type":"address[]"}],"name":"reflect","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"pure","type":"function"}]' # noqa: 501 ) -@pytest.fixture() -def AddressReflectorContract(w3): +@pytest.fixture +def address_reflector_contract_instance(w3): return w3.eth.contract( - abi=CONTRACT_ADDRESS_REFLECTOR_ABI, - bytecode=CONTRACT_ADDRESS_REFLECTOR_CODE, - bytecode_runtime=CONTRACT_ADDRESS_REFLECTOR_RUNTIME, + abi=ADDRESS_REFLECTOR_CONTRACT_ABI, + bytecode=ADDRESS_REFLECTOR_CONTRACT_BYTECODE, + bytecode_runtime=ADDRESS_REFLECTOR_CONTRACT_RUNTIME, ) -@pytest.fixture() -def address_reflector_contract(w3, AddressReflectorContract, address_conversion_func): - return deploy(w3, AddressReflectorContract, address_conversion_func) +@pytest.fixture +def address_reflector_contract( + w3, address_reflector_contract_instance, address_conversion_func +): + return deploy(w3, address_reflector_contract_instance, address_conversion_func) -CONTRACT_STRING_CODE = "0x6060604052604051610496380380610496833981016040528051018060006000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10608d57805160ff19168380011785555b50607c9291505b8082111560ba57838155600101606b565b5050506103d8806100be6000396000f35b828001600101855582156064579182015b828111156064578251826000505591602001919060010190609e565b509056606060405260e060020a600035046320965255811461003c57806330de3cee1461009f5780633fa4f245146100c457806393a0935214610121575b005b6101c7600060608181528154602060026001831615610100026000190190921691909104601f810182900490910260a0908101604052608082815292939190828280156102605780601f1061023557610100808354040283529160200191610260565b6101c7600060609081526101a06040526101006080818152906102d860a03990505b90565b6101c760008054602060026001831615610100026000190190921691909104601f810182900490910260809081016040526060828152929190828280156102975780601f1061026c57610100808354040283529160200191610297565b60206004803580820135601f81018490049093026080908101604052606084815261003a946024939192918401918190838280828437509496505050505050508060006000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061029f57805160ff19168380011785555b506102cf9291505b808211156102d4578381556001016101b4565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b820191906000526020600020905b81548152906001019060200180831161024357829003601f168201915b505050505090506100c1565b820191906000526020600020905b81548152906001019060200180831161027a57829003601f168201915b505050505081565b828001600101855582156101ac579182015b828111156101ac5782518260005055916020019190600101906102b1565b505050565b509056000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" # noqa: E501 -CONTRACT_STRING_RUNTIME = "0x606060405260e060020a600035046320965255811461003c57806330de3cee1461009f5780633fa4f245146100c457806393a0935214610121575b005b6101c7600060608181528154602060026001831615610100026000190190921691909104601f810182900490910260a0908101604052608082815292939190828280156102605780601f1061023557610100808354040283529160200191610260565b6101c7600060609081526101a06040526101006080818152906102d860a03990505b90565b6101c760008054602060026001831615610100026000190190921691909104601f810182900490910260809081016040526060828152929190828280156102975780601f1061026c57610100808354040283529160200191610297565b60206004803580820135601f81018490049093026080908101604052606084815261003a946024939192918401918190838280828437509496505050505050508060006000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061029f57805160ff19168380011785555b506102cf9291505b808211156102d4578381556001016101b4565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b820191906000526020600020905b81548152906001019060200180831161024357829003601f168201915b505050505090506100c1565b820191906000526020600020905b81548152906001019060200180831161027a57829003601f168201915b505050505081565b828001600101855582156101ac579182015b828111156101ac5782518260005055916020019190600101906102b1565b505050565b509056000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" # noqa: E501 -CONTRACT_STRING_ABI = json.loads( - '[{"constant":false,"inputs":[],"name":"getValue","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[],"name":"constValue","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":true,"inputs":[],"name":"value","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"string"}],"name":"setValue","outputs":[],"type":"function"},{"inputs":[{"name":"_value","type":"string"}],"type":"constructor"}]' # noqa: E501 +STRING_CONTRACT_BYTECODE = "0x60806040526040518060400160405280600a81526020017f6e65766572207573656400000000000000000000000000000000000000000000815250600090816200004a919062000311565b503480156200005857600080fd5b5060405162000cf438038062000cf483398181016040528101906200007e91906200055c565b80600190816200008f919062000311565b5050620005ad565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200011957607f821691505b6020821081036200012f576200012e620000d1565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200015a565b620001a586836200015a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001f2620001ec620001e684620001bd565b620001c7565b620001bd565b9050919050565b6000819050919050565b6200020e83620001d1565b620002266200021d82620001f9565b84845462000167565b825550505050565b600090565b6200023d6200022e565b6200024a81848462000203565b505050565b5b8181101562000272576200026660008262000233565b60018101905062000250565b5050565b601f821115620002c1576200028b8162000135565b62000296846200014a565b81016020851015620002a6578190505b620002be620002b5856200014a565b8301826200024f565b50505b505050565b600082821c905092915050565b6000620002e660001984600802620002c6565b1980831691505092915050565b6000620003018383620002d3565b9150826002028217905092915050565b6200031c8262000097565b67ffffffffffffffff811115620003385762000337620000a2565b5b62000344825462000100565b6200035182828562000276565b600060209050601f83116001811462000389576000841562000374578287015190505b620003808582620002f3565b865550620003f0565b601f198416620003998662000135565b60005b82811015620003c3578489015182556001820191506020850194506020810190506200039c565b86831015620003e35784890151620003df601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b620004328262000416565b810181811067ffffffffffffffff82111715620004545762000453620000a2565b5b80604052505050565b600062000469620003f8565b905062000477828262000427565b919050565b600067ffffffffffffffff8211156200049a5762000499620000a2565b5b620004a58262000416565b9050602081019050919050565b60005b83811015620004d2578082015181840152602081019050620004b5565b60008484015250505050565b6000620004f5620004ef846200047c565b6200045d565b90508281526020810184848401111562000514576200051362000411565b5b62000521848285620004b2565b509392505050565b600082601f8301126200054157620005406200040c565b5b815162000553848260208601620004de565b91505092915050565b60006020828403121562000575576200057462000402565b5b600082015167ffffffffffffffff81111562000596576200059562000407565b5b620005a48482850162000529565b91505092915050565b61073780620005bd6000396000f3fe6080604052600436106100345760003560e01c8063209652551461003957806330de3cee1461005757806393a0935214610075575b600080fd5b61004161009e565b60405161004e9190610265565b60405180910390f35b61005f610130565b60405161006c9190610265565b60405180910390f35b34801561008157600080fd5b5061009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea264697066735822122070af6b54814b3ca66e79200ccc07de707e984422ec598e78cbbd7ed6f8671feb64736f6c63430008110033" # noqa: E501 +STRING_CONTRACT_RUNTIME = "0x6080604052600436106100345760003560e01c8063209652551461003957806330de3cee1461005757806393a0935214610075575b600080fd5b61004161009e565b60405161004e9190610265565b60405180910390f35b61005f610130565b60405161006c9190610265565b60405180910390f35b34801561008157600080fd5b5061009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea264697066735822122070af6b54814b3ca66e79200ccc07de707e984422ec598e78cbbd7ed6f8671feb64736f6c63430008110033" # noqa: E501 +STRING_CONTRACT_ABI = json.loads( + '[{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"constValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"name":"setValue","outputs":[],"stateMutability":"nonpayable","type":"function"}]' # noqa: E501 ) -@pytest.fixture() -def STRING_CODE(): - return CONTRACT_STRING_CODE +@pytest.fixture +def string_contract_bytecode(): + return STRING_CONTRACT_BYTECODE -@pytest.fixture() -def STRING_RUNTIME(): - return CONTRACT_STRING_RUNTIME +@pytest.fixture +def string_contract_runtime(): + return STRING_CONTRACT_RUNTIME -@pytest.fixture() -def STRING_ABI(): - return CONTRACT_STRING_ABI +@pytest.fixture +def string_contract_abi(): + return STRING_CONTRACT_ABI -@pytest.fixture() -def STRING_CONTRACT(STRING_CODE, STRING_RUNTIME, STRING_ABI): +@pytest.fixture +def string_contract_kwargs( + string_contract_bytecode, string_contract_runtime, string_contract_abi +): return { - "bytecode": STRING_CODE, - "bytecode_runtime": STRING_RUNTIME, - "abi": STRING_ABI, + "bytecode": string_contract_bytecode, + "bytecode_runtime": string_contract_runtime, + "abi": string_contract_abi, } -@pytest.fixture() -def StringContract(w3, STRING_CONTRACT): - return w3.eth.contract(**STRING_CONTRACT) +@pytest.fixture +def string_contract_instance(w3, string_contract_kwargs): + return w3.eth.contract(**string_contract_kwargs) -@pytest.fixture() -def string_contract(w3, StringContract, address_conversion_func): - return deploy(w3, StringContract, address_conversion_func, args=["Caqalai"]) +@pytest.fixture +def string_contract(w3, string_contract_instance, address_conversion_func): + return deploy( + w3, string_contract_instance, address_conversion_func, args=["Caqalai"] + ) @pytest.fixture def non_strict_string_contract( - w3_non_strict_abi, STRING_CONTRACT, address_conversion_func + w3_non_strict_abi, string_contract_kwargs, address_conversion_func ): - _non_strict_string_contract = w3_non_strict_abi.eth.contract(**STRING_CONTRACT) + _non_strict_string_contract = w3_non_strict_abi.eth.contract( + **string_contract_kwargs + ) return deploy( w3_non_strict_abi, _non_strict_string_contract, @@ -391,125 +412,105 @@ def non_strict_string_contract( ) -CONTRACT_BYTES_CODE = "60606040526040805190810160405280600281526020017f01230000000000000000000000000000000000000000000000000000000000008152506000908051906020019061004f929190610096565b50341561005b57600080fd5b604051610723380380610723833981016040528080518201919050505b806001908051906020019061008e929190610116565b505b506101bb565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100d757805160ff1916838001178555610105565b82800160010185558215610105579182015b828111156101045782518255916020019190600101906100e9565b5b5090506101129190610196565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061015757805160ff1916838001178555610185565b82800160010185558215610185579182015b82811115610184578251825591602001919060010190610169565b5b5090506101929190610196565b5090565b6101b891905b808211156101b457600081600090555060010161019c565b5090565b90565b610559806101ca6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063209652551461005f57806330de3cee146100ee5780633fa4f2451461017d578063439970aa1461020c575b600080fd5b341561006a57600080fd5b610072610269565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100b35780820151818401525b602081019050610097565b50505050905090810190601f1680156100e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156100f957600080fd5b610101610312565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101425780820151818401525b602081019050610126565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018857600080fd5b6101906103bb565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101d15780820151818401525b6020810190506101b5565b50505050905090810190601f1680156101fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021757600080fd5b610267600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610459565b005b610271610474565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103075780601f106102dc57610100808354040283529160200191610307565b820191906000526020600020905b8154815290600101906020018083116102ea57829003601f168201915b505050505090505b90565b61031a610474565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103b05780601f10610385576101008083540402835291602001916103b0565b820191906000526020600020905b81548152906001019060200180831161039357829003601f168201915b505050505090505b90565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104515780601f1061042657610100808354040283529160200191610451565b820191906000526020600020905b81548152906001019060200180831161043457829003601f168201915b505050505081565b806001908051906020019061046f929190610488565b505b50565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104c957805160ff19168380011785556104f7565b828001600101855582156104f7579182015b828111156104f65782518255916020019190600101906104db565b5b5090506105049190610508565b5090565b61052a91905b8082111561052657600081600090555060010161050e565b5090565b905600a165627a7a723058203ff916ee91add6247b20793745d1c6a8d8dcaa49d8c84fbbabb5c966fd9b6fc90029" # noqa: E501 -CONTRACT_BYTES_RUNTIME = "60606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063209652551461005f57806330de3cee146100ee5780633fa4f2451461017d578063439970aa1461020c575b600080fd5b341561006a57600080fd5b610072610269565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100b35780820151818401525b602081019050610097565b50505050905090810190601f1680156100e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156100f957600080fd5b610101610312565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101425780820151818401525b602081019050610126565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018857600080fd5b6101906103bb565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101d15780820151818401525b6020810190506101b5565b50505050905090810190601f1680156101fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021757600080fd5b610267600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610459565b005b610271610474565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103075780601f106102dc57610100808354040283529160200191610307565b820191906000526020600020905b8154815290600101906020018083116102ea57829003601f168201915b505050505090505b90565b61031a610474565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103b05780601f10610385576101008083540402835291602001916103b0565b820191906000526020600020905b81548152906001019060200180831161039357829003601f168201915b505050505090505b90565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104515780601f1061042657610100808354040283529160200191610451565b820191906000526020600020905b81548152906001019060200180831161043457829003601f168201915b505050505081565b806001908051906020019061046f929190610488565b505b50565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104c957805160ff19168380011785556104f7565b828001600101855582156104f7579182015b828111156104f65782518255916020019190600101906104db565b5b5090506105049190610508565b5090565b61052a91905b8082111561052657600081600090555060010161050e565b5090565b905600a165627a7a723058203ff916ee91add6247b20793745d1c6a8d8dcaa49d8c84fbbabb5c966fd9b6fc90029" # noqa: E501 -CONTRACT_BYTES_ABI = json.loads( +BYTES_CONTRACT_BYTECODE = "0x60806040526040518060400160405280600281526020017f0123000000000000000000000000000000000000000000000000000000000000815250600090816200004a919062000311565b503480156200005857600080fd5b5060405162000de638038062000de683398181016040528101906200007e91906200055c565b80600190816200008f9190620005b8565b50506200069f565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200011957607f821691505b6020821081036200012f576200012e620000d1565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200015a565b620001a586836200015a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001f2620001ec620001e684620001bd565b620001c7565b620001bd565b9050919050565b6000819050919050565b6200020e83620001d1565b620002266200021d82620001f9565b84845462000167565b825550505050565b600090565b6200023d6200022e565b6200024a81848462000203565b505050565b5b8181101562000272576200026660008262000233565b60018101905062000250565b5050565b601f821115620002c1576200028b8162000135565b62000296846200014a565b81016020851015620002a6578190505b620002be620002b5856200014a565b8301826200024f565b50505b505050565b600082821c905092915050565b6000620002e660001984600802620002c6565b1980831691505092915050565b6000620003018383620002d3565b9150826002028217905092915050565b6200031c8262000097565b67ffffffffffffffff811115620003385762000337620000a2565b5b62000344825462000100565b6200035182828562000276565b600060209050601f83116001811462000389576000841562000374578287015190505b620003808582620002f3565b865550620003f0565b601f198416620003998662000135565b60005b82811015620003c3578489015182556001820191506020850194506020810190506200039c565b86831015620003e35784890151620003df601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b620004328262000416565b810181811067ffffffffffffffff82111715620004545762000453620000a2565b5b80604052505050565b600062000469620003f8565b905062000477828262000427565b919050565b600067ffffffffffffffff8211156200049a5762000499620000a2565b5b620004a58262000416565b9050602081019050919050565b60005b83811015620004d2578082015181840152602081019050620004b5565b60008484015250505050565b6000620004f5620004ef846200047c565b6200045d565b90508281526020810184848401111562000514576200051362000411565b5b62000521848285620004b2565b509392505050565b600082601f8301126200054157620005406200040c565b5b815162000553848260208601620004de565b91505092915050565b60006020828403121562000575576200057462000402565b5b600082015167ffffffffffffffff81111562000596576200059562000407565b5b620005a48482850162000529565b91505092915050565b600081519050919050565b620005c382620005ad565b67ffffffffffffffff811115620005df57620005de620000a2565b5b620005eb825462000100565b620005f882828562000276565b600060209050601f8311600181146200063057600084156200061b578287015190505b620006278582620002f3565b86555062000697565b601f198416620006408662000135565b60005b828110156200066a5784890151825560018201915060208501945060208101905062000643565b868310156200068a578489015162000686601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b61073780620006af6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee14610064578063439970aa14610082575b600080fd5b61004e61009e565b60405161005b9190610265565b60405180910390f35b61006c610130565b6040516100799190610265565b60405180910390f35b61009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea26469706673582212203089c3295f7cbf7e1f4073f7b19fedf977da326a3f69bd7a15d0e7d097933bc764736f6c63430008110033" # noqa: E501 +BYTES_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee14610064578063439970aa14610082575b600080fd5b61004e61009e565b60405161005b9190610265565b60405180910390f35b61006c610130565b6040516100799190610265565b60405180910390f35b61009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea26469706673582212203089c3295f7cbf7e1f4073f7b19fedf977da326a3f69bd7a15d0e7d097933bc764736f6c63430008110033" # noqa: E501 +BYTES_CONTRACT_ABI = json.loads( '[{"constant":false,"inputs":[],"name":"getValue","outputs":[{"name":"","type":"bytes"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"constValue","outputs":[{"name":"","type":"bytes"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"value","outputs":[{"name":"","type":"bytes"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"bytes"}],"name":"setValue","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_value","type":"bytes"}],"payable":false,"type":"constructor"}]' # noqa: E501 ) -@pytest.fixture() -def BYTES_CODE(): - return CONTRACT_BYTES_CODE - - -@pytest.fixture() -def BYTES_RUNTIME(): - return CONTRACT_BYTES_RUNTIME - - -@pytest.fixture() -def BYTES_ABI(): - return CONTRACT_BYTES_ABI - - -@pytest.fixture() -def BYTES_CONTRACT(BYTES_CODE, BYTES_RUNTIME, BYTES_ABI): +@pytest.fixture +def bytes_contract_kwargs(): return { - "bytecode": BYTES_CODE, - "bytecode_runtime": BYTES_RUNTIME, - "abi": BYTES_ABI, + "bytecode": BYTES_CONTRACT_BYTECODE, + "bytecode_runtime": BYTES_CONTRACT_RUNTIME, + "abi": BYTES_CONTRACT_ABI, } -@pytest.fixture() -def BytesContract(w3, BYTES_CONTRACT): - return w3.eth.contract(**BYTES_CONTRACT) +@pytest.fixture +def bytes_contract(w3, bytes_contract_kwargs): + return w3.eth.contract(**bytes_contract_kwargs) -@pytest.fixture() -def NonStrictBytesContract(w3_non_strict_abi, BYTES_CONTRACT): - return w3_non_strict_abi.eth.contract(**BYTES_CONTRACT) +@pytest.fixture +def non_strict_bytes_contract(w3_non_strict_abi, bytes_contract_kwargs): + return w3_non_strict_abi.eth.contract(**bytes_contract_kwargs) -CONTRACT_BYTES32_CODE = "60606040527f0123012301230123012301230123012301230123012301230123012301230123600090600019169055341561003957600080fd5b6040516020806101e2833981016040528080519060200190919050505b80600181600019169055505b505b61016f806100736000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063209652551461005f57806330de3cee146100905780633fa4f245146100c157806358825b10146100f2575b600080fd5b341561006a57600080fd5b610072610119565b60405180826000191660001916815260200191505060405180910390f35b341561009b57600080fd5b6100a3610124565b60405180826000191660001916815260200191505060405180910390f35b34156100cc57600080fd5b6100d461012e565b60405180826000191660001916815260200191505060405180910390f35b34156100fd57600080fd5b610117600480803560001916906020019091905050610134565b005b600060015490505b90565b6000805490505b90565b60015481565b80600181600019169055505b505600a165627a7a7230582043b15c20378b1603d330561258ccf291d08923a4c25fa8af0d590a010a6322180029" # noqa: E501 -CONTRACT_BYTES32_RUNTIME = "60606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063209652551461005f57806330de3cee146100905780633fa4f245146100c157806358825b10146100f2575b600080fd5b341561006a57600080fd5b610072610119565b60405180826000191660001916815260200191505060405180910390f35b341561009b57600080fd5b6100a3610124565b60405180826000191660001916815260200191505060405180910390f35b34156100cc57600080fd5b6100d461012e565b60405180826000191660001916815260200191505060405180910390f35b34156100fd57600080fd5b610117600480803560001916906020019091905050610134565b005b600060015490505b90565b6000805490505b90565b60015481565b80600181600019169055505b505600a165627a7a7230582043b15c20378b1603d330561258ccf291d08923a4c25fa8af0d590a010a6322180029" # noqa: E501 -CONTRACT_BYTES32_ABI = json.loads( - '[{"constant":false,"inputs":[],"name":"getValue","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"constValue","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"value","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"bytes32"}],"name":"setValue","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_value","type":"bytes32"}],"payable":false,"type":"constructor"}]' # noqa: E501 +BYTES32_CONTRACT_BYTECODE = "0x60806040527f012301230123012301230123012301230123012301230123012301230123012360005534801561003457600080fd5b5060405161025d38038061025d8339818101604052810190610056919061009e565b80600181905550506100cb565b600080fd5b6000819050919050565b61007b81610068565b811461008657600080fd5b50565b60008151905061009881610072565b92915050565b6000602082840312156100b4576100b3610063565b5b60006100c284828501610089565b91505092915050565b610183806100da6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee1461006457806358825b1014610082575b600080fd5b61004e61009e565b60405161005b91906100d4565b60405180910390f35b61006c6100a8565b60405161007991906100d4565b60405180910390f35b61009c60048036038101906100979190610120565b6100b1565b005b6000600154905090565b60008054905090565b8060018190555050565b6000819050919050565b6100ce816100bb565b82525050565b60006020820190506100e960008301846100c5565b92915050565b600080fd5b6100fd816100bb565b811461010857600080fd5b50565b60008135905061011a816100f4565b92915050565b600060208284031215610136576101356100ef565b5b60006101448482850161010b565b9150509291505056fea2646970667358221220b8267f64119f7a63eb9c2eeae86bf981b7fcbeaa0c0797ff7d7cc51b21cf8d5464736f6c63430008110033" # noqa: E501 +BYTES32_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee1461006457806358825b1014610082575b600080fd5b61004e61009e565b60405161005b91906100d4565b60405180910390f35b61006c6100a8565b60405161007991906100d4565b60405180910390f35b61009c60048036038101906100979190610120565b6100b1565b005b6000600154905090565b60008054905090565b8060018190555050565b6000819050919050565b6100ce816100bb565b82525050565b60006020820190506100e960008301846100c5565b92915050565b600080fd5b6100fd816100bb565b811461010857600080fd5b50565b60008135905061011a816100f4565b92915050565b600060208284031215610136576101356100ef565b5b60006101448482850161010b565b9150509291505056fea2646970667358221220b8267f64119f7a63eb9c2eeae86bf981b7fcbeaa0c0797ff7d7cc51b21cf8d5464736f6c63430008110033" # noqa: E501 +BYTES32_CONTRACT_ABI = json.loads( + '[{"inputs":[{"internalType":"bytes32","name":"_value","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"constValue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getValue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_value","type":"bytes32"}],"name":"setValue","outputs":[],"stateMutability":"nonpayable","type":"function"}]' # noqa: E501 ) -@pytest.fixture() -def BYTES32_CODE(): - return CONTRACT_BYTES32_CODE +@pytest.fixture +def bytes32_contract_bytecode(): + return BYTES32_CONTRACT_BYTECODE -@pytest.fixture() -def BYTES32_RUNTIME(): - return CONTRACT_BYTES32_RUNTIME +@pytest.fixture +def bytes32_contract_runtime(): + return BYTES32_CONTRACT_RUNTIME -@pytest.fixture() -def BYTES32_ABI(): - return CONTRACT_BYTES32_ABI +@pytest.fixture +def bytes32_contract_abi(): + return BYTES32_CONTRACT_ABI -@pytest.fixture() -def BYTES32_CONTRACT(BYTES32_CODE, BYTES32_RUNTIME, BYTES32_ABI): +@pytest.fixture +def bytes32_contract_kwargs( + bytes32_contract_bytecode, bytes32_contract_runtime, bytes32_contract_abi +): return { - "bytecode": BYTES32_CODE, - "bytecode_runtime": BYTES32_RUNTIME, - "abi": BYTES32_ABI, + "bytecode": bytes32_contract_bytecode, + "bytecode_runtime": bytes32_contract_runtime, + "abi": bytes32_contract_abi, } -@pytest.fixture() -def Bytes32Contract(w3, BYTES32_CONTRACT): - return w3.eth.contract(**BYTES32_CONTRACT) +@pytest.fixture +def bytes32_contract(w3, bytes32_contract_kwargs): + return w3.eth.contract(**bytes32_contract_kwargs) -@pytest.fixture() -def EMITTER_CODE(): - return CONTRACT_EMITTER_CODE +@pytest.fixture +def emitter_contract_bytecode(): + return EMITTER_CONTRACT_BYTECODE -@pytest.fixture() -def EMITTER_RUNTIME(): - return CONTRACT_EMITTER_RUNTIME +@pytest.fixture +def emitter_contract_runtime(): + return EMITTER_CONTRACT_RUNTIME -@pytest.fixture() -def EMITTER_ABI(): - return CONTRACT_EMITTER_ABI +@pytest.fixture +def emitter_contract_abi(): + return EMITTER_CONTRACT_ABI @pytest.fixture() -def EMITTER(EMITTER_CODE, EMITTER_RUNTIME, EMITTER_ABI): - return { - "bytecode": EMITTER_CODE, - "bytecode_runtime": EMITTER_RUNTIME, - "abi": EMITTER_ABI, - } - - -@pytest.fixture -def NON_STRICT_EMITTER(EMITTER_CODE, EMITTER_RUNTIME, EMITTER_ABI): +def emitter_contract_kwargs( + emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi +): return { - "bytecode": EMITTER_CODE, - "bytecode_runtime": EMITTER_RUNTIME, - "abi": EMITTER_ABI, + "bytecode": emitter_contract_bytecode, + "bytecode_runtime": emitter_contract_runtime, + "abi": emitter_contract_abi, } @pytest.fixture -def NonStrictEmitter(w3_non_strict_abi, NON_STRICT_EMITTER): - return w3_non_strict_abi.eth.contract(**NON_STRICT_EMITTER) +def non_strict_emitter_contract_instance(w3_non_strict_abi, emitter_contract_kwargs): + return w3_non_strict_abi.eth.contract(**emitter_contract_kwargs) @pytest.fixture def non_strict_emitter( w3_non_strict_abi, - NonStrictEmitter, + non_strict_emitter_contract_instance, wait_for_transaction, wait_for_block, address_conversion_func, @@ -517,34 +518,21 @@ def non_strict_emitter( w3 = w3_non_strict_abi wait_for_block(w3) - deploy_txn_hash = NonStrictEmitter.constructor().transact({"gas": 10000000}) + deploy_txn_hash = non_strict_emitter_contract_instance.constructor().transact( + {"gas": 10000000} + ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == NonStrictEmitter.bytecode_runtime - emitter_contract = NonStrictEmitter(address=contract_address) + assert bytecode == non_strict_emitter_contract_instance.bytecode_runtime + emitter_contract = non_strict_emitter_contract_instance(address=contract_address) assert emitter_contract.address == contract_address return emitter_contract @pytest.fixture() -def EVENT_CONTRACT_CODE(): - return EVNT_CONTRACT_CODE - - -@pytest.fixture() -def EVENT_CONTRACT_RUNTIME(): - return EVNT_CONTRACT_RUNTIME - - -@pytest.fixture() -def EVENT_CONTRACT_ABI(): - return EVNT_CONTRACT_ABI - - -@pytest.fixture() -def EVENT_CONTRACT(EVENT_CONTRACT_CODE, EVENT_CONTRACT_RUNTIME, EVENT_CONTRACT_ABI): +def event_contract_kwargs(): return { "bytecode": EVENT_CONTRACT_CODE, "bytecode_runtime": EVENT_CONTRACT_RUNTIME, @@ -553,15 +541,15 @@ def EVENT_CONTRACT(EVENT_CONTRACT_CODE, EVENT_CONTRACT_RUNTIME, EVENT_CONTRACT_A @pytest.fixture() -def EventContract(w3_empty, EVENT_CONTRACT): +def event_contract_instance(w3_empty, event_contract_kwargs): w3 = w3_empty - return w3.eth.contract(**EVENT_CONTRACT) + return w3.eth.contract(**event_contract_kwargs) @pytest.fixture() def event_contract( w3_empty, - EventContract, + event_contract_instance, wait_for_transaction, wait_for_block, address_conversion_func, @@ -570,15 +558,15 @@ def event_contract( w3 = w3_empty wait_for_block(w3) - deploy_txn_hash = EventContract.constructor().transact( + deploy_txn_hash = event_contract_instance.constructor().transact( {"from": w3.eth.coinbase, "gas": 1000000} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == EventContract.bytecode_runtime - event_contract = EventContract(address=contract_address) + assert bytecode == event_contract_instance.bytecode_runtime + event_contract = event_contract_instance(address=contract_address) assert event_contract.address == contract_address return event_contract @@ -1170,9 +1158,13 @@ def AsyncTupleContract(async_w3, TUPLE_CONTRACT): @pytest.fixture() -def AsyncMathContract(async_w3, MATH_ABI, MATH_CODE, MATH_RUNTIME): +def AsyncMathContract( + async_w3, math_contract_abi, math_contract_bytecode, math_contract_runtime +): return async_w3.eth.contract( - abi=MATH_ABI, bytecode=MATH_CODE, bytecode_runtime=MATH_RUNTIME + abi=math_contract_abi, + bytecode=math_contract_bytecode, + bytecode_runtime=math_contract_runtime, ) @@ -1184,56 +1176,56 @@ async def async_math_contract(async_w3, AsyncMathContract, address_conversion_fu @pytest.fixture() def AsyncSimpleConstructorContract( async_w3, - SIMPLE_CONSTRUCTOR_CODE, - SIMPLE_CONSTRUCTOR_RUNTIME, - SIMPLE_CONSTRUCTOR_ABI, + simple_constructor_contract_bytecode, + simple_constructor_contract_runtime, + simple_constructor_contract_abi, ): return async_w3.eth.contract( - abi=SIMPLE_CONSTRUCTOR_ABI, - bytecode=SIMPLE_CONSTRUCTOR_CODE, - bytecode_runtime=SIMPLE_CONSTRUCTOR_RUNTIME, + abi=simple_constructor_contract_abi, + bytecode=simple_constructor_contract_bytecode, + bytecode_runtime=simple_constructor_contract_runtime, ) @pytest.fixture() def AsyncWithConstructorArgumentsContract( async_w3, - WITH_CONSTRUCTOR_ARGUMENTS_CODE, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, - WITH_CONSTRUCTOR_ARGUMENTS_ABI, + contract_with_constructor_args_bytecode, + contract_with_constructor_args_runtime, + contract_with_constructor_args_abi, ): return async_w3.eth.contract( - abi=WITH_CONSTRUCTOR_ARGUMENTS_ABI, - bytecode=WITH_CONSTRUCTOR_ARGUMENTS_CODE, - bytecode_runtime=WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + abi=contract_with_constructor_args_abi, + bytecode=contract_with_constructor_args_bytecode, + bytecode_runtime=contract_with_constructor_args_runtime, ) @pytest.fixture() def AsyncNonStrictWithConstructorArgumentsContract( async_w3_non_strict_abi, - WITH_CONSTRUCTOR_ARGUMENTS_CODE, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, - WITH_CONSTRUCTOR_ARGUMENTS_ABI, + contract_with_constructor_args_bytecode, + contract_with_constructor_args_runtime, + contract_with_constructor_args_abi, ): return async_w3_non_strict_abi.eth.contract( - abi=WITH_CONSTRUCTOR_ARGUMENTS_ABI, - bytecode=WITH_CONSTRUCTOR_ARGUMENTS_CODE, - bytecode_runtime=WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + abi=contract_with_constructor_args_abi, + bytecode=contract_with_constructor_args_bytecode, + bytecode_runtime=contract_with_constructor_args_runtime, ) @pytest.fixture() def AsyncWithConstructorAddressArgumentsContract( async_w3, - WITH_CONSTRUCTOR_ADDRESS_CODE, - WITH_CONSTRUCTOR_ADDRESS_RUNTIME, - WITH_CONSTRUCTOR_ADDRESS_ABI, + contract_with_constructor_address_bytecode, + contract_with_constructor_address_runtime, + contract_with_constructor_address_abi, ): return async_w3.eth.contract( - abi=WITH_CONSTRUCTOR_ADDRESS_ABI, - bytecode=WITH_CONSTRUCTOR_ADDRESS_CODE, - bytecode_runtime=WITH_CONSTRUCTOR_ADDRESS_RUNTIME, + abi=contract_with_constructor_address_abi, + bytecode=contract_with_constructor_address_bytecode, + bytecode_runtime=contract_with_constructor_address_runtime, ) @@ -1252,9 +1244,9 @@ async def async_address_contract( @pytest.fixture() def AsyncAddressReflectorContract(async_w3): return async_w3.eth.contract( - abi=CONTRACT_ADDRESS_REFLECTOR_ABI, - bytecode=CONTRACT_ADDRESS_REFLECTOR_CODE, - bytecode_runtime=CONTRACT_ADDRESS_REFLECTOR_RUNTIME, + abi=ADDRESS_REFLECTOR_CONTRACT_ABI, + bytecode=ADDRESS_REFLECTOR_CONTRACT_BYTECODE, + bytecode_runtime=ADDRESS_REFLECTOR_CONTRACT_RUNTIME, ) @@ -1268,8 +1260,8 @@ async def async_address_reflector_contract( @pytest.fixture() -def AsyncStringContract(async_w3, STRING_CONTRACT): - return async_w3.eth.contract(**STRING_CONTRACT) +def AsyncStringContract(async_w3, string_contract_kwargs): + return async_w3.eth.contract(**string_contract_kwargs) @pytest_asyncio.fixture() @@ -1280,18 +1272,18 @@ async def async_string_contract(async_w3, AsyncStringContract, address_conversio @pytest.fixture() -def AsyncBytesContract(async_w3, BYTES_CONTRACT): - return async_w3.eth.contract(**BYTES_CONTRACT) +def AsyncBytesContract(async_w3, bytes_contract_kwargs): + return async_w3.eth.contract(**bytes_contract_kwargs) @pytest.fixture() -def AsyncNonStrictBytesContract(async_w3_non_strict_abi, BYTES_CONTRACT): - return async_w3_non_strict_abi.eth.contract(**BYTES_CONTRACT) +def AsyncNonStrictBytesContract(async_w3_non_strict_abi, bytes_contract_kwargs): + return async_w3_non_strict_abi.eth.contract(**bytes_contract_kwargs) @pytest.fixture() -def AsyncBytes32Contract(async_w3, BYTES32_CONTRACT): - return async_w3.eth.contract(**BYTES32_CONTRACT) +def AsyncBytes32Contract(async_w3, bytes32_contract_kwargs): + return async_w3.eth.contract(**bytes32_contract_kwargs) @pytest.fixture() diff --git a/tests/core/contracts/test_contract_ambiguous_functions.py b/tests/core/contracts/test_contract_ambiguous_functions.py index 9508e6c9fe..ffb474b5ef 100644 --- a/tests/core/contracts/test_contract_ambiguous_functions.py +++ b/tests/core/contracts/test_contract_ambiguous_functions.py @@ -46,12 +46,12 @@ @pytest.fixture() -def string_contract(w3, StringContract, address_conversion_func): - deploy_txn = StringContract.constructor("Caqalai").transact() +def string_contract(w3, string_contract_instance, address_conversion_func): + deploy_txn = string_contract_instance.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None contract_address = address_conversion_func(deploy_receipt["contractAddress"]) - contract = StringContract(address=contract_address) + contract = string_contract_instance(address=contract_address) assert contract.address == contract_address assert len(w3.eth.get_code(contract.address)) > 0 return contract diff --git a/tests/core/contracts/test_contract_build_transaction.py b/tests/core/contracts/test_contract_build_transaction.py index 3d05e59894..2d6390044b 100644 --- a/tests/core/contracts/test_contract_build_transaction.py +++ b/tests/core/contracts/test_contract_build_transaction.py @@ -39,10 +39,12 @@ def test_build_transaction_paying_to_nonpayable_function( def test_build_transaction_with_contract_no_arguments( w3, math_contract, build_transaction ): - txn = build_transaction(contract=math_contract, contract_function="increment") + txn = build_transaction( + contract=math_contract, contract_function="incrementCounter" + ) assert dissoc(txn, "gas") == { "to": math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 10**9, @@ -65,16 +67,16 @@ def test_build_transaction_with_contract_fallback_function( def test_build_transaction_with_contract_class_method( - w3, MathContract, math_contract, build_transaction + w3, math_contract_instance, math_contract, build_transaction ): txn = build_transaction( - contract=MathContract, - contract_function="increment", + contract=math_contract_instance, + contract_function="incrementCounter", tx_params={"to": math_contract.address}, ) assert dissoc(txn, "gas") == { "to": math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 10**9, @@ -85,10 +87,12 @@ def test_build_transaction_with_contract_class_method( def test_build_transaction_with_contract_default_account_is_set( w3, math_contract, build_transaction ): - txn = build_transaction(contract=math_contract, contract_function="increment") + txn = build_transaction( + contract=math_contract, contract_function="incrementCounter" + ) assert dissoc(txn, "gas") == { "to": math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 10**9, @@ -103,10 +107,12 @@ def my_gas_price_strategy(w3, transaction_params): return 5 w3.eth.set_gas_price_strategy(my_gas_price_strategy) - txn = build_transaction(contract=math_contract, contract_function="increment") + txn = build_transaction( + contract=math_contract, contract_function="incrementCounter" + ) assert dissoc(txn, "gas") == { "to": math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "gasPrice": 5, "chainId": 131277322940537, @@ -119,7 +125,7 @@ def test_build_transaction_with_contract_data_supplied_errors( with pytest.raises(ValueError): build_transaction( contract=math_contract, - contract_function="increment", + contract_function="incrementCounter", tx_params={"data": "0x000"}, ) @@ -130,7 +136,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( with pytest.raises(ValueError): build_transaction( contract=math_contract, - contract_function="increment", + contract_function="incrementCounter", tx_params={"to": "0xb2930B35844a230f00E51431aCAe96Fe543a0347"}, ) @@ -143,7 +149,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -156,7 +162,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -169,7 +175,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "gasPrice": 22**8, "chainId": 131277322940537, @@ -181,7 +187,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 22**8, "maxPriorityFeePerGas": 22**8, @@ -194,7 +200,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -208,7 +214,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 20000, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -226,7 +232,7 @@ def test_build_transaction_with_contract_to_address_supplied_errors( "With Value", ], ) -def test_build_transaction_with_contract_with_arguments( +def test_build_transaction_with_contract_arguments( w3, skip_if_testrpc, math_contract, @@ -242,7 +248,7 @@ def test_build_transaction_with_contract_with_arguments( txn = build_transaction( contract=math_contract, - contract_function="increment", + contract_function="incrementCounter", func_args=method_args, func_kwargs=method_kwargs, tx_params=transaction_args, @@ -290,11 +296,11 @@ async def test_async_build_transaction_with_contract_no_arguments( async_w3, async_math_contract, async_build_transaction ): txn = await async_build_transaction( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) assert dissoc(txn, "gas") == { "to": async_math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 10**9, @@ -323,12 +329,12 @@ async def test_async_build_transaction_with_contract_class_method( ): txn = await async_build_transaction( contract=AsyncMathContract, - contract_function="increment", + contract_function="incrementCounter", tx_params={"to": async_math_contract.address}, ) assert dissoc(txn, "gas") == { "to": async_math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 10**9, @@ -341,11 +347,11 @@ async def test_async_build_transaction_with_contract_default_account_is_set( async_w3, async_math_contract, async_build_transaction ): txn = await async_build_transaction( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) assert dissoc(txn, "gas") == { "to": async_math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 10**9, @@ -362,11 +368,11 @@ def my_gas_price_strategy(async_w3, transaction_params): async_w3.eth.set_gas_price_strategy(my_gas_price_strategy) txn = await async_build_transaction( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) assert dissoc(txn, "gas") == { "to": async_math_contract.address, - "data": "0xd09de08a", + "data": "0x5b34b966", "value": 0, "gasPrice": 5, "chainId": 131277322940537, @@ -380,7 +386,7 @@ async def test_async_build_transaction_with_contract_data_supplied_errors( with pytest.raises(ValueError): await async_build_transaction( contract=async_math_contract, - contract_function="increment", + contract_function="incrementCounter", tx_params={"data": "0x000"}, ) @@ -392,7 +398,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( with pytest.raises(ValueError): await async_build_transaction( contract=async_math_contract, - contract_function="increment", + contract_function="incrementCounter", tx_params={"to": "0xb2930B35844a230f00E51431aCAe96Fe543a0347"}, ) # noqa: E501 @@ -406,7 +412,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -419,7 +425,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -432,7 +438,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "gasPrice": 22**8, "chainId": 131277322940537, @@ -444,7 +450,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 22**8, "maxPriorityFeePerGas": 22**8, @@ -457,7 +463,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 0, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -471,7 +477,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( (5,), {}, { - "data": "0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 + "data": "0x6abbb3b40000000000000000000000000000000000000000000000000000000000000005", # noqa: E501 "value": 20000, "maxFeePerGas": 2750000000, "maxPriorityFeePerGas": 1000000000, @@ -505,7 +511,7 @@ async def test_async_build_transaction_with_contract_with_arguments( txn = await async_build_transaction( contract=async_math_contract, - contract_function="increment", + contract_function="incrementCounter", func_args=method_args, func_kwargs=method_kwargs, tx_params=transaction_args, diff --git a/tests/core/contracts/test_contract_call_interface.py b/tests/core/contracts/test_contract_call_interface.py index fb22f482cf..2fdac82a3e 100644 --- a/tests/core/contracts/test_contract_call_interface.py +++ b/tests/core/contracts/test_contract_call_interface.py @@ -41,17 +41,17 @@ @pytest.fixture(params=[b"\x04\x06", "0x0406"]) -def bytes_contract(w3, BytesContract, request, address_conversion_func): - return deploy(w3, BytesContract, address_conversion_func, args=[request.param]) +def bytes_contract(w3, bytes_contract, request, address_conversion_func): + return deploy(w3, bytes_contract, address_conversion_func, args=[request.param]) @pytest.fixture(params=[b"\x04\x06", "0x0406"]) def non_strict_bytes_contract( - w3_non_strict_abi, NonStrictBytesContract, request, address_conversion_func + w3_non_strict_abi, non_strict_bytes_contract, request, address_conversion_func ): return deploy( w3_non_strict_abi, - NonStrictBytesContract, + non_strict_bytes_contract, address_conversion_func, args=[request.param], ) @@ -73,26 +73,28 @@ def call_transaction(): HexBytes("0406040604060406040604060406040604060406040604060406040604060406"), ] ) -def bytes32_contract(w3, Bytes32Contract, request, address_conversion_func): - return deploy(w3, Bytes32Contract, address_conversion_func, args=[request.param]) +def bytes32_contract(w3, bytes32_contract, request, address_conversion_func): + return deploy(w3, bytes32_contract, address_conversion_func, args=[request.param]) @pytest.fixture() -def undeployed_math_contract(MathContract, address_conversion_func): +def undeployed_math_contract(math_contract_instance, address_conversion_func): empty_address = address_conversion_func( "0x000000000000000000000000000000000000dEaD" ) - _undeployed_math_contract = MathContract(address=empty_address) + _undeployed_math_contract = math_contract_instance(address=empty_address) return _undeployed_math_contract @pytest.fixture() -def mismatched_math_contract(w3, StringContract, MathContract, address_conversion_func): - deploy_txn = StringContract.constructor("Caqalai").transact() +def mismatched_math_contract( + w3, string_contract_instance, math_contract_instance, address_conversion_func +): + deploy_txn = string_contract_instance.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = address_conversion_func(deploy_receipt["contractAddress"]) - _mismatched_math_contract = MathContract(address=address) + _mismatched_math_contract = math_contract_instance(address=address) return _mismatched_math_contract @@ -107,20 +109,20 @@ def nested_tuple_contract(w3, NestedTupleContract, address_conversion_func): def test_deploy_raises_due_to_strict_byte_checking_by_default( - w3, Bytes32Contract, address_conversion_func + w3, bytes32_contract, address_conversion_func ): with pytest.raises(TypeError): deploy( w3, - Bytes32Contract, + bytes32_contract, address_conversion_func, args=["0406040604060406040604060406040604060406040604060406040604060406"], ) -def test_invalid_address_in_deploy_arg(WithConstructorAddressArgumentsContract): +def test_invalid_address_in_deploy_arg(contract_with_constructor_address_instance): with pytest.raises(InvalidAddress): - WithConstructorAddressArgumentsContract.constructor( + contract_with_constructor_address_instance.constructor( "0xd3cda913deb6f67967b99d67acdfa1712c293601", ).transact() @@ -275,19 +277,21 @@ def test_call_get_byte_const_array_non_strict(non_strict_arrays_contract, call): assert result == expected_byte_arr -def test_call_read_address_variable(address_contract, call): - result = call(contract=address_contract, contract_function="testAddr") +def test_call_read_address_variable(contract_with_constructor_address, call): + result = call( + contract=contract_with_constructor_address, contract_function="testAddr" + ) assert result == "0xd3CdA913deB6f67967B99D67aCDFa1712C293601" -def test_init_with_ens_name_arg(w3, WithConstructorAddressArgumentsContract, call): +def test_init_with_ens_name_arg(w3, contract_with_constructor_address_instance, call): with contract_ens_addresses( - WithConstructorAddressArgumentsContract, + contract_with_constructor_address_instance, [("arg-name.eth", "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413")], ): address_contract = deploy( w3, - WithConstructorAddressArgumentsContract, + contract_with_constructor_address_instance, args=[ "arg-name.eth", ], @@ -520,7 +524,7 @@ def test_throws_error_if_block_out_of_range(w3, math_contract): def test_accepts_latest_block(w3, math_contract): w3.provider.make_request(method="evm_mine", params=[5]) - math_contract.functions.increment().transact() + math_contract.functions.incrementCounter().transact() late = math_contract.functions.counter().call(block_identifier="latest") pend = math_contract.functions.counter().call(block_identifier="pending") @@ -531,7 +535,7 @@ def test_accepts_latest_block(w3, math_contract): def test_accepts_block_hash_as_identifier(w3, math_contract): blocks = w3.provider.make_request(method="evm_mine", params=[5]) - math_contract.functions.increment().transact() + math_contract.functions.incrementCounter().transact() more_blocks = w3.provider.make_request(method="evm_mine", params=[5]) old = math_contract.functions.counter().call(block_identifier=blocks["result"][2]) @@ -545,8 +549,8 @@ def test_accepts_block_hash_as_identifier(w3, math_contract): def test_neg_block_indexes_from_the_end(w3, math_contract): w3.provider.make_request(method="evm_mine", params=[5]) - math_contract.functions.increment().transact() - math_contract.functions.increment().transact() + math_contract.functions.incrementCounter().transact() + math_contract.functions.incrementCounter().transact() w3.provider.make_request(method="evm_mine", params=[5]) output1 = math_contract.functions.counter().call(block_identifier=-7) @@ -559,8 +563,8 @@ def test_neg_block_indexes_from_the_end(w3, math_contract): def test_returns_data_from_specified_block(w3, math_contract): start_num = w3.eth.get_block("latest").number w3.provider.make_request(method="evm_mine", params=[5]) - math_contract.functions.increment().transact() - math_contract.functions.increment().transact() + math_contract.functions.incrementCounter().transact() + math_contract.functions.incrementCounter().transact() output1 = math_contract.functions.counter().call(block_identifier=start_num + 6) output2 = math_contract.functions.counter().call(block_identifier=start_num + 7) @@ -974,7 +978,7 @@ def test_changing_default_block_identifier(w3, math_contract): assert math_contract.caller.counter() == 0 assert w3.eth.default_block == "latest" - math_contract.functions.increment(7).transact() + math_contract.functions.incrementCounter(7).transact() assert math_contract.caller.counter() == 7 assert math_contract.functions.counter().call(block_identifier=1) == 0 @@ -1540,7 +1544,7 @@ async def test_async_throws_error_if_block_out_of_range(async_w3, async_math_con @pytest.mark.asyncio async def test_async_accepts_latest_block(async_w3, async_math_contract): await async_w3.provider.make_request(method="evm_mine", params=[5]) - await async_math_contract.functions.increment().transact() + await async_math_contract.functions.incrementCounter().transact() late = await async_math_contract.functions.counter().call(block_identifier="latest") pend = await async_math_contract.functions.counter().call( @@ -1554,7 +1558,7 @@ async def test_async_accepts_latest_block(async_w3, async_math_contract): @pytest.mark.asyncio async def test_async_accepts_block_hash_as_identifier(async_w3, async_math_contract): blocks = await async_w3.provider.make_request(method="evm_mine", params=[5]) - await async_math_contract.functions.increment().transact() + await async_math_contract.functions.incrementCounter().transact() more_blocks = await async_w3.provider.make_request(method="evm_mine", params=[5]) old = await async_math_contract.functions.counter().call( @@ -1571,8 +1575,8 @@ async def test_async_accepts_block_hash_as_identifier(async_w3, async_math_contr @pytest.mark.asyncio async def test_async_neg_block_indexes_from_the_end(async_w3, async_math_contract): await async_w3.provider.make_request(method="evm_mine", params=[5]) - await async_math_contract.functions.increment().transact() - await async_math_contract.functions.increment().transact() + await async_math_contract.functions.incrementCounter().transact() + await async_math_contract.functions.incrementCounter().transact() await async_w3.provider.make_request(method="evm_mine", params=[5]) output1 = await async_math_contract.functions.counter().call(block_identifier=-7) @@ -1952,8 +1956,8 @@ async def test_async_call_with_one_argument(async_math_contract, call): async def test_async_returns_data_from_specified_block(async_w3, async_math_contract): start_num = await async_w3.eth.get_block("latest") await async_w3.provider.make_request(method="evm_mine", params=[5]) - await async_math_contract.functions.increment().transact() - await async_math_contract.functions.increment().transact() + await async_math_contract.functions.incrementCounter().transact() + await async_math_contract.functions.incrementCounter().transact() output1 = await async_math_contract.functions.counter().call( block_identifier=start_num.number + 6 @@ -1971,7 +1975,7 @@ async def test_async_changing_default_block_identifier(async_w3, async_math_cont assert await async_math_contract.caller.counter() == 0 assert async_w3.eth.default_block == "latest" - await async_math_contract.functions.increment(7).transact() + await async_math_contract.functions.incrementCounter(7).transact() assert await async_math_contract.caller.counter() == 7 assert await async_math_contract.functions.counter().call(block_identifier=1) == 0 diff --git a/tests/core/contracts/test_contract_caller_interface.py b/tests/core/contracts/test_contract_caller_interface.py index ebda46b5a3..90245a127d 100644 --- a/tests/core/contracts/test_contract_caller_interface.py +++ b/tests/core/contracts/test_contract_caller_interface.py @@ -98,8 +98,8 @@ def test_caller_with_block_identifier(w3, math_contract): assert math_contract.caller.counter() == 0 w3.provider.make_request(method="evm_mine", params=[5]) - math_contract.functions.increment().transact() - math_contract.functions.increment().transact() + math_contract.functions.incrementCounter().transact() + math_contract.functions.incrementCounter().transact() output1 = math_contract.caller(block_identifier=start_num + 6).counter() output2 = math_contract.caller(block_identifier=start_num + 7).counter() @@ -237,8 +237,8 @@ async def test_async_caller_with_block_identifier(async_w3, async_math_contract) assert await async_math_contract.caller.counter() == 0 await async_w3.provider.make_request(method="evm_mine", params=[5]) - await async_math_contract.functions.increment().transact() - await async_math_contract.functions.increment().transact() + await async_math_contract.functions.incrementCounter().transact() + await async_math_contract.functions.incrementCounter().transact() output1 = await async_math_contract.caller(block_identifier=start_num + 6).counter() output2 = await async_math_contract.caller(block_identifier=start_num + 7).counter() diff --git a/tests/core/contracts/test_contract_class_construction.py b/tests/core/contracts/test_contract_class_construction.py index 022a27b796..a6a200d449 100644 --- a/tests/core/contracts/test_contract_class_construction.py +++ b/tests/core/contracts/test_contract_class_construction.py @@ -13,16 +13,18 @@ ) -def test_class_construction_sets_class_vars(w3, MATH_ABI, MATH_CODE, MATH_RUNTIME): +def test_class_construction_sets_class_vars( + w3, math_contract_abi, math_contract_bytecode, math_contract_runtime +): MathContract = w3.eth.contract( - abi=MATH_ABI, - bytecode=MATH_CODE, - bytecode_runtime=MATH_RUNTIME, + abi=math_contract_abi, + bytecode=math_contract_bytecode, + bytecode_runtime=math_contract_runtime, ) assert MathContract.w3 == w3 - assert MathContract.bytecode == decode_hex(MATH_CODE) - assert MathContract.bytecode_runtime == decode_hex(MATH_RUNTIME) + assert MathContract.bytecode == decode_hex(math_contract_bytecode) + assert MathContract.bytecode_runtime == decode_hex(math_contract_runtime) def test_error_to_instantiate_base_class(): @@ -30,21 +32,23 @@ def test_error_to_instantiate_base_class(): Contract() -def test_abi_as_json_string(w3, MATH_ABI, some_address): - abi_str = json.dumps(MATH_ABI) +def test_abi_as_json_string(w3, math_contract_abi, some_address): + abi_str = json.dumps(math_contract_abi) MathContract = w3.eth.contract(abi=abi_str) - assert MathContract.abi == MATH_ABI + assert MathContract.abi == math_contract_abi math = MathContract(some_address) - assert math.abi == MATH_ABI + assert math.abi == math_contract_abi -def test_error_to_call_non_existent_fallback(w3, MATH_ABI, MATH_CODE, MATH_RUNTIME): +def test_error_to_call_non_existent_fallback( + w3, math_contract_abi, math_contract_bytecode, math_contract_runtime +): math_contract = w3.eth.contract( - abi=MATH_ABI, - bytecode=MATH_CODE, - bytecode_runtime=MATH_RUNTIME, + abi=math_contract_abi, + bytecode=math_contract_bytecode, + bytecode_runtime=math_contract_runtime, ) with pytest.raises(FallbackNotFound): math_contract.fallback.estimate_gas() diff --git a/tests/core/contracts/test_contract_constructor.py b/tests/core/contracts/test_contract_constructor.py index 796c567266..6a6fe5954e 100644 --- a/tests/core/contracts/test_contract_constructor.py +++ b/tests/core/contracts/test_contract_constructor.py @@ -13,28 +13,28 @@ def test_contract_constructor_abi_encoding_with_no_constructor_fn( - MathContract, MATH_CODE + math_contract_instance, math_contract_bytecode ): - deploy_data = MathContract.constructor()._encode_data_in_transaction() - assert deploy_data == MATH_CODE + deploy_data = math_contract_instance.constructor()._encode_data_in_transaction() + assert deploy_data == math_contract_bytecode -def test_contract_constructor_gas_estimate_no_constructor(w3, MathContract): - gas_estimate = MathContract.constructor().estimate_gas() +def test_contract_constructor_gas_estimate_no_constructor(w3, math_contract_instance): + gas_estimate = math_contract_instance.constructor().estimate_gas() - deploy_txn = MathContract.constructor().transact() + deploy_txn = math_contract_instance.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") assert abs(gas_estimate - gas_used) < 21000 -def test_contract_constructor_gas_estimate_with_block_id(w3, MathContract): +def test_contract_constructor_gas_estimate_with_block_id(w3, math_contract_instance): block_identifier = None - gas_estimate = MathContract.constructor().estimate_gas( + gas_estimate = math_contract_instance.constructor().estimate_gas( block_identifier=block_identifier ) - deploy_txn = MathContract.constructor().transact() + deploy_txn = math_contract_instance.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -42,11 +42,11 @@ def test_contract_constructor_gas_estimate_with_block_id(w3, MathContract): def test_contract_constructor_gas_estimate_without_arguments( - w3, SimpleConstructorContract + w3, simple_constructor_contract_instance ): - gas_estimate = SimpleConstructorContract.constructor().estimate_gas() + gas_estimate = simple_constructor_contract_instance.constructor().estimate_gas() - deploy_txn = SimpleConstructorContract.constructor().transact() + deploy_txn = simple_constructor_contract_instance.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -64,15 +64,15 @@ def test_contract_constructor_gas_estimate_without_arguments( ) def test_contract_constructor_gas_estimate_with_arguments_non_strict( w3_non_strict_abi, - NonStrictWithConstructorArgumentsContract, + non_strict_contract_with_constructor_args_instance, constructor_args, constructor_kwargs, ): - gas_estimate = NonStrictWithConstructorArgumentsContract.constructor( + gas_estimate = non_strict_contract_with_constructor_args_instance.constructor( *constructor_args, **constructor_kwargs ).estimate_gas() - deploy_txn = NonStrictWithConstructorArgumentsContract.constructor( + deploy_txn = non_strict_contract_with_constructor_args_instance.constructor( *constructor_args, **constructor_kwargs ).transact() txn_receipt = w3_non_strict_abi.eth.wait_for_transaction_receipt(deploy_txn) @@ -82,13 +82,13 @@ def test_contract_constructor_gas_estimate_with_arguments_non_strict( def test_contract_constructor_gas_estimate_with_address_argument( - w3, WithConstructorAddressArgumentsContract, address_conversion_func + w3, contract_with_constructor_address_instance, address_conversion_func ): - gas_estimate = WithConstructorAddressArgumentsContract.constructor( + gas_estimate = contract_with_constructor_address_instance.constructor( address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") ).estimate_gas() - deploy_txn = WithConstructorAddressArgumentsContract.constructor( + deploy_txn = contract_with_constructor_address_instance.constructor( address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") ).transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -98,9 +98,9 @@ def test_contract_constructor_gas_estimate_with_address_argument( def test_contract_constructor_transact_no_constructor( - w3, MathContract, MATH_RUNTIME, address_conversion_func + w3, math_contract_instance, math_contract_runtime, address_conversion_func ): - deploy_txn = MathContract.constructor().transact() + deploy_txn = math_contract_instance.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -109,13 +109,16 @@ def test_contract_constructor_transact_no_constructor( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(MATH_RUNTIME) + assert blockchain_code == decode_hex(math_contract_runtime) def test_contract_constructor_transact_without_arguments( - w3, SimpleConstructorContract, SIMPLE_CONSTRUCTOR_RUNTIME, address_conversion_func + w3, + simple_constructor_contract_instance, + simple_constructor_contract_runtime, + address_conversion_func, ): - deploy_txn = SimpleConstructorContract.constructor().transact() + deploy_txn = simple_constructor_contract_instance.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -124,7 +127,7 @@ def test_contract_constructor_transact_without_arguments( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_RUNTIME) + assert blockchain_code == decode_hex(simple_constructor_contract_runtime) @pytest.mark.parametrize( @@ -138,15 +141,15 @@ def test_contract_constructor_transact_without_arguments( ) def test_contract_constructor_transact_with_arguments_non_strict( w3_non_strict_abi, - NonStrictWithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + non_strict_contract_with_constructor_args_instance, + contract_with_constructor_args_runtime, constructor_args, constructor_kwargs, expected_a, expected_b, address_conversion_func, ): - deploy_txn = NonStrictWithConstructorArgumentsContract.constructor( + deploy_txn = non_strict_contract_with_constructor_args_instance.constructor( *constructor_args, **constructor_kwargs ).transact() @@ -157,16 +160,16 @@ def test_contract_constructor_transact_with_arguments_non_strict( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) assert ( expected_a - == NonStrictWithConstructorArgumentsContract(address=contract_address) + == non_strict_contract_with_constructor_args_instance(address=contract_address) .functions.data_a() .call() ) assert ( expected_b - == NonStrictWithConstructorArgumentsContract(address=contract_address) + == non_strict_contract_with_constructor_args_instance(address=contract_address) .functions.data_b() .call() ) @@ -174,11 +177,11 @@ def test_contract_constructor_transact_with_arguments_non_strict( def test_contract_constructor_transact_with_address_argument( w3, - WithConstructorAddressArgumentsContract, - WITH_CONSTRUCTOR_ADDRESS_RUNTIME, + contract_with_constructor_address_instance, + contract_with_constructor_address_runtime, address_conversion_func, ): - deploy_txn = WithConstructorAddressArgumentsContract.constructor( + deploy_txn = contract_with_constructor_address_instance.constructor( TEST_ADDRESS ).transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -186,29 +189,31 @@ def test_contract_constructor_transact_with_address_argument( assert txn_receipt["contractAddress"] contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ADDRESS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) assert ( TEST_ADDRESS - == WithConstructorAddressArgumentsContract(address=contract_address) + == contract_with_constructor_address_instance(address=contract_address) .functions.testAddr() .call() ) -def test_contract_constructor_build_transaction_to_field_error(MathContract): +def test_contract_constructor_build_transaction_to_field_error(math_contract_instance): with pytest.raises(ValueError): - MathContract.constructor().build_transaction({"to": "123"}) + math_contract_instance.constructor().build_transaction({"to": "123"}) def test_contract_constructor_build_transaction_no_constructor( - w3, MathContract, address_conversion_func + w3, math_contract_instance, address_conversion_func ): - txn_hash = MathContract.constructor().transact( + txn_hash = math_contract_instance.constructor().transact( {"from": address_conversion_func(w3.eth.accounts[0])} ) txn = w3.eth.get_transaction(txn_hash) nonce = w3.eth.get_transaction_count(w3.eth.coinbase) - unsent_txn = MathContract.constructor().build_transaction({"nonce": nonce}) + unsent_txn = math_contract_instance.constructor().build_transaction( + {"nonce": nonce} + ) assert txn["data"] == unsent_txn["data"] new_txn_hash = w3.eth.send_transaction(unsent_txn) @@ -218,14 +223,16 @@ def test_contract_constructor_build_transaction_no_constructor( def test_contract_constructor_build_transaction_without_arguments( - w3, MathContract, address_conversion_func + w3, math_contract_instance, address_conversion_func ): - txn_hash = MathContract.constructor().transact( + txn_hash = math_contract_instance.constructor().transact( {"from": address_conversion_func(w3.eth.accounts[0])} ) txn = w3.eth.get_transaction(txn_hash) nonce = w3.eth.get_transaction_count(w3.eth.coinbase) - unsent_txn = MathContract.constructor().build_transaction({"nonce": nonce}) + unsent_txn = math_contract_instance.constructor().build_transaction( + {"nonce": nonce} + ) assert txn["data"] == unsent_txn["data"] new_txn_hash = w3.eth.send_transaction(unsent_txn) @@ -245,17 +252,17 @@ def test_contract_constructor_build_transaction_without_arguments( ) def test_contract_constructor_build_transaction_with_arguments( w3_non_strict_abi, - NonStrictWithConstructorArgumentsContract, + non_strict_contract_with_constructor_args_instance, constructor_args, constructor_kwargs, address_conversion_func, ): - txn_hash = NonStrictWithConstructorArgumentsContract.constructor( + txn_hash = non_strict_contract_with_constructor_args_instance.constructor( *constructor_args, **constructor_kwargs ).transact({"from": address_conversion_func(w3_non_strict_abi.eth.accounts[0])}) txn = w3_non_strict_abi.eth.get_transaction(txn_hash) nonce = w3_non_strict_abi.eth.get_transaction_count(w3_non_strict_abi.eth.coinbase) - unsent_txn = NonStrictWithConstructorArgumentsContract.constructor( + unsent_txn = non_strict_contract_with_constructor_args_instance.constructor( *constructor_args, **constructor_kwargs ).build_transaction({"nonce": nonce}) assert txn["data"] == unsent_txn["data"] @@ -267,10 +274,10 @@ def test_contract_constructor_build_transaction_with_arguments( def test_async_contract_constructor_abi_encoding_with_no_constructor_fn( - AsyncMathContract, MATH_CODE + AsyncMathContract, math_contract_bytecode ): deploy_data = AsyncMathContract.constructor()._encode_data_in_transaction() - assert deploy_data == MATH_CODE + assert deploy_data == math_contract_bytecode @pytest.mark.asyncio @@ -364,7 +371,7 @@ async def test_async_contract_constructor_gas_estimate_with_address_argument( @pytest.mark.asyncio async def test_async_contract_constructor_transact_no_constructor( - async_w3, AsyncMathContract, MATH_RUNTIME, address_conversion_func + async_w3, AsyncMathContract, math_contract_runtime, address_conversion_func ): deploy_txn = await AsyncMathContract.constructor().transact() @@ -375,14 +382,14 @@ async def test_async_contract_constructor_transact_no_constructor( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(MATH_RUNTIME) + assert blockchain_code == decode_hex(math_contract_runtime) @pytest.mark.asyncio async def test_async_contract_constructor_transact_without_arguments( async_w3, AsyncSimpleConstructorContract, - SIMPLE_CONSTRUCTOR_RUNTIME, + simple_constructor_contract_runtime, address_conversion_func, ): deploy_txn = await AsyncSimpleConstructorContract.constructor().transact() @@ -394,7 +401,7 @@ async def test_async_contract_constructor_transact_without_arguments( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_RUNTIME) + assert blockchain_code == decode_hex(simple_constructor_contract_runtime) @pytest.mark.asyncio @@ -410,7 +417,7 @@ async def test_async_contract_constructor_transact_without_arguments( async def test_async_contract_constructor_transact_with_arguments_non_strict( async_w3_non_strict_abi, AsyncNonStrictWithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + contract_with_constructor_args_runtime, constructor_args, constructor_kwargs, expected_a, @@ -430,7 +437,7 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = await async_w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) assert ( expected_a == await AsyncNonStrictWithConstructorArgumentsContract( @@ -453,7 +460,7 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( async def test_async_contract_constructor_transact_with_address_arguments( async_w3, AsyncWithConstructorAddressArgumentsContract, - WITH_CONSTRUCTOR_ADDRESS_RUNTIME, + contract_with_constructor_address_runtime, address_conversion_func, ): deploy_txn = await AsyncWithConstructorAddressArgumentsContract.constructor( @@ -464,7 +471,7 @@ async def test_async_contract_constructor_transact_with_address_arguments( assert txn_receipt["contractAddress"] contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ADDRESS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) assert ( TEST_ADDRESS == await AsyncWithConstructorAddressArgumentsContract(address=contract_address) diff --git a/tests/core/contracts/test_contract_constructor_encoding.py b/tests/core/contracts/test_contract_constructor_encoding.py index 4c7ce53edc..6144bb5618 100644 --- a/tests/core/contracts/test_contract_constructor_encoding.py +++ b/tests/core/contracts/test_contract_constructor_encoding.py @@ -7,17 +7,17 @@ def test_contract_constructor_abi_encoding_with_no_constructor_fn( - MathContract, MATH_CODE + math_contract_instance, math_contract_bytecode ): - deploy_data = MathContract._encode_constructor_data() - assert deploy_data == MATH_CODE + deploy_data = math_contract_instance._encode_constructor_data() + assert deploy_data == math_contract_bytecode def test_contract_constructor_abi_encoding_with_constructor_with_no_args( - SimpleConstructorContract, SIMPLE_CONSTRUCTOR_CODE + simple_constructor_contract_instance, simple_constructor_contract_bytecode ): - deploy_data = SimpleConstructorContract._encode_constructor_data() - assert deploy_data == SIMPLE_CONSTRUCTOR_CODE + deploy_data = simple_constructor_contract_instance._encode_constructor_data() + assert deploy_data == simple_constructor_contract_bytecode @pytest.mark.parametrize( @@ -28,10 +28,10 @@ def test_contract_constructor_abi_encoding_with_constructor_with_no_args( ), ) def test_contract_error_if_additional_args_are_supplied_with_no_constructor_fn( - MathContract, args, kwargs + math_contract_instance, args, kwargs ): with pytest.raises(TypeError, match="Constructor args"): - MathContract._encode_constructor_data(args, kwargs) + math_contract_instance._encode_constructor_data(args, kwargs) @pytest.mark.parametrize( @@ -46,10 +46,10 @@ def test_contract_error_if_additional_args_are_supplied_with_no_constructor_fn( ), ) def test_error_if_invalid_arguments_supplied( - WithConstructorArgumentsContract, arguments + contract_with_constructor_args_instance, arguments ): with pytest.raises(TypeError): - WithConstructorArgumentsContract._encode_constructor_data(arguments) + contract_with_constructor_args_instance._encode_constructor_data(arguments) @pytest.mark.parametrize( @@ -67,11 +67,11 @@ def test_error_if_invalid_arguments_supplied( ) def test_contract_constructor_encoding( w3, - WithConstructorArgumentsContract, + contract_with_constructor_args_instance, encoded_args, bytes_arg, ): - deploy_data = WithConstructorArgumentsContract._encode_constructor_data( + deploy_data = contract_with_constructor_args_instance._encode_constructor_data( [1234, bytes_arg] ) expected_ending = encode_hex( @@ -90,10 +90,12 @@ def test_contract_constructor_encoding( ), ) def test_contract_constructor_encoding_non_strict( - w3_non_strict_abi, NonStrictWithConstructorArgumentsContract, bytes_arg + w3_non_strict_abi, non_strict_contract_with_constructor_args_instance, bytes_arg ): - deploy_data = NonStrictWithConstructorArgumentsContract._encode_constructor_data( - [1234, bytes_arg] + deploy_data = ( + non_strict_contract_with_constructor_args_instance._encode_constructor_data( + [1234, bytes_arg] + ) ) encoded_args = "0x00000000000000000000000000000000000000000000000000000000000004d26162636400000000000000000000000000000000000000000000000000000000" # noqa: E501 expected_ending = encode_hex( @@ -113,10 +115,12 @@ def test_contract_constructor_encoding_non_strict( ), ) def test_contract_constructor_encoding_strict_errors( - WithConstructorArgumentsContract, bytes_arg + contract_with_constructor_args_instance, bytes_arg ): with pytest.raises( TypeError, match="One or more arguments could not be encoded to the necessary ABI type.", ): - WithConstructorArgumentsContract._encode_constructor_data([1234, bytes_arg]) + contract_with_constructor_args_instance._encode_constructor_data( + [1234, bytes_arg] + ) diff --git a/tests/core/contracts/test_contract_deployment.py b/tests/core/contracts/test_contract_deployment.py index 302ed8ccc1..05b88bd6ad 100644 --- a/tests/core/contracts/test_contract_deployment.py +++ b/tests/core/contracts/test_contract_deployment.py @@ -9,8 +9,10 @@ ) -def test_contract_deployment_no_constructor(w3, MathContract, MATH_RUNTIME): - deploy_txn = MathContract.constructor().transact() +def test_contract_deployment_no_constructor( + w3, math_contract_instance, math_contract_runtime +): + deploy_txn = math_contract_instance.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -19,13 +21,15 @@ def test_contract_deployment_no_constructor(w3, MathContract, MATH_RUNTIME): contract_address = txn_receipt["contractAddress"] blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(MATH_RUNTIME) + assert blockchain_code == decode_hex(math_contract_runtime) def test_contract_deployment_with_constructor_without_args( - w3, SimpleConstructorContract, SIMPLE_CONSTRUCTOR_RUNTIME + w3, + simple_constructor_contract_instance, + simple_constructor_contract_runtime, ): - deploy_txn = SimpleConstructorContract.constructor().transact() + deploy_txn = simple_constructor_contract_instance.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -34,7 +38,7 @@ def test_contract_deployment_with_constructor_without_args( contract_address = txn_receipt["contractAddress"] blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_RUNTIME) + assert blockchain_code == decode_hex(simple_constructor_contract_runtime) @pytest.mark.parametrize( @@ -46,11 +50,11 @@ def test_contract_deployment_with_constructor_without_args( ) def test_contract_deployment_with_constructor_with_arguments_strict_by_default( w3, - WithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + contract_with_constructor_args_instance, + contract_with_constructor_args_runtime, constructor_arg, ): - deploy_txn = WithConstructorArgumentsContract.constructor( + deploy_txn = contract_with_constructor_args_instance.constructor( 1234, constructor_arg ).transact() @@ -61,15 +65,15 @@ def test_contract_deployment_with_constructor_with_arguments_strict_by_default( contract_address = txn_receipt["contractAddress"] blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) def test_contract_deployment_with_constructor_with_arguments_non_strict( w3_non_strict_abi, - NonStrictWithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + non_strict_contract_with_constructor_args_instance, + contract_with_constructor_args_runtime, ): - deploy_txn = NonStrictWithConstructorArgumentsContract.constructor( + deploy_txn = non_strict_contract_with_constructor_args_instance.constructor( 1234, "abcd" ).transact() @@ -80,26 +84,26 @@ def test_contract_deployment_with_constructor_with_arguments_non_strict( contract_address = txn_receipt["contractAddress"] blockchain_code = w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) def test_contract_deployment_with_constructor_with_arguments_strict_error( - WithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + contract_with_constructor_args_instance, + contract_with_constructor_args_runtime, ): with pytest.raises( TypeError, match="One or more arguments could not be encoded to the necessary ABI type. Expected types are: uint256, bytes32", # noqa: E501 ): - WithConstructorArgumentsContract.constructor(1234, "abcd").transact() + contract_with_constructor_args_instance.constructor(1234, "abcd").transact() def test_contract_deployment_with_constructor_with_address_argument( w3, - WithConstructorAddressArgumentsContract, # noqa: E501 - WITH_CONSTRUCTOR_ADDRESS_RUNTIME, + contract_with_constructor_address_instance, # noqa: E501 + contract_with_constructor_address_runtime, ): # noqa: E501 - deploy_txn = WithConstructorAddressArgumentsContract.constructor( + deploy_txn = contract_with_constructor_address_instance.constructor( "0x16D9983245De15E7A9A73bC586E01FF6E08dE737", ).transact() @@ -110,12 +114,12 @@ def test_contract_deployment_with_constructor_with_address_argument( contract_address = txn_receipt["contractAddress"] blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ADDRESS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) @pytest.mark.asyncio async def test_async_contract_deployment_no_constructor( - async_w3, AsyncMathContract, MATH_RUNTIME + async_w3, AsyncMathContract, math_contract_runtime ): deploy_txn = await AsyncMathContract.constructor().transact() @@ -126,12 +130,14 @@ async def test_async_contract_deployment_no_constructor( contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(MATH_RUNTIME) + assert blockchain_code == decode_hex(math_contract_runtime) @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_no_args( - async_w3, AsyncSimpleConstructorContract, SIMPLE_CONSTRUCTOR_RUNTIME + async_w3, + AsyncSimpleConstructorContract, + simple_constructor_contract_runtime, ): deploy_txn = await AsyncSimpleConstructorContract.constructor().transact() @@ -142,7 +148,7 @@ async def test_async_contract_deployment_with_constructor_no_args( contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_RUNTIME) + assert blockchain_code == decode_hex(simple_constructor_contract_runtime) @pytest.mark.asyncio @@ -156,7 +162,7 @@ async def test_async_contract_deployment_with_constructor_no_args( async def test_async_contract_deployment_with_constructor_arguments( async_w3, AsyncWithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + contract_with_constructor_args_runtime, constructor_arg, ): @@ -171,14 +177,14 @@ async def test_async_contract_deployment_with_constructor_arguments( contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_with_arguments_non_strict( async_w3_non_strict_abi, AsyncNonStrictWithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + contract_with_constructor_args_runtime, ): deploy_txn = await AsyncNonStrictWithConstructorArgumentsContract.constructor( 1234, "abcd" @@ -193,13 +199,13 @@ async def test_async_contract_deployment_with_constructor_with_arguments_non_str contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_arguments_strict_error( AsyncWithConstructorArgumentsContract, - WITH_CONSTRUCTOR_ARGUMENTS_RUNTIME, + contract_with_constructor_args_runtime, ): with pytest.raises( TypeError, @@ -212,7 +218,7 @@ async def test_async_contract_deployment_with_constructor_arguments_strict_error async def test_async_contract_deployment_with_constructor_with_address_argument( async_w3, AsyncWithConstructorAddressArgumentsContract, # noqa: E501 - WITH_CONSTRUCTOR_ADDRESS_RUNTIME, + contract_with_constructor_address_runtime, ): # noqa: E501 deploy_txn = await AsyncWithConstructorAddressArgumentsContract.constructor( "0x16D9983245De15E7A9A73bC586E01FF6E08dE737", @@ -225,4 +231,4 @@ async def test_async_contract_deployment_with_constructor_with_address_argument( contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(WITH_CONSTRUCTOR_ADDRESS_RUNTIME) + assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) diff --git a/tests/core/contracts/test_contract_estimate_gas.py b/tests/core/contracts/test_contract_estimate_gas.py index 045ce1a641..730b2353cd 100644 --- a/tests/core/contracts/test_contract_estimate_gas.py +++ b/tests/core/contracts/test_contract_estimate_gas.py @@ -6,9 +6,11 @@ def test_contract_estimate_gas(w3, math_contract, estimate_gas, transact): - gas_estimate = estimate_gas(contract=math_contract, contract_function="increment") + gas_estimate = estimate_gas( + contract=math_contract, contract_function="incrementCounter" + ) - txn_hash = transact(contract=math_contract, contract_function="increment") + txn_hash = transact(contract=math_contract, contract_function="incrementCounter") txn_receipt = w3.eth.wait_for_transaction_receipt(txn_hash) gas_used = txn_receipt.get("gasUsed") @@ -76,7 +78,7 @@ def test_estimate_gas_accepts_latest_block(w3, math_contract, transact): block_identifier="latest" ) - txn_hash = transact(contract=math_contract, contract_function="increment") + txn_hash = transact(contract=math_contract, contract_function="incrementCounter") txn_receipt = w3.eth.wait_for_transaction_receipt(txn_hash) gas_used = txn_receipt.get("gasUsed") @@ -85,7 +87,7 @@ def test_estimate_gas_accepts_latest_block(w3, math_contract, transact): def test_estimate_gas_block_identifier_unique_estimates(w3, math_contract, transact): - txn_hash = transact(contract=math_contract, contract_function="increment") + txn_hash = transact(contract=math_contract, contract_function="incrementCounter") w3.eth.wait_for_transaction_receipt(txn_hash) latest_gas_estimate = math_contract.functions.counter().estimate_gas( @@ -103,11 +105,11 @@ async def test_async_contract_estimate_gas( async_w3, async_math_contract, async_estimate_gas, async_transact ): gas_estimate = await async_estimate_gas( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) txn_hash = await async_transact( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(txn_hash) @@ -186,7 +188,7 @@ async def test_async_estimate_gas_accepts_latest_block( ) txn_hash = await async_transact( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(txn_hash) @@ -200,7 +202,7 @@ async def test_async_estimate_gas_block_identifier_unique_estimates( async_w3, async_math_contract, async_transact ): txn_hash = await async_transact( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) await async_w3.eth.wait_for_transaction_receipt(txn_hash) diff --git a/tests/core/contracts/test_contract_events_build_filter.py b/tests/core/contracts/test_contract_events_build_filter.py index 50986f145f..0b2a82dd93 100644 --- a/tests/core/contracts/test_contract_events_build_filter.py +++ b/tests/core/contracts/test_contract_events_build_filter.py @@ -1,4 +1,3 @@ -import json import pytest from eth_utils import ( @@ -8,13 +7,9 @@ HexBytes, ) -CONTRACT_ABI = json.loads( - '[{"constant":false,"inputs":[],"name":"return13","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[],"name":"counter","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"amt","type":"uint256"}],"name":"increment","outputs":[{"name":"result","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"},{"name":"b","type":"int256"}],"name":"add","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":false,"inputs":[],"name":"increment","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"}],"name":"multiply7","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"event"}]' # noqa: E501 -) - -def test_build_filter_topic_signature(w3): - contract = w3.eth.contract(abi=CONTRACT_ABI) +def test_build_filter_topic_signature(w3, math_contract_abi): + contract = w3.eth.contract(abi=math_contract_abi) filter_builder = contract.events.Increased.build_filter() filter_builder.args["value"].match_any(100, 200, 300) _filter = filter_builder.deploy(w3) @@ -24,8 +19,8 @@ def test_build_filter_topic_signature(w3): assert _filter.data_filter_set == (("uint256", (100, 200, 300)),) -def test_build_filter_resetting_build_filter_properties(w3): - contract = w3.eth.contract(abi=CONTRACT_ABI) +def test_build_filter_resetting_build_filter_properties(w3, math_contract_abi): + contract = w3.eth.contract(abi=math_contract_abi) filter_builder = contract.events.Increased.build_filter() # Address is setable from undeployed contract class filter_builder.address = b"\x10" * 40 @@ -40,24 +35,24 @@ def test_build_filter_resetting_build_filter_properties(w3): filter_builder.toBlock = 50 -def test_build_filter_argument_match_single_can_only_be_set_once(w3): - contract = w3.eth.contract(abi=CONTRACT_ABI) +def test_build_filter_argument_match_single_can_only_be_set_once(w3, math_contract_abi): + contract = w3.eth.contract(abi=math_contract_abi) filter_builder = contract.events.Increased.build_filter() filter_builder.args["value"].match_single(100) with pytest.raises(ValueError): filter_builder.args["value"].match_single(200) -def test_build_filter_argument_match_any_can_only_be_set_once(w3): - contract = w3.eth.contract(abi=CONTRACT_ABI) +def test_build_filter_argument_match_any_can_only_be_set_once(w3, math_contract_abi): + contract = w3.eth.contract(abi=math_contract_abi) filter_builder = contract.events.Increased.build_filter() filter_builder.args["value"].match_any(100, 200) with pytest.raises(ValueError): filter_builder.args["value"].match_any(200, 300) -def test_deployed_build_filter_can_have_no_values_set(w3): - contract = w3.eth.contract(abi=CONTRACT_ABI) +def test_deployed_build_filter_can_have_no_values_set(w3, math_contract_abi): + contract = w3.eth.contract(abi=math_contract_abi) filter_builder = contract.events.Increased.build_filter() filter_builder.deploy(w3) with pytest.raises(ValueError): diff --git a/tests/core/contracts/test_contract_init.py b/tests/core/contracts/test_contract_init.py index e8f9934ed3..508a0762a1 100644 --- a/tests/core/contracts/test_contract_init.py +++ b/tests/core/contracts/test_contract_init.py @@ -11,23 +11,25 @@ @pytest.fixture() -def math_addr(MathContract, address_conversion_func): - w3 = MathContract.w3 - deploy_txn = MathContract.constructor().transact({"from": w3.eth.coinbase}) +def math_addr(math_contract_instance, address_conversion_func): + w3 = math_contract_instance.w3 + deploy_txn = math_contract_instance.constructor().transact( + {"from": w3.eth.coinbase} + ) deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None return address_conversion_func(deploy_receipt["contractAddress"]) -def test_contract_with_unset_address(MathContract): - with contract_ens_addresses(MathContract, []): +def test_contract_with_unset_address(math_contract_instance): + with contract_ens_addresses(math_contract_instance, []): with pytest.raises(NameNotFound): - MathContract(address="unsetname.eth") + math_contract_instance(address="unsetname.eth") -def test_contract_with_name_address(MathContract, math_addr): - with contract_ens_addresses(MathContract, [("thedao.eth", math_addr)]): - mc = MathContract(address="thedao.eth") +def test_contract_with_name_address(math_contract_instance, math_addr): + with contract_ens_addresses(math_contract_instance, [("thedao.eth", math_addr)]): + mc = math_contract_instance(address="thedao.eth") caller = mc.w3.eth.coinbase assert mc.address == "thedao.eth" assert mc.functions.return13().call({"from": caller}) == 13 @@ -35,17 +37,17 @@ def test_contract_with_name_address(MathContract, math_addr): def test_contract_with_name_address_from_eth_contract( w3, - MATH_ABI, - MATH_CODE, - MATH_RUNTIME, + math_contract_abi, + math_contract_bytecode, + math_contract_runtime, math_addr, ): with ens_addresses(w3, [("thedao.eth", math_addr)]): mc = w3.eth.contract( address="thedao.eth", - abi=MATH_ABI, - bytecode=MATH_CODE, - bytecode_runtime=MATH_RUNTIME, + abi=math_contract_abi, + bytecode=math_contract_bytecode, + bytecode_runtime=math_contract_runtime, ) caller = mc.w3.eth.coinbase @@ -53,10 +55,10 @@ def test_contract_with_name_address_from_eth_contract( assert mc.functions.return13().call({"from": caller}) == 13 -def test_contract_with_name_address_changing(MathContract, math_addr): +def test_contract_with_name_address_changing(math_contract_instance, math_addr): # Contract address is validated once on creation - with contract_ens_addresses(MathContract, [("thedao.eth", math_addr)]): - mc = MathContract(address="thedao.eth") + with contract_ens_addresses(math_contract_instance, [("thedao.eth", math_addr)]): + mc = math_contract_instance(address="thedao.eth") caller = mc.w3.eth.coinbase assert mc.address == "thedao.eth" diff --git a/tests/core/contracts/test_contract_transact_interface.py b/tests/core/contracts/test_contract_transact_interface.py index e6a4014e02..7ff3aee1f5 100644 --- a/tests/core/contracts/test_contract_transact_interface.py +++ b/tests/core/contracts/test_contract_transact_interface.py @@ -11,7 +11,7 @@ def test_transacting_with_contract_no_arguments(w3, math_contract, transact, call): initial_value = call(contract=math_contract, contract_function="counter") - txn_hash = transact(contract=math_contract, contract_function="increment") + txn_hash = transact(contract=math_contract, contract_function="incrementCounter") txn_receipt = w3.eth.wait_for_transaction_receipt(txn_hash) assert txn_receipt is not None @@ -65,7 +65,7 @@ def test_transact_sending_ether_to_nonpayable_function( "transact_args,transact_kwargs", ( ((5,), {}), - (tuple(), {"amt": 5}), + (tuple(), {"amount": 5}), ), ) def test_transacting_with_contract_with_arguments( @@ -75,7 +75,7 @@ def test_transacting_with_contract_with_arguments( txn_hash = transact( contract=math_contract, - contract_function="increment", + contract_function="incrementCounter", func_args=transact_args, func_kwargs=transact_kwargs, ) @@ -88,11 +88,11 @@ def test_transacting_with_contract_with_arguments( assert final_value - initial_value == 5 -def test_deploy_when_default_account_is_set(w3, STRING_CONTRACT): +def test_deploy_when_default_account_is_set(w3, string_contract_kwargs): w3.eth.default_account = w3.eth.accounts[1] assert w3.eth.default_account is not empty - StringContract = w3.eth.contract(**STRING_CONTRACT) + StringContract = w3.eth.contract(**string_contract_kwargs) deploy_txn = StringContract.constructor("Caqalai").transact() w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -104,7 +104,7 @@ def test_transact_when_default_account_is_set(w3, math_contract, transact): w3.eth.default_account = w3.eth.accounts[1] assert w3.eth.default_account is not empty - txn_hash = transact(contract=math_contract, contract_function="increment") + txn_hash = transact(contract=math_contract, contract_function="incrementCounter") txn_after = w3.eth.get_transaction(txn_hash) assert txn_after["from"] == w3.eth.default_account @@ -166,7 +166,8 @@ def test_transacting_with_contract_with_bytes32_array_argument( assert final_value == new_bytes32_array -def test_transacting_with_contract_with_byte_array_argument( +# TODO: strict by default +def test_transacting_with_contract_with_byte_array_argument_strict( w3, arrays_contract, transact, call ): new_byte_array = [b"\x03", b"\x03", b"\x03", b"\x03", b"\x03", b"\x03"] @@ -201,9 +202,9 @@ def test_transacting_with_contract_with_byte_array_argument_non_strict( def test_transacting_with_contract_respects_explicit_gas( - w3, STRING_CONTRACT, wait_for_block, call, transact + w3, string_contract_kwargs, wait_for_block, call, transact ): - StringContract = w3.eth.contract(**STRING_CONTRACT) + StringContract = w3.eth.contract(**string_contract_kwargs) deploy_txn = StringContract.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn, 30) @@ -227,9 +228,9 @@ def test_transacting_with_contract_respects_explicit_gas( def test_auto_gas_computation_when_transacting( - w3, STRING_CONTRACT, wait_for_block, call, transact + w3, string_contract_kwargs, wait_for_block, call, transact ): - StringContract = w3.eth.contract(**STRING_CONTRACT) + StringContract = w3.eth.contract(**string_contract_kwargs) deploy_txn = StringContract.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn, 30) @@ -294,7 +295,7 @@ async def test_async_transacting_with_contract_no_arguments( ) txn_hash = await async_transact( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(txn_hash) assert txn_receipt is not None @@ -358,7 +359,7 @@ async def test_async_transact_sending_ether_to_nonpayable_function( "transact_args,transact_kwargs", ( ((5,), {}), - (tuple(), {"amt": 5}), + (tuple(), {"amount": 5}), ), ) async def test_async_transacting_with_contract_with_arguments( @@ -375,7 +376,7 @@ async def test_async_transacting_with_contract_with_arguments( txn_hash = await async_transact( contract=async_math_contract, - contract_function="increment", + contract_function="incrementCounter", func_args=transact_args, func_kwargs=transact_kwargs, ) @@ -391,12 +392,14 @@ async def test_async_transacting_with_contract_with_arguments( @pytest.mark.asyncio -async def test_async_deploy_when_default_account_is_set(async_w3, STRING_CONTRACT): +async def test_async_deploy_when_default_account_is_set( + async_w3, string_contract_kwargs +): async_w3_accounts = await async_w3.eth.accounts async_w3.eth.default_account = async_w3_accounts[1] assert async_w3.eth.default_account is not empty - StringContract = async_w3.eth.contract(**STRING_CONTRACT) + StringContract = async_w3.eth.contract(**string_contract_kwargs) deploy_txn = await StringContract.constructor("Caqalai").transact() await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -413,7 +416,7 @@ async def test_async_transact_when_default_account_is_set( assert async_w3.eth.default_account is not empty txn_hash = await async_transact( - contract=async_math_contract, contract_function="increment" + contract=async_math_contract, contract_function="incrementCounter" ) txn_after = await async_w3.eth.get_transaction(txn_hash) assert txn_after["from"] == async_w3.eth.default_account @@ -461,6 +464,7 @@ async def test_async_transacting_with_contract_with_bytes32_array_argument( assert final_value == new_bytes32_array +# TODO: strict by default @pytest.mark.asyncio async def test_async_transacting_with_contract_with_byte_array_argument( async_w3, @@ -509,10 +513,10 @@ async def test_async_transacting_with_contract_with_byte_array_argument_non_stri @pytest.mark.asyncio async def test_async_transacting_with_contract_respects_explicit_gas( - async_w3, STRING_CONTRACT, async_call, async_transact + async_w3, string_contract_kwargs, async_call, async_transact ): - StringContract = async_w3.eth.contract(**STRING_CONTRACT) + StringContract = async_w3.eth.contract(**string_contract_kwargs) deploy_txn = await StringContract.constructor("Caqalai").transact() deploy_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn, 30) @@ -539,10 +543,10 @@ async def test_async_transacting_with_contract_respects_explicit_gas( @pytest.mark.asyncio async def test_async_auto_gas_computation_when_transacting( - async_w3, STRING_CONTRACT, async_call, async_transact + async_w3, string_contract_kwargs, async_call, async_transact ): - StringContract = async_w3.eth.contract(**STRING_CONTRACT) + StringContract = async_w3.eth.contract(**string_contract_kwargs) deploy_txn = await StringContract.constructor("Caqalai").transact() deploy_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn, 30) diff --git a/tests/core/contracts/test_extracting_event_data.py b/tests/core/contracts/test_extracting_event_data.py index 69d9e11078..b5e7026455 100644 --- a/tests/core/contracts/test_extracting_event_data.py +++ b/tests/core/contracts/test_extracting_event_data.py @@ -24,8 +24,8 @@ @pytest.fixture() -def Emitter(w3, EMITTER): - return w3.eth.contract(**EMITTER) +def Emitter(w3, emitter_contract_kwargs): + return w3.eth.contract(**emitter_contract_kwargs) @pytest.fixture() @@ -43,8 +43,8 @@ def emitter(w3, Emitter, wait_for_transaction, wait_for_block, address_conversio @pytest.fixture() -def EventContract(w3, EVENT_CONTRACT): - return w3.eth.contract(**EVENT_CONTRACT) +def EventContract(w3, event_contract_kwargs): + return w3.eth.contract(**event_contract_kwargs) @pytest.fixture() diff --git a/tests/core/contracts/test_extracting_event_data_old.py b/tests/core/contracts/test_extracting_event_data_old.py index 15145cf416..4804836a31 100644 --- a/tests/core/contracts/test_extracting_event_data_old.py +++ b/tests/core/contracts/test_extracting_event_data_old.py @@ -10,8 +10,8 @@ @pytest.fixture() -def Emitter(w3, EMITTER): - return w3.eth.contract(**EMITTER) +def Emitter(w3, emitter_contract_kwargs): + return w3.eth.contract(**emitter_contract_kwargs) @pytest.fixture() diff --git a/tests/core/eth-module/conftest.py b/tests/core/eth-module/conftest.py index 46812af762..36e93a3dd1 100644 --- a/tests/core/eth-module/conftest.py +++ b/tests/core/eth-module/conftest.py @@ -1,4 +1,3 @@ -import json import pytest @@ -15,29 +14,3 @@ def extra_accounts(w3, account_password): w3.personal.new_account(account_password) return w3.eth.accounts - - -CONTRACT_CODE = b"606060405261022e806100126000396000f360606040523615610074576000357c01000000000000000000000000000000000000000000000000000000009004806316216f391461007657806361bc221a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d578063dcf537b11461014057610074565b005b610083600480505061016c565b6040518082815260200191505060405180910390f35b6100a6600480505061017f565b6040518082815260200191505060405180910390f35b6100d26004808035906020019091905050610188565b6040518082815260200191505060405180910390f35b61010760048080359060200190919080359060200190919050506101ea565b6040518082815260200191505060405180910390f35b61012a6004805050610201565b6040518082815260200191505060405180910390f35b6101566004808035906020019091905050610217565b6040518082815260200191505060405180910390f35b6000600d9050805080905061017c565b90565b60006000505481565b6000816000600082828250540192505081905550600060005054905080507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5816040518082815260200191505060405180910390a18090506101e5565b919050565b6000818301905080508090506101fb565b92915050565b600061020d6001610188565b9050610214565b90565b60006007820290508050809050610229565b91905056" # noqa: E501 - - -CONTRACT_RUNTIME = b"0x60606040523615610074576000357c01000000000000000000000000000000000000000000000000000000009004806316216f391461007657806361bc221a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d578063dcf537b11461014057610074565b005b610083600480505061016c565b6040518082815260200191505060405180910390f35b6100a6600480505061017f565b6040518082815260200191505060405180910390f35b6100d26004808035906020019091905050610188565b6040518082815260200191505060405180910390f35b61010760048080359060200190919080359060200190919050506101ea565b6040518082815260200191505060405180910390f35b61012a6004805050610201565b6040518082815260200191505060405180910390f35b6101566004808035906020019091905050610217565b6040518082815260200191505060405180910390f35b6000600d9050805080905061017c565b90565b60006000505481565b6000816000600082828250540192505081905550600060005054905080507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5816040518082815260200191505060405180910390a18090506101e5565b919050565b6000818301905080508090506101fb565b92915050565b600061020d6001610188565b9050610214565b90565b60006007820290508050809050610229565b91905056" # noqa: E501 - - -CONTRACT_ABI = json.loads( - '[{"constant":false,"inputs":[],"name":"return13","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[],"name":"counter","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"amt","type":"uint256"}],"name":"increment","outputs":[{"name":"result","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"},{"name":"b","type":"int256"}],"name":"add","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":false,"inputs":[],"name":"increment","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"}],"name":"multiply7","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"event"}]' # noqa: E501 -) - - -@pytest.fixture(scope="session") -def MATH_CODE(): - return CONTRACT_CODE - - -@pytest.fixture(scope="session") -def MATH_RUNTIME(): - return CONTRACT_RUNTIME - - -@pytest.fixture(scope="session") -def MATH_ABI(): - return CONTRACT_ABI diff --git a/tests/core/filtering/conftest.py b/tests/core/filtering/conftest.py index 58457e856c..a772126669 100644 --- a/tests/core/filtering/conftest.py +++ b/tests/core/filtering/conftest.py @@ -18,9 +18,9 @@ async_partial, ) from web3._utils.module_testing.emitter_contract import ( - CONTRACT_EMITTER_ABI, - CONTRACT_EMITTER_CODE, - CONTRACT_EMITTER_RUNTIME, + EMITTER_CONTRACT_ABI, + EMITTER_CONTRACT_BYTECODE, + EMITTER_CONTRACT_RUNTIME, ) @@ -35,31 +35,31 @@ def w3(request): @pytest.fixture() def EMITTER_CODE(): - return CONTRACT_EMITTER_CODE + return EMITTER_CONTRACT_BYTECODE @pytest.fixture() def EMITTER_RUNTIME(): - return CONTRACT_EMITTER_RUNTIME + return EMITTER_CONTRACT_RUNTIME @pytest.fixture() def EMITTER_ABI(): - return CONTRACT_EMITTER_ABI + return EMITTER_CONTRACT_ABI @pytest.fixture() -def EMITTER(EMITTER_CODE, EMITTER_RUNTIME, EMITTER_ABI): +def EMITTER(emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi): return { - "bytecode": EMITTER_CODE, - "bytecode_runtime": EMITTER_RUNTIME, - "abi": EMITTER_ABI, + "bytecode": emitter_contract_bytecode, + "bytecode_runtime": emitter_contract_runtime, + "abi": emitter_contract_abi, } @pytest.fixture() -def Emitter(w3, EMITTER): - return w3.eth.contract(**EMITTER) +def Emitter(w3, emitter_contract_kwargs): + return w3.eth.contract(**emitter_contract_kwargs) @pytest.fixture() @@ -175,8 +175,8 @@ def async_w3(request): @pytest.fixture() -def AsyncEmitter(async_w3, EMITTER): - return async_w3.eth.contract(**EMITTER) +def AsyncEmitter(async_w3, emitter_contract_kwargs): + return async_w3.eth.contract(**emitter_contract_kwargs) @pytest_asyncio.fixture() diff --git a/tests/core/filtering/test_contract_data_filters.py b/tests/core/filtering/test_contract_data_filters.py index 4ac35346a9..7375587d4f 100644 --- a/tests/core/filtering/test_contract_data_filters.py +++ b/tests/core/filtering/test_contract_data_filters.py @@ -19,33 +19,33 @@ _async_wait_for_transaction_fixture_logic, ) from web3._utils.module_testing.emitter_contract import ( - CONTRACT_EMITTER_ABI, - CONTRACT_EMITTER_CODE, - CONTRACT_EMITTER_RUNTIME, + EMITTER_CONTRACT_ABI, + EMITTER_CONTRACT_BYTECODE, + EMITTER_CONTRACT_RUNTIME, ) @pytest.fixture(scope="module") def EMITTER_CODE(): - return CONTRACT_EMITTER_CODE + return EMITTER_CONTRACT_BYTECODE @pytest.fixture(scope="module") def EMITTER_RUNTIME(): - return CONTRACT_EMITTER_RUNTIME + return EMITTER_CONTRACT_RUNTIME @pytest.fixture(scope="module") def EMITTER_ABI(): - return CONTRACT_EMITTER_ABI + return EMITTER_CONTRACT_ABI @pytest.fixture(scope="module") -def EMITTER(EMITTER_CODE, EMITTER_RUNTIME, EMITTER_ABI): +def EMITTER(emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi): return { - "bytecode": EMITTER_CODE, - "bytecode_runtime": EMITTER_RUNTIME, - "abi": EMITTER_ABI, + "bytecode": emitter_contract_bytecode, + "bytecode_runtime": emitter_contract_runtime, + "abi": emitter_contract_abi, } @@ -115,8 +115,8 @@ def w3(request): @pytest.fixture(scope="module") -def Emitter(w3, EMITTER): - return w3.eth.contract(**EMITTER) +def Emitter(w3, emitter_contract_kwargs): + return w3.eth.contract(**emitter_contract_kwargs) @pytest.fixture(scope="module") @@ -312,8 +312,8 @@ def async_w3(request): @pytest.fixture(scope="module") -def AsyncEmitter(async_w3, EMITTER): - return async_w3.eth.contract(**EMITTER) +def AsyncEmitter(async_w3, emitter_contract_kwargs): + return async_w3.eth.contract(**emitter_contract_kwargs) @pytest_asyncio.fixture(scope="module") diff --git a/tests/core/filtering/test_contract_topic_filters.py b/tests/core/filtering/test_contract_topic_filters.py index 9712978828..3f2f57d330 100644 --- a/tests/core/filtering/test_contract_topic_filters.py +++ b/tests/core/filtering/test_contract_topic_filters.py @@ -19,33 +19,33 @@ _async_wait_for_transaction_fixture_logic, ) from web3._utils.module_testing.emitter_contract import ( - CONTRACT_EMITTER_ABI, - CONTRACT_EMITTER_CODE, - CONTRACT_EMITTER_RUNTIME, + EMITTER_CONTRACT_ABI, + EMITTER_CONTRACT_BYTECODE, + EMITTER_CONTRACT_RUNTIME, ) @pytest.fixture(scope="module") def EMITTER_CODE(): - return CONTRACT_EMITTER_CODE + return EMITTER_CONTRACT_BYTECODE @pytest.fixture(scope="module") def EMITTER_RUNTIME(): - return CONTRACT_EMITTER_RUNTIME + return EMITTER_CONTRACT_RUNTIME @pytest.fixture(scope="module") def EMITTER_ABI(): - return CONTRACT_EMITTER_ABI + return EMITTER_CONTRACT_ABI @pytest.fixture(scope="module") -def EMITTER(EMITTER_CODE, EMITTER_RUNTIME, EMITTER_ABI): +def EMITTER(emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi): return { - "bytecode": EMITTER_CODE, - "bytecode_runtime": EMITTER_RUNTIME, - "abi": EMITTER_ABI, + "bytecode": emitter_contract_bytecode, + "bytecode_runtime": emitter_contract_runtime, + "abi": emitter_contract_abi, } @@ -115,8 +115,8 @@ def w3(request): @pytest.fixture(scope="module") -def Emitter(w3, EMITTER): - return w3.eth.contract(**EMITTER) +def Emitter(w3, emitter_contract_kwargs): + return w3.eth.contract(**emitter_contract_kwargs) @pytest.fixture(scope="module") diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index cddb026238..40cf489998 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -2,8 +2,8 @@ import pytest from web3._utils.module_testing.emitter_contract import ( - CONTRACT_EMITTER_ABI, - CONTRACT_EMITTER_CODE, + EMITTER_CONTRACT_ABI, + EMITTER_CONTRACT_BYTECODE, ) from web3._utils.module_testing.math_contract import ( MATH_ABI, @@ -65,7 +65,7 @@ def math_contract_factory(w3): @pytest.fixture(scope="module") def emitter_contract_factory(w3): contract_factory = w3.eth.contract( - abi=CONTRACT_EMITTER_ABI, bytecode=CONTRACT_EMITTER_CODE + abi=EMITTER_CONTRACT_ABI, bytecode=EMITTER_CONTRACT_BYTECODE ) return contract_factory diff --git a/tests/integration/generate_fixtures/go_ethereum.py b/tests/integration/generate_fixtures/go_ethereum.py index f1093422bd..1b23be6d43 100644 --- a/tests/integration/generate_fixtures/go_ethereum.py +++ b/tests/integration/generate_fixtures/go_ethereum.py @@ -24,8 +24,8 @@ import common from web3 import Web3 from web3._utils.module_testing.emitter_contract import ( - CONTRACT_EMITTER_ABI, - CONTRACT_EMITTER_CODE, + EMITTER_CONTRACT_ABI, + EMITTER_CONTRACT_BYTECODE, EMITTER_ENUM, ) from web3._utils.module_testing.math_contract import ( @@ -227,8 +227,8 @@ def setup_chain_state(w3): # Emitter Contract # emitter_contract_factory = w3.eth.contract( - abi=CONTRACT_EMITTER_ABI, - bytecode=CONTRACT_EMITTER_CODE, + abi=EMITTER_CONTRACT_ABI, + bytecode=EMITTER_CONTRACT_BYTECODE, ) emitter_deploy_receipt = common.deploy_contract( w3, "emitter", emitter_contract_factory diff --git a/web3/_utils/contract_sources/AddressReflector.sol b/web3/_utils/contract_sources/AddressReflector.sol new file mode 100644 index 0000000000..d4802a8eac --- /dev/null +++ b/web3/_utils/contract_sources/AddressReflector.sol @@ -0,0 +1,11 @@ +pragma solidity >=0.4.0; + +contract AddressReflector { + function reflect(address arg) public pure returns(address) { + return arg; + } + + function reflect(address[] memory arg) public pure returns(address[] memory) { + return arg; + } +} diff --git a/web3/_utils/contract_sources/BytesContracts.sol b/web3/_utils/contract_sources/BytesContracts.sol new file mode 100644 index 0000000000..c4735703c1 --- /dev/null +++ b/web3/_utils/contract_sources/BytesContracts.sol @@ -0,0 +1,43 @@ +pragma solidity >=0.7.0; + +contract BytesContract { + bytes const = hex"0123"; + bytes value; + + constructor (bytes memory _value) { + value = _value; + } + + function constValue() public view returns(bytes memory) { + return const; + } + + function getValue() public view returns(bytes memory) { + return value; + } + + function setValue(bytes memory _value) public { + value = _value; + } +} + +contract Bytes32Contract { + bytes32 const = hex"0123012301230123012301230123012301230123012301230123012301230123"; + bytes32 value; + + constructor (bytes32 _value) { + value = _value; + } + + function constValue() public view returns(bytes32) { + return const; + } + + function getValue() public view returns(bytes32) { + return value; + } + + function setValue(bytes32 _value) public { + value = _value; + } +} diff --git a/web3/_utils/contract_sources/ConstructorContracts.sol b/web3/_utils/contract_sources/ConstructorContracts.sol new file mode 100644 index 0000000000..1172aa822e --- /dev/null +++ b/web3/_utils/contract_sources/ConstructorContracts.sol @@ -0,0 +1,23 @@ +pragma solidity >=0.7.0; + +contract SimpleConstructor { + constructor() {} +} + +contract ConstructorWithArguments { + uint256 public data_a; + bytes32 public data_b; + + constructor(uint256 a, bytes32 b) { + data_a = a; + data_b = b; + } +} + +contract ConstructorWithAddressArgument { + address public testAddr; + + constructor(address _testAddr) { + testAddr = _testAddr; + } +} diff --git a/web3/_utils/contract_sources/Emitter.sol b/web3/_utils/contract_sources/Emitter.sol index d0558be2d8..621d35c3c1 100644 --- a/web3/_utils/contract_sources/Emitter.sol +++ b/web3/_utils/contract_sources/Emitter.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.11; +pragma solidity >=0.8.0; contract Emitter { diff --git a/web3/_utils/contract_sources/MathContract.sol b/web3/_utils/contract_sources/MathContract.sol new file mode 100644 index 0000000000..11c28deace --- /dev/null +++ b/web3/_utils/contract_sources/MathContract.sol @@ -0,0 +1,31 @@ +pragma solidity >=0.7.0; + +contract MathContract { + uint256 public counter = 0; + + event Increased(uint256 value); + + function incrementCounter() public payable returns(uint256 result) { + counter = counter + 1; + emit Increased(1); + return counter; + } + + function incrementCounter(uint256 amount) public payable returns(uint256 result) { + counter = counter + amount; + emit Increased(amount); + return counter; + } + + function return13() public returns(int256 result) { + return 13; + } + + function multiply7(int256 a) public payable returns(int256 result) { + return a * 7; + } + + function add(int256 a, int256 b) public payable returns(int256 result) { + return a + b; + } +} diff --git a/web3/_utils/contract_sources/StringContract.sol b/web3/_utils/contract_sources/StringContract.sol new file mode 100644 index 0000000000..0d54a96334 --- /dev/null +++ b/web3/_utils/contract_sources/StringContract.sol @@ -0,0 +1,22 @@ +pragma solidity >=0.7.0; + +contract StringContract { + string const = "never used"; + string value; + + constructor (string memory _value) { + value = _value; + } + + function constValue() public payable returns(string memory) { + return const; + } + + function getValue() public payable returns(string memory) { + return value; + } + + function setValue(string memory _value) public { + value = _value; + } +} diff --git a/web3/_utils/module_testing/emitter_contract.py b/web3/_utils/module_testing/emitter_contract.py index 5a33931e8a..e9cc4c0769 100644 --- a/web3/_utils/module_testing/emitter_contract.py +++ b/web3/_utils/module_testing/emitter_contract.py @@ -1,6 +1,6 @@ -CONTRACT_EMITTER_CODE = "608060405234801561001057600080fd5b50611757806100206000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea264697066735822122063a7112e511779f573f2441f6b2969827a2e6c29c105b6b3f6dbb1727d3078ac64736f6c63430008110033" # noqa: E501 -CONTRACT_EMITTER_RUNTIME = "608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea264697066735822122063a7112e511779f573f2441f6b2969827a2e6c29c105b6b3f6dbb1727d3078ac64736f6c63430008110033" # noqa: E501 -CONTRACT_EMITTER_ABI = [ +EMITTER_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50611757806100206000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea2646970667358221220ec88b319375caff81e8c1241afc561e6d7efd520711cb59b03a0a920b2656edc64736f6c63430008110033" # noqa: E501 +EMITTER_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea2646970667358221220ec88b319375caff81e8c1241afc561e6d7efd520711cb59b03a0a920b2656edc64736f6c63430008110033" # noqa: E501 +EMITTER_CONTRACT_ABI = [ { "anonymous": False, "inputs": [ diff --git a/web3/_utils/module_testing/eth_module.py b/web3/_utils/module_testing/eth_module.py index 69753adca6..34d97acb19 100644 --- a/web3/_utils/module_testing/eth_module.py +++ b/web3/_utils/module_testing/eth_module.py @@ -712,7 +712,7 @@ async def test_eth_get_code( @pytest.mark.asyncio async def test_eth_get_code_invalid_address( - self, async_w3: "Web3", math_contract: "Contract" + self, async_w3: "Web3", math_contract ) -> None: with pytest.raises(InvalidAddress): await async_w3.eth.get_code( # type: ignore @@ -739,7 +739,7 @@ async def test_eth_get_transaction_count( assert transaction_count >= 0 @pytest.mark.asyncio - async def test_eth_call(self, async_w3: "Web3", math_contract: "Contract") -> None: + async def test_eth_call(self, async_w3: "Web3", math_contract) -> None: coinbase = await async_w3.eth.coinbase # type: ignore txn_params = math_contract._prepare_transaction( fn_name="add", @@ -776,7 +776,7 @@ async def test_eth_call_with_override( @pytest.mark.asyncio async def test_eth_call_with_0_result( - self, async_w3: "Web3", math_contract: "Contract" + self, async_w3: "Web3", math_contract ) -> None: coinbase = await async_w3.eth.coinbase # type: ignore txn_params = math_contract._prepare_transaction( @@ -1779,9 +1779,7 @@ def test_eth_get_code_ens_address( assert isinstance(code, HexBytes) assert len(code) > 0 - def test_eth_get_code_invalid_address( - self, w3: "Web3", math_contract: "Contract" - ) -> None: + def test_eth_get_code_invalid_address(self, w3: "Web3", math_contract) -> None: with pytest.raises(InvalidAddress): w3.eth.get_code( ChecksumAddress(HexAddress(HexStr(math_contract.address.lower()))) @@ -2663,7 +2661,7 @@ def test_eth_send_raw_transaction( txn_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction) assert txn_hash == signed_tx.hash - def test_eth_call(self, w3: "Web3", math_contract: "Contract") -> None: + def test_eth_call(self, w3: "Web3", math_contract) -> None: coinbase = w3.eth.coinbase txn_params = math_contract._prepare_transaction( fn_name="add", @@ -2697,9 +2695,7 @@ def test_eth_call_with_override( (result,) = w3.codec.decode(["bool"], call_result) assert result is False - def test_eth_call_with_0_result( - self, w3: "Web3", math_contract: "Contract" - ) -> None: + def test_eth_call_with_0_result(self, w3: "Web3", math_contract) -> None: coinbase = w3.eth.coinbase txn_params = math_contract._prepare_transaction( fn_name="add", @@ -3394,7 +3390,7 @@ def test_eth_get_logs_with_logs_none_topic_args(self, w3: "Web3") -> None: assert len(result) == 0 def test_eth_call_old_contract_state( - self, w3: "Web3", math_contract: "Contract", unlocked_account: ChecksumAddress + self, w3: "Web3", math_contract, unlocked_account: ChecksumAddress ) -> None: start_block = w3.eth.get_block("latest") block_num = start_block["number"] diff --git a/web3/_utils/module_testing/event_contract.py b/web3/_utils/module_testing/event_contract.py index c3425abc69..2561574939 100644 --- a/web3/_utils/module_testing/event_contract.py +++ b/web3/_utils/module_testing/event_contract.py @@ -1,4 +1,4 @@ -EVNT_CONTRACT_CODE = ( +EVENT_CONTRACT_CODE = ( "6080604052348015600f57600080fd5b5061010b8061001f6000396000f30060806040526004361" "0603f576000357c0100000000000000000000000000000000000000000000000000000000900463" "ffffffff1680635818fad7146044575b600080fd5b348015604f57600080fd5b50606c600480360" @@ -10,7 +10,7 @@ ) -EVNT_CONTRACT_RUNTIME = ( +EVENT_CONTRACT_RUNTIME = ( "608060405260043610603f576000357c01000000000000000000000000000000000000000000000" "00000000000900463ffffffff1680635818fad7146044575b600080fd5b348015604f57600080fd" "5b50606c60048036038101908080359060200190929190505050606e565b005b7ff70fe689e290d" @@ -21,7 +21,7 @@ ) -EVNT_CONTRACT_ABI = [ +EVENT_CONTRACT_ABI = [ { "constant": False, "inputs": [{"name": "arg0", "type": "uint256"}], From c715b931014b93260ee98d61a42a1899c5ec5475 Mon Sep 17 00:00:00 2001 From: fselmo Date: Tue, 24 Jan 2023 13:47:02 -0700 Subject: [PATCH 2/5] Large test contracts refactor: - Create script to compile all test contracts at once, with the exception of the FixedReflector contract since no source can be found for it. - Re-organize all contracts as ``.sol`` files with defined Solidity contracts - move all to `web3/_utils/contract_sources`. - Refactor pytest fixtures with appropriate casing since a lot of these were being redefined. - Remove unnecessary pytest fixtures and import constants where appropriate, in an effort to reduce test times and make code more readable (one single source for a constant in most cases). - Run the new test contract compiler script for Solidity version 0.8.17. Integration tests: - Re-generate the fixture to account for new bytecodes for contracts. Fixed test errors: - Validating the ``value`` field for a transaction against the ``payable`` value in the abi needed one more check against the ``stateMutability`` value of ``nonpayable``. --- docs/web3.contract.rst | 24 +- setup.py | 2 +- tests/conftest.py | 80 + tests/core/contracts/conftest.py | 1317 +++-------------- .../test_contract_ambiguous_functions.py | 2 +- .../test_contract_build_transaction.py | 7 +- .../contracts/test_contract_call_interface.py | 199 ++- .../test_contract_caller_interface.py | 62 +- .../test_contract_class_construction.py | 14 +- .../contracts/test_contract_constructor.py | 161 +- .../test_contract_constructor_encoding.py | 8 +- .../contracts/test_contract_deployment.py | 73 +- .../test_contract_transact_interface.py | 26 +- .../contracts/test_extracting_event_data.py | 141 +- .../test_extracting_event_data_old.py | 37 +- tests/core/contracts/test_offchain_lookup.py | 63 +- tests/core/contracts/utils.py | 12 +- tests/core/filtering/conftest.py | 145 +- .../core/filtering/test_basic_filter_tests.py | 4 +- .../filtering/test_contract_data_filters.py | 62 +- .../core/filtering/test_contract_get_logs.py | 24 +- .../test_contract_on_event_filtering.py | 152 +- .../test_contract_past_event_filtering.py | 60 +- .../filtering/test_contract_topic_filters.py | 61 +- .../test_filter_against_transaction_logs.py | 10 +- .../test_filters_against_many_blocks.py | 20 +- tests/core/filtering/utils.py | 24 +- tests/integration/README.md | 6 +- tests/integration/conftest.py | 20 +- .../generate_fixtures/go_ethereum.py | 24 +- tests/integration/geth-1.10.25-fixture.zip | Bin 49936 -> 53604 bytes tests/integration/test_ethereum_tester.py | 6 +- .../contract_sources/ArraysContract.sol | 37 + .../contract_sources/ConstructorContracts.sol | 6 +- .../contract_sources/ContractCallerTester.sol | 21 + .../{Emitter.sol => EmitterContract.sol} | 3 +- .../contract_sources/EventContracts.sol | 21 + .../FallbackFunctionContract.sol | 8 + .../contract_sources/OffchainLookup.sol | 2 +- .../_utils/contract_sources/PayableTester.sol | 10 + .../ReceiveFunctionContracts.sol | 38 + ...ssReflector.sol => ReflectorContracts.sol} | 2 +- .../contract_sources/RevertContract.sol | 15 + .../contract_sources/StringContract.sol | 18 +- .../contract_sources/TupleContracts.sol | 20 + web3/_utils/contract_sources/__init__.py | 0 .../contract_sources/compile_contracts.py | 123 ++ .../contract_data/__init__.py | 0 .../contract_data/_custom_contract_data.py | 21 + .../contract_data/address_reflector.py | 29 + .../contract_data/arrays_contract.py | 97 ++ .../contract_data/bytes_contracts.py | 79 + .../contract_data/constructor_contracts.py | 74 + .../contract_data/contract_caller_tester.py | 59 + .../contract_data}/emitter_contract.py | 48 +- .../contract_data/event_contracts.py | 93 ++ .../contract_data/extended_resolver.py | 90 ++ .../fallback_function_contract.py | 24 + .../contract_data/math_contract.py | 73 + .../contract_data/offchain_lookup.py | 52 + .../contract_data/offchain_resolver.py | 100 ++ .../contract_data/payable_tester.py | 29 + .../receive_function_contracts.py | 58 + .../contract_data/reflector_contracts.py | 29 + .../contract_data/revert_contract.py | 36 + .../contract_data/simple_resolver.py | 29 + .../contract_data/string_contract.py | 42 + .../contract_data/tuple_contracts.py | 153 ++ web3/_utils/contracts.py | 7 +- web3/_utils/module_testing/eth_module.py | 22 +- web3/_utils/module_testing/event_contract.py | 46 - .../module_testing/fallback_contract.py | 14 - .../module_testing/indexed_event_contract.py | 46 - web3/_utils/module_testing/math_contract.py | 192 --- .../module_testing/no_receive_contract.py | 69 - .../offchain_lookup_contract.py | 106 -- .../_utils/module_testing/receive_contract.py | 76 - web3/_utils/module_testing/revert_contract.py | 61 - 78 files changed, 2516 insertions(+), 2508 deletions(-) create mode 100644 web3/_utils/contract_sources/ArraysContract.sol create mode 100644 web3/_utils/contract_sources/ContractCallerTester.sol rename web3/_utils/contract_sources/{Emitter.sol => EmitterContract.sol} (99%) create mode 100644 web3/_utils/contract_sources/EventContracts.sol create mode 100644 web3/_utils/contract_sources/FallbackFunctionContract.sol create mode 100644 web3/_utils/contract_sources/PayableTester.sol create mode 100644 web3/_utils/contract_sources/ReceiveFunctionContracts.sol rename web3/_utils/contract_sources/{AddressReflector.sol => ReflectorContracts.sol} (86%) create mode 100644 web3/_utils/contract_sources/RevertContract.sol create mode 100644 web3/_utils/contract_sources/TupleContracts.sol create mode 100644 web3/_utils/contract_sources/__init__.py create mode 100644 web3/_utils/contract_sources/compile_contracts.py create mode 100644 web3/_utils/contract_sources/contract_data/__init__.py create mode 100644 web3/_utils/contract_sources/contract_data/_custom_contract_data.py create mode 100644 web3/_utils/contract_sources/contract_data/address_reflector.py create mode 100644 web3/_utils/contract_sources/contract_data/arrays_contract.py create mode 100644 web3/_utils/contract_sources/contract_data/bytes_contracts.py create mode 100644 web3/_utils/contract_sources/contract_data/constructor_contracts.py create mode 100644 web3/_utils/contract_sources/contract_data/contract_caller_tester.py rename web3/_utils/{module_testing => contract_sources/contract_data}/emitter_contract.py (96%) create mode 100644 web3/_utils/contract_sources/contract_data/event_contracts.py create mode 100644 web3/_utils/contract_sources/contract_data/extended_resolver.py create mode 100644 web3/_utils/contract_sources/contract_data/fallback_function_contract.py create mode 100644 web3/_utils/contract_sources/contract_data/math_contract.py create mode 100644 web3/_utils/contract_sources/contract_data/offchain_lookup.py create mode 100644 web3/_utils/contract_sources/contract_data/offchain_resolver.py create mode 100644 web3/_utils/contract_sources/contract_data/payable_tester.py create mode 100644 web3/_utils/contract_sources/contract_data/receive_function_contracts.py create mode 100644 web3/_utils/contract_sources/contract_data/reflector_contracts.py create mode 100644 web3/_utils/contract_sources/contract_data/revert_contract.py create mode 100644 web3/_utils/contract_sources/contract_data/simple_resolver.py create mode 100644 web3/_utils/contract_sources/contract_data/string_contract.py create mode 100644 web3/_utils/contract_sources/contract_data/tuple_contracts.py delete mode 100644 web3/_utils/module_testing/event_contract.py delete mode 100644 web3/_utils/module_testing/fallback_contract.py delete mode 100644 web3/_utils/module_testing/indexed_event_contract.py delete mode 100644 web3/_utils/module_testing/math_contract.py delete mode 100644 web3/_utils/module_testing/no_receive_contract.py delete mode 100644 web3/_utils/module_testing/offchain_lookup_contract.py delete mode 100644 web3/_utils/module_testing/receive_contract.py delete mode 100644 web3/_utils/module_testing/revert_contract.py diff --git a/docs/web3.contract.rst b/docs/web3.contract.rst index 3e23a79523..bd08aa8edb 100644 --- a/docs/web3.contract.rst +++ b/docs/web3.contract.rst @@ -610,51 +610,51 @@ Taking the following contract code as an example: .. doctest:: arrayscontract - >>> ArraysContract = w3.eth.contract(abi=abi, bytecode=bytecode) + >>> arrays_contract_instance = w3.eth.contract(abi=abi, bytecode=bytecode) - >>> tx_hash = ArraysContract.constructor([b'bb']).transact() + >>> tx_hash = arrays_contract_instance.constructor([b'bb']).transact() >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) - >>> array_contract = w3.eth.contract( + >>> arrays_contract = w3.eth.contract( ... address=tx_receipt.contractAddress, ... abi=abi ... ) - >>> array_contract.functions.getBytes2Value().call() + >>> arrays_contract.functions.getBytes2Value().call() [b'bb'] >>> # set value with appropriate byte size - >>> array_contract.functions.setBytes2Value([b'aa']).transact({'gas': 420000, "maxPriorityFeePerGas": 10 ** 9, "maxFeePerGas": 10 ** 9}) + >>> arrays_contract.functions.setBytes2Value([b'aa']).transact({'gas': 420000, "maxPriorityFeePerGas": 10 ** 9, "maxFeePerGas": 10 ** 9}) HexBytes('0xcb95151142ea56dbf2753d70388aef202a7bb5a1e323d448bc19f1d2e1fe3dc9') >>> # check value - >>> array_contract.functions.getBytes2Value().call() + >>> arrays_contract.functions.getBytes2Value().call() [b'aa'] >>> # trying to set value without appropriate size (bytes2) is not valid - >>> array_contract.functions.setBytes2Value([b'b']).transact() + >>> arrays_contract.functions.setBytes2Value([b'b']).transact() Traceback (most recent call last): ... web3.exceptions.Web3ValidationError: Could not identify the intended function with name >>> # check value is still b'aa' - >>> array_contract.functions.getBytes2Value().call() + >>> arrays_contract.functions.getBytes2Value().call() [b'aa'] >>> # disabling strict byte checking... >>> w3.strict_bytes_type_checking = False - >>> tx_hash = ArraysContract.constructor([b'b']).transact() + >>> tx_hash = arrays_contract_instance.constructor([b'b']).transact() >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) - >>> array_contract = w3.eth.contract( + >>> arrays_contract = w3.eth.contract( ... address=tx_receipt.contractAddress, ... abi=abi ... ) >>> # check value is zero-padded... i.e. b'b\x00' - >>> array_contract.functions.getBytes2Value().call() + >>> arrays_contract.functions.getBytes2Value().call() [b'b\x00'] >>> # set the flag back to True >>> w3.strict_bytes_type_checking = True - >>> array_contract.functions.setBytes2Value([b'a']).transact() + >>> arrays_contract.functions.setBytes2Value([b'a']).transact() Traceback (most recent call last): ... web3.exceptions.Web3ValidationError: diff --git a/setup.py b/setup.py index ad1472e22b..138bbe7210 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ "configparser==3.5.0", "contextlib2>=0.5.4", "py-geth>=3.9.1", - "py-solc>=0.4.0", + "py-solc-x>=1.1.1", "pytest>=6.2.5", "sphinx>=4.2.0", "sphinx_rtd_theme>=0.5.2", diff --git a/tests/conftest.py b/tests/conftest.py index cbd85933b9..b549100e82 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,12 +1,17 @@ import pytest from eth_utils import ( + event_signature_to_log_topic, to_bytes, ) from eth_utils.toolz import ( identity, ) +from web3._utils.contract_sources.contract_data.emitter_contract import ( + EMITTER_CONTRACT_DATA, +) + from .utils import ( get_open_port, ) @@ -24,3 +29,78 @@ def open_port(): def pytest_addoption(parser): parser.addoption("--flaky", action="store_true") + + +# --- session-scoped constants --- # + + +@pytest.fixture(scope="session") +def emitter_contract_data(): + return EMITTER_CONTRACT_DATA + + +class LogFunctions: + LogAnonymous = 0 + LogNoArguments = 1 + LogSingleArg = 2 + LogDoubleArg = 3 + LogTripleArg = 4 + LogQuadrupleArg = 5 + LogSingleAnonymous = 6 + LogSingleWithIndex = 7 + LogDoubleAnonymous = 8 + LogDoubleWithIndex = 9 + LogTripleWithIndex = 10 + LogQuadrupleWithIndex = 11 + LogBytes = 12 + LogString = 13 + LogDynamicArgs = 14 + LogListArgs = 15 + LogAddressIndexed = 16 + LogAddressNotIndexed = 17 + + +@pytest.fixture(scope="session") +def emitter_contract_event_ids(): + return LogFunctions + + +class LogTopics: + LogAnonymous = event_signature_to_log_topic("LogAnonymous()") + LogNoArguments = event_signature_to_log_topic("LogNoArguments()") + LogSingleArg = event_signature_to_log_topic("LogSingleArg(uint256)") + LogSingleAnonymous = event_signature_to_log_topic("LogSingleAnonymous(uint256)") + LogSingleWithIndex = event_signature_to_log_topic("LogSingleWithIndex(uint256)") + LogDoubleArg = event_signature_to_log_topic("LogDoubleArg(uint256,uint256)") + LogDoubleAnonymous = event_signature_to_log_topic( + "LogDoubleAnonymous(uint256,uint256)" + ) + LogDoubleWithIndex = event_signature_to_log_topic( + "LogDoubleWithIndex(uint256,uint256)" + ) + LogTripleArg = event_signature_to_log_topic("LogTripleArg(uint256,uint256,uint256)") + LogTripleWithIndex = event_signature_to_log_topic( + "LogTripleWithIndex(uint256,uint256,uint256)" + ) + LogQuadrupleArg = event_signature_to_log_topic( + "LogQuadrupleArg(uint256,uint256,uint256,uint256)" + ) + LogQuadrupleWithIndex = event_signature_to_log_topic( + "LogQuadrupleWithIndex(uint256,uint256,uint256,uint256)", + ) + LogBytes = event_signature_to_log_topic("LogBytes(bytes)") + LogString = event_signature_to_log_topic("LogString(string)") + LogDynamicArgs = event_signature_to_log_topic("LogDynamicArgs(string,string)") + LogListArgs = event_signature_to_log_topic("LogListArgs(bytes2[],bytes2[])") + LogAddressIndexed = event_signature_to_log_topic( + "LogAddressIndexed(address,address)" + ) + LogAddressNotIndexed = event_signature_to_log_topic( + "LogAddressNotIndexed(address,address)" + ) + LogStructArgs = event_signature_to_log_topic("LogStructArgs(uint256,tuple)") + + +@pytest.fixture(scope="session") +def emitter_contract_log_topics(): + return LogTopics diff --git a/tests/core/contracts/conftest.py b/tests/core/contracts/conftest.py index c7d0745b18..f1c4fbe8c8 100644 --- a/tests/core/contracts/conftest.py +++ b/tests/core/contracts/conftest.py @@ -1,10 +1,6 @@ import functools -import json import pytest -from eth_utils import ( - event_signature_to_log_topic, -) import pytest_asyncio from tests.core.contracts.utils import ( @@ -14,153 +10,51 @@ from tests.utils import ( async_partial, ) -from web3._utils.module_testing.emitter_contract import ( - EMITTER_CONTRACT_ABI, - EMITTER_CONTRACT_BYTECODE, - EMITTER_CONTRACT_RUNTIME, +from web3._utils.contract_sources.contract_data.arrays_contract import ( + ARRAYS_CONTRACT_DATA, ) -from web3._utils.module_testing.event_contract import ( - EVENT_CONTRACT_ABI, - EVENT_CONTRACT_CODE, - EVENT_CONTRACT_RUNTIME, +from web3._utils.contract_sources.contract_data.constructor_contracts import ( + CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA, + CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA, + SIMPLE_CONSTRUCTOR_CONTRACT_DATA, ) -from web3._utils.module_testing.fallback_contract import ( - CONTRACT_FALLBACK_FUNCTION_ABI, - CONTRACT_FALLBACK_FUNCTION_CODE, - CONTRACT_FALLBACK_FUNCTION_RUNTIME, +from web3._utils.contract_sources.contract_data.contract_caller_tester import ( + CONTRACT_CALLER_TESTER_DATA, ) -from web3._utils.module_testing.indexed_event_contract import ( - IND_EVENT_CONTRACT_ABI, - IND_EVENT_CONTRACT_CODE, - IND_EVENT_CONTRACT_RUNTIME, +from web3._utils.contract_sources.contract_data.event_contracts import ( + EVENT_CONTRACT_DATA, + INDEXED_EVENT_CONTRACT_DATA, ) -from web3._utils.module_testing.no_receive_contract import ( - CONTRACT_NO_RECEIVE_FUNCTION_ABI, - CONTRACT_NO_RECEIVE_FUNCTION_CODE, - CONTRACT_NO_RECEIVE_FUNCTION_RUNTIME, +from web3._utils.contract_sources.contract_data.fallback_function_contract import ( + FALLBACK_FUNCTION_CONTRACT_DATA, ) -from web3._utils.module_testing.receive_contract import ( - CONTRACT_RECEIVE_FUNCTION_ABI, - CONTRACT_RECEIVE_FUNCTION_CODE, - CONTRACT_RECEIVE_FUNCTION_RUNTIME, +from web3._utils.contract_sources.contract_data.math_contract import ( + MATH_CONTRACT_ABI, + MATH_CONTRACT_BYTECODE, + MATH_CONTRACT_DATA, + MATH_CONTRACT_RUNTIME, ) -from web3._utils.module_testing.revert_contract import ( - _REVERT_CONTRACT_ABI, - REVERT_CONTRACT_BYTECODE, - REVERT_CONTRACT_RUNTIME_CODE, +from web3._utils.contract_sources.contract_data.payable_tester import ( + PAYABLE_TESTER_CONTRACT_DATA, ) - -CONTRACT_NESTED_TUPLE_SOURCE = """ -pragma solidity >=0.4.19 <0.6.0; -pragma experimental ABIEncoderV2; - -contract Tuple { - struct U { int x; int y; } - struct T { U[] u; } - struct S { T[] t; } - - function method(S memory s) public pure returns (S memory) { - return s; - } -} -""" -CONTRACT_NESTED_TUPLE_CODE = "0x608060405234801561001057600080fd5b50610575806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632655aef114610046575b600080fd5b34801561005257600080fd5b5061006d600480360361006891908101906102a2565b610083565b60405161007a919061043e565b60405180910390f35b61008b610093565b819050919050565b602060405190810160405280606081525090565b600082601f83011215156100ba57600080fd5b81356100cd6100c88261048d565b610460565b9150818183526020840193506020810190508360005b8381101561011357813586016100f98882610206565b8452602084019350602083019250506001810190506100e3565b5050505092915050565b600082601f830112151561013057600080fd5b813561014361013e826104b5565b610460565b9150818183526020840193506020810190508385604084028201111561016857600080fd5b60005b83811015610198578161017e8882610256565b84526020840193506040830192505060018101905061016b565b5050505092915050565b60006101ae8235610531565b905092915050565b6000602082840312156101c857600080fd5b6101d26020610460565b9050600082013567ffffffffffffffff8111156101ee57600080fd5b6101fa848285016100a7565b60008301525092915050565b60006020828403121561021857600080fd5b6102226020610460565b9050600082013567ffffffffffffffff81111561023e57600080fd5b61024a8482850161011d565b60008301525092915050565b60006040828403121561026857600080fd5b6102726040610460565b90506000610282848285016101a2565b6000830152506020610296848285016101a2565b60208301525092915050565b6000602082840312156102b457600080fd5b600082013567ffffffffffffffff8111156102ce57600080fd5b6102da848285016101b6565b91505092915050565b60006102ee826104f7565b80845260208401935083602082028501610307856104dd565b60005b848110156103405783830388526103228383516103e5565b925061032d8261050d565b915060208801975060018101905061030a565b508196508694505050505092915050565b600061035c82610502565b80845260208401935061036e836104ea565b60005b828110156103a05761038486835161040f565b61038d8261051a565b9150604086019550600181019050610371565b50849250505092915050565b6103b581610527565b82525050565b600060208301600083015184820360008601526103d882826102e3565b9150508091505092915050565b600060208301600083015184820360008601526104028282610351565b9150508091505092915050565b60408201600082015161042560008501826103ac565b50602082015161043860208501826103ac565b50505050565b6000602082019050818103600083015261045881846103bb565b905092915050565b6000604051905081810181811067ffffffffffffffff8211171561048357600080fd5b8060405250919050565b600067ffffffffffffffff8211156104a457600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156104cc57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000819050919050565b60008190509190505600a265627a7a7230582011dc176b6cffda1d2e58827bca1a16178776c2d8efcd6adf48bc0223f14f891a6c6578706572696d656e74616cf50037" # noqa: E501 -CONTRACT_NESTED_TUPLE_RUNTIME = "0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632655aef114610046575b600080fd5b34801561005257600080fd5b5061006d600480360361006891908101906102a2565b610083565b60405161007a919061043e565b60405180910390f35b61008b610093565b819050919050565b602060405190810160405280606081525090565b600082601f83011215156100ba57600080fd5b81356100cd6100c88261048d565b610460565b9150818183526020840193506020810190508360005b8381101561011357813586016100f98882610206565b8452602084019350602083019250506001810190506100e3565b5050505092915050565b600082601f830112151561013057600080fd5b813561014361013e826104b5565b610460565b9150818183526020840193506020810190508385604084028201111561016857600080fd5b60005b83811015610198578161017e8882610256565b84526020840193506040830192505060018101905061016b565b5050505092915050565b60006101ae8235610531565b905092915050565b6000602082840312156101c857600080fd5b6101d26020610460565b9050600082013567ffffffffffffffff8111156101ee57600080fd5b6101fa848285016100a7565b60008301525092915050565b60006020828403121561021857600080fd5b6102226020610460565b9050600082013567ffffffffffffffff81111561023e57600080fd5b61024a8482850161011d565b60008301525092915050565b60006040828403121561026857600080fd5b6102726040610460565b90506000610282848285016101a2565b6000830152506020610296848285016101a2565b60208301525092915050565b6000602082840312156102b457600080fd5b600082013567ffffffffffffffff8111156102ce57600080fd5b6102da848285016101b6565b91505092915050565b60006102ee826104f7565b80845260208401935083602082028501610307856104dd565b60005b848110156103405783830388526103228383516103e5565b925061032d8261050d565b915060208801975060018101905061030a565b508196508694505050505092915050565b600061035c82610502565b80845260208401935061036e836104ea565b60005b828110156103a05761038486835161040f565b61038d8261051a565b9150604086019550600181019050610371565b50849250505092915050565b6103b581610527565b82525050565b600060208301600083015184820360008601526103d882826102e3565b9150508091505092915050565b600060208301600083015184820360008601526104028282610351565b9150508091505092915050565b60408201600082015161042560008501826103ac565b50602082015161043860208501826103ac565b50505050565b6000602082019050818103600083015261045881846103bb565b905092915050565b6000604051905081810181811067ffffffffffffffff8211171561048357600080fd5b8060405250919050565b600067ffffffffffffffff8211156104a457600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156104cc57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000819050919050565b60008190509190505600a265627a7a7230582011dc176b6cffda1d2e58827bca1a16178776c2d8efcd6adf48bc0223f14f891a6c6578706572696d656e74616cf50037" # noqa: E501 -CONTRACT_NESTED_TUPLE_ABI = json.loads( - '[{"constant":true,"inputs":[{"components":[{"components":[{"components":[{"name":"x","type":"int256"},{"name":"y","type":"int256"}],"name":"u","type":"tuple[]"}],"name":"t","type":"tuple[]"}],"name":"s","type":"tuple"}],"name":"method","outputs":[{"components":[{"components":[{"components":[{"name":"x","type":"int256"},{"name":"y","type":"int256"}],"name":"u","type":"tuple[]"}],"name":"t","type":"tuple[]"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"pure","type":"function"}]' # noqa: E501 +from web3._utils.contract_sources.contract_data.receive_function_contracts import ( + NO_RECEIVE_FUNCTION_CONTRACT_DATA, + RECEIVE_FUNCTION_CONTRACT_DATA, ) - - -@pytest.fixture() -def NESTED_TUPLE_CODE(): - return CONTRACT_NESTED_TUPLE_CODE - - -@pytest.fixture() -def NESTED_TUPLE_RUNTIME(): - return CONTRACT_NESTED_TUPLE_RUNTIME - - -@pytest.fixture() -def NESTED_TUPLE_ABI(): - return CONTRACT_NESTED_TUPLE_ABI - - -@pytest.fixture() -def NESTED_TUPLE_CONTRACT(NESTED_TUPLE_CODE, NESTED_TUPLE_RUNTIME, NESTED_TUPLE_ABI): - return { - "bytecode": NESTED_TUPLE_CODE, - "bytecode_runtime": NESTED_TUPLE_RUNTIME, - "abi": NESTED_TUPLE_ABI, - } - - -@pytest.fixture() -def NestedTupleContract(w3, NESTED_TUPLE_CONTRACT): - return w3.eth.contract(**NESTED_TUPLE_CONTRACT) - - -CONTRACT_TUPLE_SOURCE = """ -pragma solidity >=0.4.19 <0.6.0; -pragma experimental ABIEncoderV2; - -contract Tuple { - struct T { int x; bool[2] y; address[] z; } - struct S { uint a; uint[] b; T[] c; } - - function method(S memory s) public pure returns (S memory) { - return s; - } -} -""" -CONTRACT_TUPLE_CODE = "0x608060405234801561001057600080fd5b506108ca806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638e1ae3c714610046575b600080fd5b34801561005257600080fd5b5061006d60048036036100689190810190610403565b610083565b60405161007a9190610696565b60405180910390f35b61008b610093565b819050919050565b6060604051908101604052806000815260200160608152602001606081525090565b60006100c18235610850565b905092915050565b600082601f83011215156100dc57600080fd5b81356100ef6100ea826106e5565b6106b8565b9150818183526020840193506020810190508385602084028201111561011457600080fd5b60005b83811015610144578161012a88826100b5565b845260208401935060208301925050600181019050610117565b5050505092915050565b600082601f830112151561016157600080fd5b600261017461016f8261070d565b6106b8565b9150818385602084028201111561018a57600080fd5b60005b838110156101ba57816101a088826102bf565b84526020840193506020830192505060018101905061018d565b5050505092915050565b600082601f83011215156101d757600080fd5b81356101ea6101e58261072f565b6106b8565b9150818183526020840193506020810190508360005b8381101561023057813586016102168882610377565b845260208401935060208301925050600181019050610200565b5050505092915050565b600082601f830112151561024d57600080fd5b813561026061025b82610757565b6106b8565b9150818183526020840193506020810190508385602084028201111561028557600080fd5b60005b838110156102b5578161029b88826103ef565b845260208401935060208301925050600181019050610288565b5050505092915050565b60006102cb8235610870565b905092915050565b60006102df823561087c565b905092915050565b6000606082840312156102f957600080fd5b61030360606106b8565b90506000610313848285016103ef565b600083015250602082013567ffffffffffffffff81111561033357600080fd5b61033f8482850161023a565b602083015250604082013567ffffffffffffffff81111561035f57600080fd5b61036b848285016101c4565b60408301525092915050565b60006080828403121561038957600080fd5b61039360606106b8565b905060006103a3848285016102d3565b60008301525060206103b78482850161014e565b602083015250606082013567ffffffffffffffff8111156103d757600080fd5b6103e3848285016100c9565b60408301525092915050565b60006103fb8235610886565b905092915050565b60006020828403121561041557600080fd5b600082013567ffffffffffffffff81111561042f57600080fd5b61043b848285016102e7565b91505092915050565b61044d81610810565b82525050565b600061045e826107b0565b8084526020840193506104708361077f565b60005b828110156104a257610486868351610444565b61048f826107dc565b9150602086019550600181019050610473565b50849250505092915050565b6104b7816107bb565b6104c08261078c565b60005b828110156104f2576104d68583516105c2565b6104df826107e9565b91506020850194506001810190506104c3565b5050505050565b6000610504826107c6565b8084526020840193508360208202850161051d85610796565b60005b84811015610556578383038852610538838351610637565b9250610543826107f6565b9150602088019750600181019050610520565b508196508694505050505092915050565b6000610572826107d1565b808452602084019350610584836107a3565b60005b828110156105b65761059a868351610687565b6105a382610803565b9150602086019550600181019050610587565b50849250505092915050565b6105cb81610830565b82525050565b6105da8161083c565b82525050565b60006060830160008301516105f86000860182610687565b50602083015184820360208601526106108282610567565b9150506040830151848203604086015261062a82826104f9565b9150508091505092915050565b600060808301600083015161064f60008601826105d1565b50602083015161066260208601826104ae565b506040830151848203606086015261067a8282610453565b9150508091505092915050565b61069081610846565b82525050565b600060208201905081810360008301526106b081846105e0565b905092915050565b6000604051905081810181811067ffffffffffffffff821117156106db57600080fd5b8060405250919050565b600067ffffffffffffffff8211156106fc57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561072457600080fd5b602082029050919050565b600067ffffffffffffffff82111561074657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561076e57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000819050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600060029050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b6000819050919050565b60008190509190505600a265627a7a72305820fb4abae14c4bcd2cd8a12f35862cb09a2e0f9004eb5fdbfdb76658a753570c8c6c6578706572696d656e74616cf50037" # noqa: E501 -CONTRACT_TUPLE_RUNTIME = "0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638e1ae3c714610046575b600080fd5b34801561005257600080fd5b5061006d60048036036100689190810190610403565b610083565b60405161007a9190610696565b60405180910390f35b61008b610093565b819050919050565b6060604051908101604052806000815260200160608152602001606081525090565b60006100c18235610850565b905092915050565b600082601f83011215156100dc57600080fd5b81356100ef6100ea826106e5565b6106b8565b9150818183526020840193506020810190508385602084028201111561011457600080fd5b60005b83811015610144578161012a88826100b5565b845260208401935060208301925050600181019050610117565b5050505092915050565b600082601f830112151561016157600080fd5b600261017461016f8261070d565b6106b8565b9150818385602084028201111561018a57600080fd5b60005b838110156101ba57816101a088826102bf565b84526020840193506020830192505060018101905061018d565b5050505092915050565b600082601f83011215156101d757600080fd5b81356101ea6101e58261072f565b6106b8565b9150818183526020840193506020810190508360005b8381101561023057813586016102168882610377565b845260208401935060208301925050600181019050610200565b5050505092915050565b600082601f830112151561024d57600080fd5b813561026061025b82610757565b6106b8565b9150818183526020840193506020810190508385602084028201111561028557600080fd5b60005b838110156102b5578161029b88826103ef565b845260208401935060208301925050600181019050610288565b5050505092915050565b60006102cb8235610870565b905092915050565b60006102df823561087c565b905092915050565b6000606082840312156102f957600080fd5b61030360606106b8565b90506000610313848285016103ef565b600083015250602082013567ffffffffffffffff81111561033357600080fd5b61033f8482850161023a565b602083015250604082013567ffffffffffffffff81111561035f57600080fd5b61036b848285016101c4565b60408301525092915050565b60006080828403121561038957600080fd5b61039360606106b8565b905060006103a3848285016102d3565b60008301525060206103b78482850161014e565b602083015250606082013567ffffffffffffffff8111156103d757600080fd5b6103e3848285016100c9565b60408301525092915050565b60006103fb8235610886565b905092915050565b60006020828403121561041557600080fd5b600082013567ffffffffffffffff81111561042f57600080fd5b61043b848285016102e7565b91505092915050565b61044d81610810565b82525050565b600061045e826107b0565b8084526020840193506104708361077f565b60005b828110156104a257610486868351610444565b61048f826107dc565b9150602086019550600181019050610473565b50849250505092915050565b6104b7816107bb565b6104c08261078c565b60005b828110156104f2576104d68583516105c2565b6104df826107e9565b91506020850194506001810190506104c3565b5050505050565b6000610504826107c6565b8084526020840193508360208202850161051d85610796565b60005b84811015610556578383038852610538838351610637565b9250610543826107f6565b9150602088019750600181019050610520565b508196508694505050505092915050565b6000610572826107d1565b808452602084019350610584836107a3565b60005b828110156105b65761059a868351610687565b6105a382610803565b9150602086019550600181019050610587565b50849250505092915050565b6105cb81610830565b82525050565b6105da8161083c565b82525050565b60006060830160008301516105f86000860182610687565b50602083015184820360208601526106108282610567565b9150506040830151848203604086015261062a82826104f9565b9150508091505092915050565b600060808301600083015161064f60008601826105d1565b50602083015161066260208601826104ae565b506040830151848203606086015261067a8282610453565b9150508091505092915050565b61069081610846565b82525050565b600060208201905081810360008301526106b081846105e0565b905092915050565b6000604051905081810181811067ffffffffffffffff821117156106db57600080fd5b8060405250919050565b600067ffffffffffffffff8211156106fc57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561072457600080fd5b602082029050919050565b600067ffffffffffffffff82111561074657600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561076e57600080fd5b602082029050602081019050919050565b6000602082019050919050565b6000819050919050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600060029050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b6000819050919050565b60008190509190505600a265627a7a72305820fb4abae14c4bcd2cd8a12f35862cb09a2e0f9004eb5fdbfdb76658a753570c8c6c6578706572696d656e74616cf50037" # noqa: E501 -CONTRACT_TUPLE_ABI = json.loads( - '[{"constant":true,"inputs":[{"components":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256[]"},{"components":[{"name":"x","type":"int256"},{"name":"y","type":"bool[2]"},{"name":"z","type":"address[]"}],"name":"c","type":"tuple[]"}],"name":"s","type":"tuple"}],"name":"method","outputs":[{"components":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256[]"},{"components":[{"name":"x","type":"int256"},{"name":"y","type":"bool[2]"},{"name":"z","type":"address[]"}],"name":"c","type":"tuple[]"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"pure","type":"function"}]' # noqa: E501 +from web3._utils.contract_sources.contract_data.reflector_contracts import ( + ADDRESS_REFLECTOR_CONTRACT_DATA, ) - - -@pytest.fixture() -def TUPLE_CODE(): - return CONTRACT_TUPLE_CODE - - -@pytest.fixture() -def TUPLE_RUNTIME(): - return CONTRACT_TUPLE_RUNTIME - - -@pytest.fixture() -def TUPLE_ABI(): - return CONTRACT_TUPLE_ABI - - -@pytest.fixture() -def TUPLE_CONTRACT(TUPLE_CODE, TUPLE_RUNTIME, TUPLE_ABI): - return { - "bytecode": TUPLE_CODE, - "bytecode_runtime": TUPLE_RUNTIME, - "abi": TUPLE_ABI, - } - - -@pytest.fixture() -def TupleContract(w3, TUPLE_CONTRACT): - return w3.eth.contract(**TUPLE_CONTRACT) - - -# source: web3/_utils/contract_sources/MathContract.sol -# compiled with Solidity 0.8.17 -MATH_CONTRACT_CODE = "0x60806040526000805534801561001457600080fd5b5061055b806100246000396000f3fe6080604052600436106100555760003560e01c806316216f391461005a5780635b34b9661461008557806361bc221a146100a35780636abbb3b4146100ce578063a5f3c23b146100fe578063dcf537b11461012e575b600080fd5b34801561006657600080fd5b5061006f61015e565b60405161007c9190610260565b60405180910390f35b61008d610167565b60405161009a9190610294565b60405180910390f35b3480156100af57600080fd5b506100b86101be565b6040516100c59190610294565b60405180910390f35b6100e860048036038101906100e391906102e0565b6101c4565b6040516100f59190610294565b60405180910390f35b61011860048036038101906101139190610339565b61021b565b6040516101259190610260565b60405180910390f35b61014860048036038101906101439190610379565b610231565b6040516101559190610260565b60405180910390f35b6000600d905090565b6000600160005461017891906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c560016040516101ae919061044e565b60405180910390a1600054905090565b60005481565b6000816000546101d491906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5826040516102099190610294565b60405180910390a16000549050919050565b600081836102299190610469565b905092915050565b600060078261024091906104ad565b9050919050565b6000819050919050565b61025a81610247565b82525050565b60006020820190506102756000830184610251565b92915050565b6000819050919050565b61028e8161027b565b82525050565b60006020820190506102a96000830184610285565b92915050565b600080fd5b6102bd8161027b565b81146102c857600080fd5b50565b6000813590506102da816102b4565b92915050565b6000602082840312156102f6576102f56102af565b5b6000610304848285016102cb565b91505092915050565b61031681610247565b811461032157600080fd5b50565b6000813590506103338161030d565b92915050565b600080604083850312156103505761034f6102af565b5b600061035e85828601610324565b925050602061036f85828601610324565b9150509250929050565b60006020828403121561038f5761038e6102af565b5b600061039d84828501610324565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e08261027b565b91506103eb8361027b565b9250828201905080821115610403576104026103a6565b5b92915050565b6000819050919050565b6000819050919050565b600061043861043361042e84610409565b610413565b61027b565b9050919050565b6104488161041d565b82525050565b6000602082019050610463600083018461043f565b92915050565b600061047482610247565b915061047f83610247565b9250828201905082811215600083121683821260008412151617156104a7576104a66103a6565b5b92915050565b60006104b882610247565b91506104c383610247565b92508282026104d181610247565b91507f80000000000000000000000000000000000000000000000000000000000000008414600084121615610509576105086103a6565b5b828205841483151761051e5761051d6103a6565b5b509291505056fea2646970667358221220607cd99eabba12e9d39e526a2c5ee82f4af77472608174275cd751b1d4bc047164736f6c63430008110033" # noqa: E501 -MATH_CONTRACT_RUNTIME = "0x6080604052600436106100555760003560e01c806316216f391461005a5780635b34b9661461008557806361bc221a146100a35780636abbb3b4146100ce578063a5f3c23b146100fe578063dcf537b11461012e575b600080fd5b34801561006657600080fd5b5061006f61015e565b60405161007c9190610260565b60405180910390f35b61008d610167565b60405161009a9190610294565b60405180910390f35b3480156100af57600080fd5b506100b86101be565b6040516100c59190610294565b60405180910390f35b6100e860048036038101906100e391906102e0565b6101c4565b6040516100f59190610294565b60405180910390f35b61011860048036038101906101139190610339565b61021b565b6040516101259190610260565b60405180910390f35b61014860048036038101906101439190610379565b610231565b6040516101559190610260565b60405180910390f35b6000600d905090565b6000600160005461017891906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c560016040516101ae919061044e565b60405180910390a1600054905090565b60005481565b6000816000546101d491906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5826040516102099190610294565b60405180910390a16000549050919050565b600081836102299190610469565b905092915050565b600060078261024091906104ad565b9050919050565b6000819050919050565b61025a81610247565b82525050565b60006020820190506102756000830184610251565b92915050565b6000819050919050565b61028e8161027b565b82525050565b60006020820190506102a96000830184610285565b92915050565b600080fd5b6102bd8161027b565b81146102c857600080fd5b50565b6000813590506102da816102b4565b92915050565b6000602082840312156102f6576102f56102af565b5b6000610304848285016102cb565b91505092915050565b61031681610247565b811461032157600080fd5b50565b6000813590506103338161030d565b92915050565b600080604083850312156103505761034f6102af565b5b600061035e85828601610324565b925050602061036f85828601610324565b9150509250929050565b60006020828403121561038f5761038e6102af565b5b600061039d84828501610324565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e08261027b565b91506103eb8361027b565b9250828201905080821115610403576104026103a6565b5b92915050565b6000819050919050565b6000819050919050565b600061043861043361042e84610409565b610413565b61027b565b9050919050565b6104488161041d565b82525050565b6000602082019050610463600083018461043f565b92915050565b600061047482610247565b915061047f83610247565b9250828201905082811215600083121683821260008412151617156104a7576104a66103a6565b5b92915050565b60006104b882610247565b91506104c383610247565b92508282026104d181610247565b91507f80000000000000000000000000000000000000000000000000000000000000008414600084121615610509576105086103a6565b5b828205841483151761051e5761051d6103a6565b5b509291505056fea2646970667358221220607cd99eabba12e9d39e526a2c5ee82f4af77472608174275cd751b1d4bc047164736f6c63430008110033" # noqa: E501 -MATH_CONTRACT_ABI = json.loads( - '[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Increased","type":"event"},{"inputs":[{"internalType":"int256","name":"a","type":"int256"},{"internalType":"int256","name":"b","type":"int256"}],"name":"add","outputs":[{"internalType":"int256","name":"result","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"counter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incrementCounter","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"incrementCounter","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"a","type":"int256"}],"name":"multiply7","outputs":[{"internalType":"int256","name":"result","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"return13","outputs":[{"internalType":"int256","name":"result","type":"int256"}],"stateMutability":"nonpayable","type":"function"}]' # noqa: E501 +from web3._utils.contract_sources.contract_data.revert_contract import ( + REVERT_CONTRACT_DATA, +) +from web3._utils.contract_sources.contract_data.string_contract import ( + STRING_CONTRACT_DATA, ) @pytest.fixture(scope="session") def math_contract_bytecode(): - return MATH_CONTRACT_CODE + return MATH_CONTRACT_BYTECODE @pytest.fixture(scope="session") @@ -173,146 +67,34 @@ def math_contract_abi(): return MATH_CONTRACT_ABI -@pytest.fixture() -def math_contract_instance( - w3, math_contract_abi, math_contract_bytecode, math_contract_runtime -): - return w3.eth.contract( - abi=math_contract_abi, - bytecode=math_contract_bytecode, - bytecode_runtime=math_contract_runtime, - ) +@pytest.fixture +def math_contract_instance(w3): + return w3.eth.contract(**MATH_CONTRACT_DATA) -@pytest.fixture() +@pytest.fixture def math_contract(w3, math_contract_instance, address_conversion_func): return deploy(w3, math_contract_instance, address_conversion_func) -# source: web3/_utils/contract_sources/ConstructorContracts.sol:SimpleConstructor -# compiled with Solidity 0.8.17 -SIMPLE_CONSTRUCTOR_BYTECODE = "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea264697066735822122034ed61fab7939a9b4f373acbbdb1df0be80fb7f7ffb35d8b25d6e4deff947b4d64736f6c63430008110033" # noqa: E501 -SIMPLE_CONSTRUCTOR_RUNTIME = "0x6080604052600080fdfea264697066735822122034ed61fab7939a9b4f373acbbdb1df0be80fb7f7ffb35d8b25d6e4deff947b4d64736f6c63430008110033" # noqa: E501 -SIMPLE_CONSTRUCTOR_ABI = json.loads('[{"inputs":[],"type":"constructor"}]') - - -@pytest.fixture(scope="session") -def simple_constructor_contract_bytecode(): - return SIMPLE_CONSTRUCTOR_BYTECODE - - -@pytest.fixture(scope="session") -def simple_constructor_contract_runtime(): - return SIMPLE_CONSTRUCTOR_RUNTIME - - -@pytest.fixture(scope="session") -def simple_constructor_contract_abi(): - return SIMPLE_CONSTRUCTOR_ABI - - -@pytest.fixture() -def simple_constructor_contract_instance( - w3, - simple_constructor_contract_bytecode, - simple_constructor_contract_runtime, - simple_constructor_contract_abi, -): - return w3.eth.contract( - abi=simple_constructor_contract_abi, - bytecode=simple_constructor_contract_bytecode, - bytecode_runtime=simple_constructor_contract_runtime, - ) - - -# source: web3/_utils/contract_sources/ConstructorContracts.sol:ConstructorWithArguments -# compiled with Solidity 0.8.17 -CONTRACT_WITH_CONSTRUCTOR_ARGS_BYTECODE = "0x608060405234801561001057600080fd5b50604051610214380380610214833981810160405281019061003291906100b8565b816000819055508060018190555050506100f8565b600080fd5b6000819050919050565b61005f8161004c565b811461006a57600080fd5b50565b60008151905061007c81610056565b92915050565b6000819050919050565b61009581610082565b81146100a057600080fd5b50565b6000815190506100b28161008c565b92915050565b600080604083850312156100cf576100ce610047565b5b60006100dd8582860161006d565b92505060206100ee858286016100a3565b9150509250929050565b61010d806101076000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806388ec1346146037578063d4c46c76146051575b600080fd5b603d606b565b60405160489190608e565b60405180910390f35b60576071565b6040516062919060be565b60405180910390f35b60005481565b60015481565b6000819050919050565b6088816077565b82525050565b600060208201905060a160008301846081565b92915050565b6000819050919050565b60b88160a7565b82525050565b600060208201905060d1600083018460b1565b9291505056fea264697066735822122035bd964aa6a147f69a8ae5b1fd3a4f2994de267d538a55ec4252b912b39cbb5064736f6c63430008110033" # noqa: E501 -CONTRACT_WITH_CONSTRUCTOR_ARGS_RUNTIME = "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806388ec1346146037578063d4c46c76146051575b600080fd5b603d606b565b60405160489190608e565b60405180910390f35b60576071565b6040516062919060be565b60405180910390f35b60005481565b60015481565b6000819050919050565b6088816077565b82525050565b600060208201905060a160008301846081565b92915050565b6000819050919050565b60b88160a7565b82525050565b600060208201905060d1600083018460b1565b9291505056fea264697066735822122035bd964aa6a147f69a8ae5b1fd3a4f2994de267d538a55ec4252b912b39cbb5064736f6c63430008110033" # noqa: E501 -CONTRACT_WITH_CONSTRUCTOR_ARGS_ABI = json.loads( - '[{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"bytes32","name":"b","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"data_a","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"data_b","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]' # noqa: E501 -) - - -@pytest.fixture() -def contract_with_constructor_args_bytecode(): - return CONTRACT_WITH_CONSTRUCTOR_ARGS_BYTECODE - - -@pytest.fixture() -def contract_with_constructor_args_runtime(): - return CONTRACT_WITH_CONSTRUCTOR_ARGS_RUNTIME - - -@pytest.fixture() -def contract_with_constructor_args_abi(): - return CONTRACT_WITH_CONSTRUCTOR_ARGS_ABI - - -@pytest.fixture() -def contract_with_constructor_args_instance( - w3, - contract_with_constructor_args_bytecode, - contract_with_constructor_args_runtime, - contract_with_constructor_args_abi, -): - return w3.eth.contract( - abi=contract_with_constructor_args_abi, - bytecode=contract_with_constructor_args_bytecode, - bytecode_runtime=contract_with_constructor_args_runtime, - ) - - -@pytest.fixture -def non_strict_contract_with_constructor_args_instance( - w3_non_strict_abi, - contract_with_constructor_args_bytecode, - contract_with_constructor_args_runtime, - contract_with_constructor_args_abi, -): - return w3_non_strict_abi.eth.contract( - abi=contract_with_constructor_args_abi, - bytecode=contract_with_constructor_args_bytecode, - bytecode_runtime=contract_with_constructor_args_runtime, - ) - - -# source: web3/_utils/contract_sources/ConstructorContracts.sol:ConstructorWithAddressArgument # noqa: E501 -# compiled with Solidity 0.8.17 -CONTRACT_WITH_CONSTRUCTOR_ADDRESS_BYTECODE = "0x608060405234801561001057600080fd5b5060405161020d38038061020d833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b60f7806101166000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806334664e3a14602d575b600080fd5b60336047565b604051603e919060a8565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000609482606b565b9050919050565b60a281608b565b82525050565b600060208201905060bb6000830184609b565b9291505056fea2646970667358221220405a81c137def72f9de1e09c28e163d7f76ed721346c9d7c7761c6d923dfcb9364736f6c63430008110033" # noqa: E501 -CONTRACT_WITH_CONSTRUCTOR_ADDRESS_RUNTIME = "0x6080604052348015600f57600080fd5b506004361060285760003560e01c806334664e3a14602d575b600080fd5b60336047565b604051603e919060a8565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000609482606b565b9050919050565b60a281608b565b82525050565b600060208201905060bb6000830184609b565b9291505056fea2646970667358221220405a81c137def72f9de1e09c28e163d7f76ed721346c9d7c7761c6d923dfcb9364736f6c63430008110033" # noqa: E501 -CONTRACT_WITH_CONSTRUCTOR_ADDRESS_ABI = json.loads( - '[{"inputs":[{"internalType":"address","name":"_testAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"testAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]' # noqa: E501 -) - - @pytest.fixture -def contract_with_constructor_address_bytecode(): - return CONTRACT_WITH_CONSTRUCTOR_ADDRESS_BYTECODE +def simple_constructor_contract_instance(w3): + return w3.eth.contract(**SIMPLE_CONSTRUCTOR_CONTRACT_DATA) @pytest.fixture -def contract_with_constructor_address_runtime(): - return CONTRACT_WITH_CONSTRUCTOR_ADDRESS_RUNTIME +def contract_with_constructor_args_instance(w3): + return w3.eth.contract(**CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA) @pytest.fixture -def contract_with_constructor_address_abi(): - return CONTRACT_WITH_CONSTRUCTOR_ADDRESS_ABI +def non_strict_contract_with_constructor_args_instance(w3_non_strict_abi): + return w3_non_strict_abi.eth.contract(**CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA) @pytest.fixture -def contract_with_constructor_address_instance( - w3, - contract_with_constructor_address_bytecode, - contract_with_constructor_address_runtime, - contract_with_constructor_address_abi, -): - return w3.eth.contract( - abi=contract_with_constructor_address_abi, - bytecode=contract_with_constructor_address_bytecode, - bytecode_runtime=contract_with_constructor_address_runtime, - ) +def contract_with_constructor_address_instance(w3): + return w3.eth.contract(**CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA) @pytest.fixture @@ -327,67 +109,22 @@ def contract_with_constructor_address( ) -# source: web3/_utils/contract_sources/AddressReflector.sol:AddressReflector -# compiled with Solidity 0.8.17 -ADDRESS_REFLECTOR_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50610430806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea2646970667358221220371edff19873fdfb0d5f8053a775ef099ccb159b5f09b58d9f0efaf186cbda4e64736f6c63430008110033" # noqa: 501 -ADDRESS_REFLECTOR_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea2646970667358221220371edff19873fdfb0d5f8053a775ef099ccb159b5f09b58d9f0efaf186cbda4e64736f6c63430008110033" # noqa: 501 -ADDRESS_REFLECTOR_CONTRACT_ABI = json.loads( - '[{"inputs":[{"internalType":"address","name":"arg","type":"address"}],"name":"reflect","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"arg","type":"address[]"}],"name":"reflect","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"pure","type":"function"}]' # noqa: 501 -) - - @pytest.fixture -def address_reflector_contract_instance(w3): - return w3.eth.contract( - abi=ADDRESS_REFLECTOR_CONTRACT_ABI, - bytecode=ADDRESS_REFLECTOR_CONTRACT_BYTECODE, - bytecode_runtime=ADDRESS_REFLECTOR_CONTRACT_RUNTIME, +def address_reflector_contract(w3, address_conversion_func): + address_reflector_contract_instance = w3.eth.contract( + **ADDRESS_REFLECTOR_CONTRACT_DATA ) - - -@pytest.fixture -def address_reflector_contract( - w3, address_reflector_contract_instance, address_conversion_func -): return deploy(w3, address_reflector_contract_instance, address_conversion_func) -STRING_CONTRACT_BYTECODE = "0x60806040526040518060400160405280600a81526020017f6e65766572207573656400000000000000000000000000000000000000000000815250600090816200004a919062000311565b503480156200005857600080fd5b5060405162000cf438038062000cf483398181016040528101906200007e91906200055c565b80600190816200008f919062000311565b5050620005ad565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200011957607f821691505b6020821081036200012f576200012e620000d1565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200015a565b620001a586836200015a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001f2620001ec620001e684620001bd565b620001c7565b620001bd565b9050919050565b6000819050919050565b6200020e83620001d1565b620002266200021d82620001f9565b84845462000167565b825550505050565b600090565b6200023d6200022e565b6200024a81848462000203565b505050565b5b8181101562000272576200026660008262000233565b60018101905062000250565b5050565b601f821115620002c1576200028b8162000135565b62000296846200014a565b81016020851015620002a6578190505b620002be620002b5856200014a565b8301826200024f565b50505b505050565b600082821c905092915050565b6000620002e660001984600802620002c6565b1980831691505092915050565b6000620003018383620002d3565b9150826002028217905092915050565b6200031c8262000097565b67ffffffffffffffff811115620003385762000337620000a2565b5b62000344825462000100565b6200035182828562000276565b600060209050601f83116001811462000389576000841562000374578287015190505b620003808582620002f3565b865550620003f0565b601f198416620003998662000135565b60005b82811015620003c3578489015182556001820191506020850194506020810190506200039c565b86831015620003e35784890151620003df601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b620004328262000416565b810181811067ffffffffffffffff82111715620004545762000453620000a2565b5b80604052505050565b600062000469620003f8565b905062000477828262000427565b919050565b600067ffffffffffffffff8211156200049a5762000499620000a2565b5b620004a58262000416565b9050602081019050919050565b60005b83811015620004d2578082015181840152602081019050620004b5565b60008484015250505050565b6000620004f5620004ef846200047c565b6200045d565b90508281526020810184848401111562000514576200051362000411565b5b62000521848285620004b2565b509392505050565b600082601f8301126200054157620005406200040c565b5b815162000553848260208601620004de565b91505092915050565b60006020828403121562000575576200057462000402565b5b600082015167ffffffffffffffff81111562000596576200059562000407565b5b620005a48482850162000529565b91505092915050565b61073780620005bd6000396000f3fe6080604052600436106100345760003560e01c8063209652551461003957806330de3cee1461005757806393a0935214610075575b600080fd5b61004161009e565b60405161004e9190610265565b60405180910390f35b61005f610130565b60405161006c9190610265565b60405180910390f35b34801561008157600080fd5b5061009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea264697066735822122070af6b54814b3ca66e79200ccc07de707e984422ec598e78cbbd7ed6f8671feb64736f6c63430008110033" # noqa: E501 -STRING_CONTRACT_RUNTIME = "0x6080604052600436106100345760003560e01c8063209652551461003957806330de3cee1461005757806393a0935214610075575b600080fd5b61004161009e565b60405161004e9190610265565b60405180910390f35b61005f610130565b60405161006c9190610265565b60405180910390f35b34801561008157600080fd5b5061009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea264697066735822122070af6b54814b3ca66e79200ccc07de707e984422ec598e78cbbd7ed6f8671feb64736f6c63430008110033" # noqa: E501 -STRING_CONTRACT_ABI = json.loads( - '[{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"constValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getValue","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"name":"setValue","outputs":[],"stateMutability":"nonpayable","type":"function"}]' # noqa: E501 -) - - -@pytest.fixture -def string_contract_bytecode(): - return STRING_CONTRACT_BYTECODE - - -@pytest.fixture -def string_contract_runtime(): - return STRING_CONTRACT_RUNTIME - - -@pytest.fixture -def string_contract_abi(): - return STRING_CONTRACT_ABI - - -@pytest.fixture -def string_contract_kwargs( - string_contract_bytecode, string_contract_runtime, string_contract_abi -): - return { - "bytecode": string_contract_bytecode, - "bytecode_runtime": string_contract_runtime, - "abi": string_contract_abi, - } +@pytest.fixture(scope="session") +def string_contract_data(): + return STRING_CONTRACT_DATA @pytest.fixture -def string_contract_instance(w3, string_contract_kwargs): - return w3.eth.contract(**string_contract_kwargs) +def string_contract_instance(w3, string_contract_data): + return w3.eth.contract(**STRING_CONTRACT_DATA) @pytest.fixture @@ -399,122 +136,30 @@ def string_contract(w3, string_contract_instance, address_conversion_func): @pytest.fixture def non_strict_string_contract( - w3_non_strict_abi, string_contract_kwargs, address_conversion_func + w3_non_strict_abi, string_contract_data, address_conversion_func ): - _non_strict_string_contract = w3_non_strict_abi.eth.contract( - **string_contract_kwargs + _non_strict_string_contract_instance = w3_non_strict_abi.eth.contract( + **string_contract_data ) return deploy( w3_non_strict_abi, - _non_strict_string_contract, + _non_strict_string_contract_instance, address_conversion_func, args=["Caqalai"], ) -BYTES_CONTRACT_BYTECODE = "0x60806040526040518060400160405280600281526020017f0123000000000000000000000000000000000000000000000000000000000000815250600090816200004a919062000311565b503480156200005857600080fd5b5060405162000de638038062000de683398181016040528101906200007e91906200055c565b80600190816200008f9190620005b8565b50506200069f565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200011957607f821691505b6020821081036200012f576200012e620000d1565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200015a565b620001a586836200015a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001f2620001ec620001e684620001bd565b620001c7565b620001bd565b9050919050565b6000819050919050565b6200020e83620001d1565b620002266200021d82620001f9565b84845462000167565b825550505050565b600090565b6200023d6200022e565b6200024a81848462000203565b505050565b5b8181101562000272576200026660008262000233565b60018101905062000250565b5050565b601f821115620002c1576200028b8162000135565b62000296846200014a565b81016020851015620002a6578190505b620002be620002b5856200014a565b8301826200024f565b50505b505050565b600082821c905092915050565b6000620002e660001984600802620002c6565b1980831691505092915050565b6000620003018383620002d3565b9150826002028217905092915050565b6200031c8262000097565b67ffffffffffffffff811115620003385762000337620000a2565b5b62000344825462000100565b6200035182828562000276565b600060209050601f83116001811462000389576000841562000374578287015190505b620003808582620002f3565b865550620003f0565b601f198416620003998662000135565b60005b82811015620003c3578489015182556001820191506020850194506020810190506200039c565b86831015620003e35784890151620003df601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b620004328262000416565b810181811067ffffffffffffffff82111715620004545762000453620000a2565b5b80604052505050565b600062000469620003f8565b905062000477828262000427565b919050565b600067ffffffffffffffff8211156200049a5762000499620000a2565b5b620004a58262000416565b9050602081019050919050565b60005b83811015620004d2578082015181840152602081019050620004b5565b60008484015250505050565b6000620004f5620004ef846200047c565b6200045d565b90508281526020810184848401111562000514576200051362000411565b5b62000521848285620004b2565b509392505050565b600082601f8301126200054157620005406200040c565b5b815162000553848260208601620004de565b91505092915050565b60006020828403121562000575576200057462000402565b5b600082015167ffffffffffffffff81111562000596576200059562000407565b5b620005a48482850162000529565b91505092915050565b600081519050919050565b620005c382620005ad565b67ffffffffffffffff811115620005df57620005de620000a2565b5b620005eb825462000100565b620005f882828562000276565b600060209050601f8311600181146200063057600084156200061b578287015190505b620006278582620002f3565b86555062000697565b601f198416620006408662000135565b60005b828110156200066a5784890151825560018201915060208501945060208101905062000643565b868310156200068a578489015162000686601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b61073780620006af6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee14610064578063439970aa14610082575b600080fd5b61004e61009e565b60405161005b9190610265565b60405180910390f35b61006c610130565b6040516100799190610265565b60405180910390f35b61009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea26469706673582212203089c3295f7cbf7e1f4073f7b19fedf977da326a3f69bd7a15d0e7d097933bc764736f6c63430008110033" # noqa: E501 -BYTES_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee14610064578063439970aa14610082575b600080fd5b61004e61009e565b60405161005b9190610265565b60405180910390f35b61006c610130565b6040516100799190610265565b60405180910390f35b61009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea26469706673582212203089c3295f7cbf7e1f4073f7b19fedf977da326a3f69bd7a15d0e7d097933bc764736f6c63430008110033" # noqa: E501 -BYTES_CONTRACT_ABI = json.loads( - '[{"constant":false,"inputs":[],"name":"getValue","outputs":[{"name":"","type":"bytes"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"constValue","outputs":[{"name":"","type":"bytes"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"value","outputs":[{"name":"","type":"bytes"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"bytes"}],"name":"setValue","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_value","type":"bytes"}],"payable":false,"type":"constructor"}]' # noqa: E501 -) - - -@pytest.fixture -def bytes_contract_kwargs(): - return { - "bytecode": BYTES_CONTRACT_BYTECODE, - "bytecode_runtime": BYTES_CONTRACT_RUNTIME, - "abi": BYTES_CONTRACT_ABI, - } - - -@pytest.fixture -def bytes_contract(w3, bytes_contract_kwargs): - return w3.eth.contract(**bytes_contract_kwargs) - - -@pytest.fixture -def non_strict_bytes_contract(w3_non_strict_abi, bytes_contract_kwargs): - return w3_non_strict_abi.eth.contract(**bytes_contract_kwargs) - - -BYTES32_CONTRACT_BYTECODE = "0x60806040527f012301230123012301230123012301230123012301230123012301230123012360005534801561003457600080fd5b5060405161025d38038061025d8339818101604052810190610056919061009e565b80600181905550506100cb565b600080fd5b6000819050919050565b61007b81610068565b811461008657600080fd5b50565b60008151905061009881610072565b92915050565b6000602082840312156100b4576100b3610063565b5b60006100c284828501610089565b91505092915050565b610183806100da6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee1461006457806358825b1014610082575b600080fd5b61004e61009e565b60405161005b91906100d4565b60405180910390f35b61006c6100a8565b60405161007991906100d4565b60405180910390f35b61009c60048036038101906100979190610120565b6100b1565b005b6000600154905090565b60008054905090565b8060018190555050565b6000819050919050565b6100ce816100bb565b82525050565b60006020820190506100e960008301846100c5565b92915050565b600080fd5b6100fd816100bb565b811461010857600080fd5b50565b60008135905061011a816100f4565b92915050565b600060208284031215610136576101356100ef565b5b60006101448482850161010b565b9150509291505056fea2646970667358221220b8267f64119f7a63eb9c2eeae86bf981b7fcbeaa0c0797ff7d7cc51b21cf8d5464736f6c63430008110033" # noqa: E501 -BYTES32_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee1461006457806358825b1014610082575b600080fd5b61004e61009e565b60405161005b91906100d4565b60405180910390f35b61006c6100a8565b60405161007991906100d4565b60405180910390f35b61009c60048036038101906100979190610120565b6100b1565b005b6000600154905090565b60008054905090565b8060018190555050565b6000819050919050565b6100ce816100bb565b82525050565b60006020820190506100e960008301846100c5565b92915050565b600080fd5b6100fd816100bb565b811461010857600080fd5b50565b60008135905061011a816100f4565b92915050565b600060208284031215610136576101356100ef565b5b60006101448482850161010b565b9150509291505056fea2646970667358221220b8267f64119f7a63eb9c2eeae86bf981b7fcbeaa0c0797ff7d7cc51b21cf8d5464736f6c63430008110033" # noqa: E501 -BYTES32_CONTRACT_ABI = json.loads( - '[{"inputs":[{"internalType":"bytes32","name":"_value","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"constValue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getValue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_value","type":"bytes32"}],"name":"setValue","outputs":[],"stateMutability":"nonpayable","type":"function"}]' # noqa: E501 -) - - -@pytest.fixture -def bytes32_contract_bytecode(): - return BYTES32_CONTRACT_BYTECODE - - -@pytest.fixture -def bytes32_contract_runtime(): - return BYTES32_CONTRACT_RUNTIME - - -@pytest.fixture -def bytes32_contract_abi(): - return BYTES32_CONTRACT_ABI - - -@pytest.fixture -def bytes32_contract_kwargs( - bytes32_contract_bytecode, bytes32_contract_runtime, bytes32_contract_abi -): - return { - "bytecode": bytes32_contract_bytecode, - "bytecode_runtime": bytes32_contract_runtime, - "abi": bytes32_contract_abi, - } - - -@pytest.fixture -def bytes32_contract(w3, bytes32_contract_kwargs): - return w3.eth.contract(**bytes32_contract_kwargs) - - -@pytest.fixture -def emitter_contract_bytecode(): - return EMITTER_CONTRACT_BYTECODE - - -@pytest.fixture -def emitter_contract_runtime(): - return EMITTER_CONTRACT_RUNTIME - - -@pytest.fixture -def emitter_contract_abi(): - return EMITTER_CONTRACT_ABI - - -@pytest.fixture() -def emitter_contract_kwargs( - emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi -): - return { - "bytecode": emitter_contract_bytecode, - "bytecode_runtime": emitter_contract_runtime, - "abi": emitter_contract_abi, - } - - -@pytest.fixture -def non_strict_emitter_contract_instance(w3_non_strict_abi, emitter_contract_kwargs): - return w3_non_strict_abi.eth.contract(**emitter_contract_kwargs) - - @pytest.fixture def non_strict_emitter( w3_non_strict_abi, - non_strict_emitter_contract_instance, + emitter_contract_data, wait_for_transaction, wait_for_block, address_conversion_func, ): + non_strict_emitter_contract_instance = w3_non_strict_abi.eth.contract( + **emitter_contract_data + ) w3 = w3_non_strict_abi wait_for_block(w3) @@ -531,33 +176,16 @@ def non_strict_emitter( return emitter_contract -@pytest.fixture() -def event_contract_kwargs(): - return { - "bytecode": EVENT_CONTRACT_CODE, - "bytecode_runtime": EVENT_CONTRACT_RUNTIME, - "abi": EVENT_CONTRACT_ABI, - } - - -@pytest.fixture() -def event_contract_instance(w3_empty, event_contract_kwargs): - w3 = w3_empty - return w3.eth.contract(**event_contract_kwargs) - - -@pytest.fixture() +@pytest.fixture def event_contract( - w3_empty, - event_contract_instance, + w3, wait_for_transaction, wait_for_block, address_conversion_func, ): - - w3 = w3_empty - wait_for_block(w3) + + event_contract_instance = w3.eth.contract(**EVENT_CONTRACT_DATA) deploy_txn_hash = event_contract_instance.constructor().transact( {"from": w3.eth.coinbase, "gas": 1000000} ) @@ -571,235 +199,70 @@ def event_contract( return event_contract -@pytest.fixture() -def INDEXED_EVENT_CONTRACT_CODE(): - return IND_EVENT_CONTRACT_CODE - - -@pytest.fixture() -def INDEXED_EVENT_CONTRACT_RUNTIME(): - return IND_EVENT_CONTRACT_RUNTIME - - -@pytest.fixture() -def INDEXED_EVENT_CONTRACT_ABI(): - return IND_EVENT_CONTRACT_ABI - - -@pytest.fixture() -def INDEXED_EVENT_CONTRACT( - INDEXED_EVENT_CONTRACT_CODE, - INDEXED_EVENT_CONTRACT_RUNTIME, - INDEXED_EVENT_CONTRACT_ABI, -): - return { - "bytecode": INDEXED_EVENT_CONTRACT_CODE, - "bytecode_runtime": INDEXED_EVENT_CONTRACT_RUNTIME, - "abi": INDEXED_EVENT_CONTRACT_ABI, - } - - -@pytest.fixture() -def IndexedEventContract(w3_empty, INDEXED_EVENT_CONTRACT): - w3 = w3_empty - return w3.eth.contract(**INDEXED_EVENT_CONTRACT) - - -@pytest.fixture() -def indexed_event( - w3_empty, - IndexedEventContract, - wait_for_transaction, - wait_for_block, - address_conversion_func, +@pytest.fixture +def indexed_event_contract( + w3, wait_for_block, wait_for_transaction, address_conversion_func ): - - w3 = w3_empty - wait_for_block(w3) - deploy_txn_hash = IndexedEventContract.constructor().transact( + + indexed_event_contract_instance = w3.eth.contract(**INDEXED_EVENT_CONTRACT_DATA) + deploy_txn_hash = indexed_event_contract_instance.constructor().transact( {"from": w3.eth.coinbase, "gas": 1000000} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == IndexedEventContract.bytecode_runtime - indexed_event_contract = IndexedEventContract(address=contract_address) + assert bytecode == indexed_event_contract_instance.bytecode_runtime + indexed_event_contract = indexed_event_contract_instance(address=contract_address) assert indexed_event_contract.address == contract_address return indexed_event_contract -CONTRACT_ARRAYS_SOURCE = """ - contract ArraysContract { - - bytes32[] public bytes32Value; - bytes32[] public bytes32ConstValue; - byte[] public byteValue; - byte[] public byteConstValue; - - function ArraysContract(bytes32[] _bytes32Value, byte[] _byteValue) { - bytes32Value = _bytes32Value; - byteValue = _byteValue; - bytes32ConstValue = [keccak256('A'), keccak256('B')]; - byteConstValue = [bytes1(0), bytes1(1)]; - } - - function setBytes32Value(bytes32[] _bytes32Value) { - bytes32Value = _bytes32Value; - } - - function getBytes32Value() returns (bytes32[]) { - return bytes32Value; - } - - function getBytes32ConstValue() returns (bytes32[]) { - return bytes32ConstValue; - } - - function setByteValue(byte[] _byteValue) { - byteValue = _byteValue; - } - - function getByteValue() returns (byte[]) { - return byteValue; - } - - function getByteConstValue() returns (byte[]) { - return byteConstValue; - } -} -""" -CONTRACT_ARRAYS_CODE = "606060405234156200001057600080fd5b60405162000e6238038062000e628339810160405280805182019190602001805182019190505081600090805190602001906200004f92919062000209565b5080600290805190602001906200006892919062000261565b50604080519081016040528060405180807f4100000000000000000000000000000000000000000000000000000000000000815250600101905060405180910390206000191660001916815260200160405180807f420000000000000000000000000000000000000000000000000000000000000081525060010190506040518091039020600019166000191681525060019060026200010a9291906200032f565b50604080519081016040528060007f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200160017f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681525060039060026200020092919062000387565b505050620004b0565b8280548282559060005260206000209081019282156200024e579160200282015b828111156200024d5782518290600019169055916020019190600101906200022a565b5b5090506200025d919062000455565b5090565b82805482825590600052602060002090601f016020900481019282156200031c5791602002820160005b83821115620002eb57835183826101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009004021790555092602001926001016020816000010492830192600103026200028b565b80156200031a5782816101000a81549060ff0219169055600101602081600001049283019260010302620002eb565b505b5090506200032b91906200047d565b5090565b82805482825590600052602060002090810192821562000374579160200282015b828111156200037357825182906000191690559160200191906001019062000350565b5b50905062000383919062000455565b5090565b82805482825590600052602060002090601f01602090048101928215620004425791602002820160005b838211156200041157835183826101000a81548160ff02191690837f0100000000000000000000000000000000000000000000000000000000000000900402179055509260200192600101602081600001049283019260010302620003b1565b8015620004405782816101000a81549060ff021916905560010160208160000104928301926001030262000411565b505b5090506200045191906200047d565b5090565b6200047a91905b80821115620004765760008160009055506001016200045c565b5090565b90565b620004ad91905b80821115620004a957600081816101000a81549060ff02191690555060010162000484565b5090565b90565b6109a280620004c06000396000f300606060405236156100a2576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630afe5e33146100a757806312c9dcc8146101115780631579bf661461018c5780633ddcea2f146101f657806351b4878814610250578063542d83de1461028f578063605ba271146102ce5780638abe51fd14610338578063962e450c146103a2578063bb69679b1461041d575b600080fd5b34156100b257600080fd5b6100ba610477565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100fd5780820151818401526020810190506100e2565b505050509050019250505060405180910390f35b341561011c57600080fd5b61013260048080359060200190919050506104d9565b60405180827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b341561019757600080fd5b61019f61052b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101e25780820151818401526020810190506101c7565b505050509050019250505060405180910390f35b341561020157600080fd5b61024e6004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506105ed565b005b341561025b57600080fd5b6102716004808035906020019091905050610607565b60405180826000191660001916815260200191505060405180910390f35b341561029a57600080fd5b6102b0600480803590602001909190505061062b565b60405180826000191660001916815260200191505060405180910390f35b34156102d957600080fd5b6102e161064f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610324578082015181840152602081019050610309565b505050509050019250505060405180910390f35b341561034357600080fd5b61034b6106b1565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561038e578082015181840152602081019050610373565b505050509050019250505060405180910390f35b34156103ad57600080fd5b6103c36004808035906020019091905050610773565b60405180827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b341561042857600080fd5b6104756004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506107c5565b005b61047f6107df565b60018054806020026020016040519081016040528092919081815260200182805480156104cf57602002820191906000526020600020905b815460001916815260200190600101908083116104b7575b5050505050905090565b6002818154811015156104e857fe5b9060005260206000209060209182820401919006915054906101000a90047f01000000000000000000000000000000000000000000000000000000000000000281565b6105336107f3565b60038054806020026020016040519081016040528092919081815260200182805480156105e357602002820191906000526020600020906000905b82829054906101000a90047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001906001019060208260000104928301926001038202915080841161056e5790505b5050505050905090565b8060029080519060200190610603929190610807565b5050565b60018181548110151561061657fe5b90600052602060002090016000915090505481565b60008181548110151561063a57fe5b90600052602060002090016000915090505481565b6106576107df565b60008054806020026020016040519081016040528092919081815260200182805480156106a757602002820191906000526020600020905b8154600019168152602001906001019080831161068f575b5050505050905090565b6106b96107f3565b600280548060200260200160405190810160405280929190818152602001828054801561076957602002820191906000526020600020906000905b82829054906101000a90047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020826000010492830192600103820291508084116106f45790505b5050505050905090565b60038181548110151561078257fe5b9060005260206000209060209182820401919006915054906101000a90047f01000000000000000000000000000000000000000000000000000000000000000281565b80600090805190602001906107db9291906108ce565b5050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b82805482825590600052602060002090601f016020900481019282156108bd5791602002820160005b8382111561088e57835183826101000a81548160ff02191690837f0100000000000000000000000000000000000000000000000000000000000000900402179055509260200192600101602081600001049283019260010302610830565b80156108bb5782816101000a81549060ff021916905560010160208160000104928301926001030261088e565b505b5090506108ca9190610921565b5090565b828054828255906000526020600020908101928215610910579160200282015b8281111561090f5782518290600019169055916020019190600101906108ee565b5b50905061091d9190610951565b5090565b61094e91905b8082111561094a57600081816101000a81549060ff021916905550600101610927565b5090565b90565b61097391905b8082111561096f576000816000905550600101610957565b5090565b905600a165627a7a72305820d0caf89bd0d39b343a907ac9d0f0b9bcddb1b8dc910706160d9d26fdc552afa40029" # noqa: E501 -CONTRACT_ARRAYS_RUNTIME = "0x606060405236156100a2576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630afe5e33146100a757806312c9dcc8146101115780631579bf661461018c5780633ddcea2f146101f657806351b4878814610250578063542d83de1461028f578063605ba271146102ce5780638abe51fd14610338578063962e450c146103a2578063bb69679b1461041d575b600080fd5b34156100b257600080fd5b6100ba610477565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100fd5780820151818401526020810190506100e2565b505050509050019250505060405180910390f35b341561011c57600080fd5b61013260048080359060200190919050506104d9565b60405180827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b341561019757600080fd5b61019f61052b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101e25780820151818401526020810190506101c7565b505050509050019250505060405180910390f35b341561020157600080fd5b61024e6004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506105ed565b005b341561025b57600080fd5b6102716004808035906020019091905050610607565b60405180826000191660001916815260200191505060405180910390f35b341561029a57600080fd5b6102b0600480803590602001909190505061062b565b60405180826000191660001916815260200191505060405180910390f35b34156102d957600080fd5b6102e161064f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610324578082015181840152602081019050610309565b505050509050019250505060405180910390f35b341561034357600080fd5b61034b6106b1565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561038e578082015181840152602081019050610373565b505050509050019250505060405180910390f35b34156103ad57600080fd5b6103c36004808035906020019091905050610773565b60405180827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b341561042857600080fd5b6104756004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506107c5565b005b61047f6107df565b60018054806020026020016040519081016040528092919081815260200182805480156104cf57602002820191906000526020600020905b815460001916815260200190600101908083116104b7575b5050505050905090565b6002818154811015156104e857fe5b9060005260206000209060209182820401919006915054906101000a90047f01000000000000000000000000000000000000000000000000000000000000000281565b6105336107f3565b60038054806020026020016040519081016040528092919081815260200182805480156105e357602002820191906000526020600020906000905b82829054906101000a90047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001906001019060208260000104928301926001038202915080841161056e5790505b5050505050905090565b8060029080519060200190610603929190610807565b5050565b60018181548110151561061657fe5b90600052602060002090016000915090505481565b60008181548110151561063a57fe5b90600052602060002090016000915090505481565b6106576107df565b60008054806020026020016040519081016040528092919081815260200182805480156106a757602002820191906000526020600020905b8154600019168152602001906001019080831161068f575b5050505050905090565b6106b96107f3565b600280548060200260200160405190810160405280929190818152602001828054801561076957602002820191906000526020600020906000905b82829054906101000a90047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020826000010492830192600103820291508084116106f45790505b5050505050905090565b60038181548110151561078257fe5b9060005260206000209060209182820401919006915054906101000a90047f01000000000000000000000000000000000000000000000000000000000000000281565b80600090805190602001906107db9291906108ce565b5050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b82805482825590600052602060002090601f016020900481019282156108bd5791602002820160005b8382111561088e57835183826101000a81548160ff02191690837f0100000000000000000000000000000000000000000000000000000000000000900402179055509260200192600101602081600001049283019260010302610830565b80156108bb5782816101000a81549060ff021916905560010160208160000104928301926001030261088e565b505b5090506108ca9190610921565b5090565b828054828255906000526020600020908101928215610910579160200282015b8281111561090f5782518290600019169055916020019190600101906108ee565b5b50905061091d9190610951565b5090565b61094e91905b8082111561094a57600081816101000a81549060ff021916905550600101610927565b5090565b90565b61097391905b8082111561096f576000816000905550600101610957565b5090565b905600a165627a7a72305820d0caf89bd0d39b343a907ac9d0f0b9bcddb1b8dc910706160d9d26fdc552afa40029" # noqa: E501 -CONTRACT_ARRAYS_ABI = json.loads( - '[{"constant": false, "inputs": [], "name": "getBytes32ConstValue", "outputs": [{"name": "", "type": "bytes32[]"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [{"name": "", "type": "uint256"}], "name": "byteValue", "outputs": [{"name": "", "type": "bytes1"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "getByteConstValue", "outputs": [{"name": "", "type": "bytes1[]"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"name": "_byteValue", "type": "bytes1[]"}], "name": "setByteValue", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [{"name": "", "type": "uint256"}], "name": "bytes32ConstValue", "outputs": [{"name": "", "type": "bytes32"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [{"name": "", "type": "uint256"}], "name": "bytes32Value", "outputs": [{"name": "", "type": "bytes32"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "getBytes32Value", "outputs": [{"name": "", "type": "bytes32[]"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [], "name": "getByteValue", "outputs": [{"name": "", "type": "bytes1[]"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [{"name": "", "type": "uint256"}], "name": "byteConstValue", "outputs": [{"name": "", "type": "bytes1"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"name": "_bytes32Value", "type": "bytes32[]"}], "name": "setBytes32Value", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"inputs": [{"name": "_bytes32Value", "type": "bytes32[]"}, {"name": "_byteValue", "type": "bytes1[]"}], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}]' # noqa: E501 -) - - -@pytest.fixture() -def ARRAYS_CODE(): - return CONTRACT_ARRAYS_CODE - - -@pytest.fixture() -def ARRAYS_RUNTIME(): - return CONTRACT_ARRAYS_RUNTIME - - -@pytest.fixture() -def ARRAYS_ABI(): - return CONTRACT_ARRAYS_ABI - - -@pytest.fixture() -def ARRAYS_CONTRACT(ARRAYS_CODE, ARRAYS_RUNTIME, ARRAYS_ABI): - return { - "bytecode": ARRAYS_CODE, - "bytecode_runtime": ARRAYS_RUNTIME, - "abi": ARRAYS_ABI, - } - - -@pytest.fixture() -def ArraysContract(w3, ARRAYS_CONTRACT): - return w3.eth.contract(**ARRAYS_CONTRACT) +# bytes_32 = [keccak('0'), keccak('1')] +BYTES32_ARRAY = [ + b"\x04HR\xb2\xa6p\xad\xe5@~x\xfb(c\xc5\x1d\xe9\xfc\xb9eB\xa0q\x86\xfe:\xed\xa6\xbb\x8a\x11m", # noqa: E501 + b"\xc8\x9e\xfd\xaaT\xc0\xf2\x0cz\xdfa(\x82\xdf\tP\xf5\xa9Qc~\x03\x07\xcd\xcbLg/)\x8b\x8b\xc6", # noqa: E501 +] +BYTES1_ARRAY = [b"\xff", b"\xff", b"\xff", b"\xff"] -@pytest.fixture() -def arrays_contract(w3, ArraysContract, address_conversion_func): - # bytes_32 = [keccak('0'), keccak('1')] - bytes32_array = [ - b"\x04HR\xb2\xa6p\xad\xe5@~x\xfb(c\xc5\x1d\xe9\xfc\xb9eB\xa0q\x86\xfe:\xed\xa6\xbb\x8a\x11m", # noqa: E501 - b"\xc8\x9e\xfd\xaaT\xc0\xf2\x0cz\xdfa(\x82\xdf\tP\xf5\xa9Qc~\x03\x07\xcd\xcbLg/)\x8b\x8b\xc6", # noqa: E501 - ] - byte_arr = [b"\xff", b"\xff", b"\xff", b"\xff"] +@pytest.fixture +def arrays_contract(w3, address_conversion_func): + arrays_contract_instance = w3.eth.contract(**ARRAYS_CONTRACT_DATA) return deploy( - w3, ArraysContract, address_conversion_func, args=[bytes32_array, byte_arr] + w3, + arrays_contract_instance, + address_conversion_func, + args=[BYTES32_ARRAY, BYTES1_ARRAY], ) -@pytest.fixture() -def NonStrictArraysContract(w3_non_strict_abi, ARRAYS_CONTRACT): - return w3_non_strict_abi.eth.contract(**ARRAYS_CONTRACT) - - -@pytest.fixture() -def non_strict_arrays_contract( - w3_non_strict_abi, NonStrictArraysContract, address_conversion_func -): - # bytes_32 = [keccak('0'), keccak('1')] - bytes32_array = [ - b"\x04HR\xb2\xa6p\xad\xe5@~x\xfb(c\xc5\x1d\xe9\xfc\xb9eB\xa0q\x86\xfe:\xed\xa6\xbb\x8a\x11m", # noqa: E501 - b"\xc8\x9e\xfd\xaaT\xc0\xf2\x0cz\xdfa(\x82\xdf\tP\xf5\xa9Qc~\x03\x07\xcd\xcbLg/)\x8b\x8b\xc6", # noqa: E501 - ] - byte_arr = [b"\xff", b"\xff", b"\xff", b"\xff"] +@pytest.fixture +def non_strict_arrays_contract(w3_non_strict_abi, address_conversion_func): + non_strict_arrays_contract_instance = w3_non_strict_abi.eth.contract( + **ARRAYS_CONTRACT_DATA + ) return deploy( w3_non_strict_abi, - NonStrictArraysContract, + non_strict_arrays_contract_instance, address_conversion_func, - args=[bytes32_array, byte_arr], + args=[BYTES32_ARRAY, BYTES1_ARRAY], ) -CONTRACT_PAYABLE_TESTER_SOURCE = """ -contract PayableTester { - bool public wasCalled; - - function doNoValueCall() public { - wasCalled = true; - } -} -""" -CONTRACT_PAYABLE_TESTER_CODE = "608060405234801561001057600080fd5b5060e88061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c680362214604e578063e4cb8f5c14607a575b600080fd5b348015605957600080fd5b506060608e565b604051808215151515815260200191505060405180910390f35b348015608557600080fd5b50608c60a0565b005b6000809054906101000a900460ff1681565b60016000806101000a81548160ff0219169083151502179055505600a165627a7a723058205362c7376eda918b0dc3a75d0ffab904a241c9b10b68d5268af6ca405242303e0029" # noqa: E501 -CONTRACT_PAYABLE_TESTER_RUNTIME = "6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c680362214604e578063e4cb8f5c14607a575b600080fd5b348015605957600080fd5b506060608e565b604051808215151515815260200191505060405180910390f35b348015608557600080fd5b50608c60a0565b005b6000809054906101000a900460ff1681565b60016000806101000a81548160ff0219169083151502179055505600a165627a7a723058205362c7376eda918b0dc3a75d0ffab904a241c9b10b68d5268af6ca405242303e0029" # noqa: E501 -CONTRACT_PAYABLE_TESTER_ABI = json.loads( - '[{"constant": true, "inputs": [], "name": "wasCalled", "outputs": [{"name": "", "type": "bool"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "doNoValueCall", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}]' # noqa: E501 -) - - -@pytest.fixture() -def PAYABLE_TESTER_CODE(): - return CONTRACT_PAYABLE_TESTER_CODE - - -@pytest.fixture() -def PAYABLE_TESTER_RUNTIME(): - return CONTRACT_PAYABLE_TESTER_RUNTIME - - -@pytest.fixture() -def PAYABLE_TESTER_ABI(): - return CONTRACT_PAYABLE_TESTER_ABI - - -@pytest.fixture() -def PAYABLE_TESTER_CONTRACT( - PAYABLE_TESTER_CODE, PAYABLE_TESTER_RUNTIME, PAYABLE_TESTER_ABI -): - return { - "bytecode": PAYABLE_TESTER_CODE, - "bytecode_runtime": PAYABLE_TESTER_RUNTIME, - "abi": PAYABLE_TESTER_ABI, - } - - -@pytest.fixture() -def PayableTesterContract(w3, PAYABLE_TESTER_CONTRACT): - return w3.eth.contract(**PAYABLE_TESTER_CONTRACT) - - -@pytest.fixture() -def payable_tester_contract(w3, PayableTesterContract, address_conversion_func): - return deploy(w3, PayableTesterContract, address_conversion_func) +@pytest.fixture +def payable_tester_contract(w3, address_conversion_func): + payable_tester_contract_instance = w3.eth.contract(**PAYABLE_TESTER_CONTRACT_DATA) + return deploy(w3, payable_tester_contract_instance, address_conversion_func) # no matter the function selector, this will return back the 32 bytes of data supplied -CONTRACT_REFLECTION_CODE = "0x610011566020600460003760206000f3005b61000461001103610004600039610004610011036000f3" # noqa: E501 +FIXED_REFLECTOR_CONTRACT_BYTECODE = "0x610011566020600460003760206000f3005b61000461001103610004600039610004610011036000f3" # noqa: E501 # reference source used to generate it: LLL_SOURCE = "['seq', ['return', 0, ['lll', ['seq', ['calldatacopy', 0, 4, 32], ['return', 0, 32], 'stop' ], 0]]])" # noqa: E501 -CONTRACT_FIXED_ABI = [ +FIXED_REFLECTOR_CONTRACT_ABI = [ { "type": "function", "constant": False, @@ -832,274 +295,52 @@ def payable_tester_contract(w3, PayableTesterContract, address_conversion_func): @pytest.fixture -def FixedReflectionContract(w3): - return w3.eth.contract(abi=CONTRACT_FIXED_ABI, bytecode=CONTRACT_REFLECTION_CODE) - - -@pytest.fixture() -def FALLBACK_FUNCTION_CODE(): - return CONTRACT_FALLBACK_FUNCTION_CODE - - -@pytest.fixture() -def FALLBACK_FUNCTION_RUNTIME(): - return CONTRACT_FALLBACK_FUNCTION_RUNTIME - - -@pytest.fixture() -def FALLBACK_FUNCTION_ABI(): - return CONTRACT_FALLBACK_FUNCTION_ABI - - -@pytest.fixture() -def FALLBACK_FUNCTION_CONTRACT( - FALLBACK_FUNCTION_CODE, FALLBACK_FUNCTION_RUNTIME, FALLBACK_FUNCTION_ABI -): - return { - "bytecode": FALLBACK_FUNCTION_CODE, - "bytecode_runtime": FALLBACK_FUNCTION_RUNTIME, - "abi": FALLBACK_FUNCTION_ABI, - } - - -@pytest.fixture() -def FallbackFunctionContract(w3, FALLBACK_FUNCTION_CONTRACT): - return w3.eth.contract(**FALLBACK_FUNCTION_CONTRACT) - - -@pytest.fixture() -def fallback_function_contract(w3, FallbackFunctionContract, address_conversion_func): - return deploy(w3, FallbackFunctionContract, address_conversion_func) - - -@pytest.fixture() -def RECEIVE_FUNCTION_CODE(): - return CONTRACT_RECEIVE_FUNCTION_CODE - - -@pytest.fixture() -def RECEIVE_FUNCTION_RUNTIME(): - return CONTRACT_RECEIVE_FUNCTION_RUNTIME - - -@pytest.fixture() -def RECEIVE_FUNCTION_ABI(): - return CONTRACT_RECEIVE_FUNCTION_ABI - - -@pytest.fixture() -def RECEIVE_FUNCTION_CONTRACT( - RECEIVE_FUNCTION_CODE, RECEIVE_FUNCTION_RUNTIME, RECEIVE_FUNCTION_ABI -): - return { - "bytecode": RECEIVE_FUNCTION_CODE, - "bytecode_runtime": RECEIVE_FUNCTION_RUNTIME, - "abi": RECEIVE_FUNCTION_ABI, - } - - -@pytest.fixture() -def NO_RECEIVE_FUNCTION_CODE(): - return CONTRACT_NO_RECEIVE_FUNCTION_CODE - - -@pytest.fixture() -def NO_RECEIVE_FUNCTION_RUNTIME(): - return CONTRACT_NO_RECEIVE_FUNCTION_RUNTIME - - -@pytest.fixture() -def NO_RECEIVE_FUNCTION_ABI(): - return CONTRACT_NO_RECEIVE_FUNCTION_ABI - - -@pytest.fixture() -def NO_RECEIVE_FUNCTION_CONTRACT( - NO_RECEIVE_FUNCTION_CODE, NO_RECEIVE_FUNCTION_RUNTIME, NO_RECEIVE_FUNCTION_ABI -): - return { - "bytecode": NO_RECEIVE_FUNCTION_CODE, - "bytecode_runtime": NO_RECEIVE_FUNCTION_RUNTIME, - "abi": NO_RECEIVE_FUNCTION_ABI, - } - - -@pytest.fixture() -def NoReceiveFunctionContract(w3, NO_RECEIVE_FUNCTION_CONTRACT): - return w3.eth.contract(**NO_RECEIVE_FUNCTION_CONTRACT) - - -@pytest.fixture() -def no_receive_function_contract( - w3, NoReceiveFunctionContract, address_conversion_func -): - return deploy(w3, NoReceiveFunctionContract, address_conversion_func) - - -@pytest.fixture() -def ReceiveFunctionContract(w3, RECEIVE_FUNCTION_CONTRACT): - return w3.eth.contract(**RECEIVE_FUNCTION_CONTRACT) - - -@pytest.fixture() -def receive_function_contract(w3, ReceiveFunctionContract, address_conversion_func): - return deploy(w3, ReceiveFunctionContract, address_conversion_func) - - -CONTRACT_CALLER_TESTER_SOURCE = """ -contract CallerTester { - int public count; - - function add(int256 a, int256 b) public payable returns (int256) { - return a + b; - } - - function increment() public returns (int256) { - return count += 1; - } - - function counter() public payable returns (int256) { - return count; - } - - function returnMeta() public payable returns (address, bytes memory, uint256, uint, uint) { # noqa: E501 - return (msg.sender, msg.data, gasleft(), msg.value, block.number); - } -} -""" - - -CONTRACT_CALLER_TESTER_CODE = "608060405234801561001057600080fd5b50610241806100206000396000f3fe608060405260043610610066577c0100000000000000000000000000000000000000000000000000000000600035046306661abd811461006b57806361bc221a14610092578063a5f3c23b1461009a578063c7fa7d66146100bd578063d09de08a14610185575b600080fd5b34801561007757600080fd5b5061008061019a565b60408051918252519081900360200190f35b6100806101a0565b610080600480360360408110156100b057600080fd5b50803590602001356101a6565b6100c56101aa565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001858152602001848152602001838152602001828103825286818151815260200191508051906020019080838360005b8381101561014657818101518382015260200161012e565b50505050905090810190601f1680156101735780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34801561019157600080fd5b50610080610207565b60005481565b60005490565b0190565b600060606000806000336000365a344385955084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250989e929d50949b5092995090975095505050505050565b60008054600101908190559056fea165627a7a72305820ffe1620e420efa326b9c5e4ef9f93cac71cf986196246c7966d71a39259899b10029" # noqa: E501 -CONTRACT_CALLER_TESTER_RUNTIME = "608060405260043610610066577c0100000000000000000000000000000000000000000000000000000000600035046306661abd811461006b57806361bc221a14610092578063a5f3c23b1461009a578063c7fa7d66146100bd578063d09de08a14610185575b600080fd5b34801561007757600080fd5b5061008061019a565b60408051918252519081900360200190f35b6100806101a0565b610080600480360360408110156100b057600080fd5b50803590602001356101a6565b6100c56101aa565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001858152602001848152602001838152602001828103825286818151815260200191508051906020019080838360005b8381101561014657818101518382015260200161012e565b50505050905090810190601f1680156101735780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34801561019157600080fd5b50610080610207565b60005481565b60005490565b0190565b600060606000806000336000365a344385955084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250989e929d50949b5092995090975095505050505050565b60008054600101908190559056fea165627a7a72305820ffe1620e420efa326b9c5e4ef9f93cac71cf986196246c7966d71a39259899b10029" # noqa: E501 -CONTRACT_CALLER_TESTER_ABI = json.loads( - '[ { "constant": true, "inputs": [], "name": "count", "outputs": [ { "name": "", "type": "int256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "counter", "outputs": [ { "name": "", "type": "int256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "a", "type": "int256" }, { "name": "b", "type": "int256" } ], "name": "add", "outputs": [ { "name": "", "type": "int256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [], "name": "returnMeta", "outputs": [ { "name": "", "type": "address" }, { "name": "", "type": "bytes" }, { "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }, { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [], "name": "increment", "outputs": [ { "name": "", "type": "int256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" } ]' # noqa: E501 -) - - -@pytest.fixture() -def CALLER_TESTER_CODE(): - return CONTRACT_CALLER_TESTER_CODE - - -@pytest.fixture() -def CALLER_TESTER_RUNTIME(): - return CONTRACT_CALLER_TESTER_RUNTIME - - -@pytest.fixture() -def CALLER_TESTER_ABI(): - return CONTRACT_CALLER_TESTER_ABI - - -@pytest.fixture() -def CALLER_TESTER_CONTRACT( - CALLER_TESTER_CODE, CALLER_TESTER_RUNTIME, CALLER_TESTER_ABI -): - return { - "bytecode": CALLER_TESTER_CODE, - "bytecode_runtime": CALLER_TESTER_RUNTIME, - "abi": CALLER_TESTER_ABI, - } - - -@pytest.fixture() -def CallerTesterContract(w3, CALLER_TESTER_CONTRACT): - return w3.eth.contract(**CALLER_TESTER_CONTRACT) +def fixed_reflector_contract(w3, address_conversion_func): + fixed_reflector_contract_instance = w3.eth.contract( + abi=FIXED_REFLECTOR_CONTRACT_ABI, bytecode=FIXED_REFLECTOR_CONTRACT_BYTECODE + ) + return deploy(w3, fixed_reflector_contract_instance, address_conversion_func) -@pytest.fixture() -def REVERT_CONTRACT_CODE(): - return REVERT_CONTRACT_BYTECODE +@pytest.fixture +def fallback_function_contract(w3, address_conversion_func): + fallback_function_contract_instance = w3.eth.contract( + **FALLBACK_FUNCTION_CONTRACT_DATA + ) + return deploy(w3, fallback_function_contract_instance, address_conversion_func) -@pytest.fixture() -def REVERT_CONTRACT_RUNTIME(): - return REVERT_CONTRACT_RUNTIME_CODE +@pytest.fixture +def receive_function_contract(w3, address_conversion_func): + receive_function_contract_instance = w3.eth.contract( + **RECEIVE_FUNCTION_CONTRACT_DATA + ) + return deploy(w3, receive_function_contract_instance, address_conversion_func) -@pytest.fixture() -def REVERT_CONTRACT_ABI(): - return _REVERT_CONTRACT_ABI +@pytest.fixture +def no_receive_function_contract(w3, address_conversion_func): + no_receive_function_contract_instance = w3.eth.contract( + **NO_RECEIVE_FUNCTION_CONTRACT_DATA + ) + return deploy(w3, no_receive_function_contract_instance, address_conversion_func) -@pytest.fixture() -def REVERT_FUNCTION_CONTRACT( - REVERT_CONTRACT_CODE, REVERT_CONTRACT_RUNTIME, REVERT_CONTRACT_ABI -): - return { - "bytecode": REVERT_CONTRACT_CODE, - "bytecode_runtime": REVERT_CONTRACT_RUNTIME, - "abi": REVERT_CONTRACT_ABI, - } - - -@pytest.fixture() -def RevertContract(w3, REVERT_FUNCTION_CONTRACT): - return w3.eth.contract(**REVERT_FUNCTION_CONTRACT) - - -@pytest.fixture() -def revert_contract(w3, RevertContract, address_conversion_func): - return deploy(w3, RevertContract, address_conversion_func) - - -class LogFunctions: - LogAnonymous = 0 - LogNoArguments = 1 - LogSingleArg = 2 - LogDoubleArg = 3 - LogTripleArg = 4 - LogQuadrupleArg = 5 - LogSingleAnonymous = 6 - LogSingleWithIndex = 7 - LogDoubleAnonymous = 8 - LogDoubleWithIndex = 9 - LogTripleWithIndex = 10 - LogQuadrupleWithIndex = 11 - LogBytes = 12 - - -@pytest.fixture() -def emitter_event_ids(): - return LogFunctions - - -def _encode_to_topic(event_signature): - return event_signature_to_log_topic(event_signature) - - -class LogTopics: - LogAnonymous = _encode_to_topic("LogAnonymous()") - LogNoArguments = _encode_to_topic("LogNoArguments()") - LogSingleArg = _encode_to_topic("LogSingleArg(uint256)") - LogSingleAnonymous = _encode_to_topic("LogSingleAnonymous(uint256)") - LogSingleWithIndex = _encode_to_topic("LogSingleWithIndex(uint256)") - LogDoubleArg = _encode_to_topic("LogDoubleArg(uint256,uint256)") - LogDoubleAnonymous = _encode_to_topic("LogDoubleAnonymous(uint256,uint256)") - LogDoubleWithIndex = _encode_to_topic("LogDoubleWithIndex(uint256,uint256)") - LogTripleArg = _encode_to_topic("LogTripleArg(uint256,uint256,uint256)") - LogTripleWithIndex = _encode_to_topic("LogTripleWithIndex(uint256,uint256,uint256)") - LogQuadrupleArg = _encode_to_topic( - "LogQuadrupleArg(uint256,uint256,uint256,uint256)" - ) - LogQuadrupleWithIndex = _encode_to_topic( - "LogQuadrupleWithIndex(uint256,uint256,uint256,uint256)", +@pytest.fixture +def contract_caller_tester_contract(w3, address_conversion_func): + contract_caller_tester_contract_instance = w3.eth.contract( + **CONTRACT_CALLER_TESTER_DATA ) - LogBytes = _encode_to_topic("LogBytes(bytes)") - LogString = _encode_to_topic("LogString(string)") - LogDynamicArgs = _encode_to_topic("LogDynamicArgs(string,string)") - LogListArgs = _encode_to_topic("LogListArgs(bytes2[],bytes2[])") - LogAddressIndexed = _encode_to_topic("LogAddressIndexed(address,address)") - LogAddressNotIndexed = _encode_to_topic("LogAddressNotIndexed(address,address)") - LogStructArgs = _encode_to_topic("LogStructArgs(uint256,tuple)") + return deploy(w3, contract_caller_tester_contract_instance, address_conversion_func) -@pytest.fixture() -def emitter_log_topics(): - return LogTopics +@pytest.fixture +def revert_contract(w3, address_conversion_func): + revert_contract_instance = w3.eth.contract(**REVERT_CONTRACT_DATA) + return deploy(w3, revert_contract_instance, address_conversion_func) -@pytest.fixture() +@pytest.fixture def some_address(address_conversion_func): return address_conversion_func("0x5B2063246F2191f18F2675ceDB8b28102e957458") @@ -1147,265 +388,179 @@ def estimate_gas(request): # --- async --- # -@pytest.fixture() -def AsyncNestedTupleContract(async_w3, NESTED_TUPLE_CONTRACT): - return async_w3.eth.contract(**NESTED_TUPLE_CONTRACT) - - -@pytest.fixture() -def AsyncTupleContract(async_w3, TUPLE_CONTRACT): - return async_w3.eth.contract(**TUPLE_CONTRACT) +@pytest.fixture +def async_math_contract_instance(async_w3): + return async_w3.eth.contract(**MATH_CONTRACT_DATA) -@pytest.fixture() -def AsyncMathContract( - async_w3, math_contract_abi, math_contract_bytecode, math_contract_runtime +@pytest_asyncio.fixture +async def async_math_contract( + async_w3, async_math_contract_instance, address_conversion_func ): - return async_w3.eth.contract( - abi=math_contract_abi, - bytecode=math_contract_bytecode, - bytecode_runtime=math_contract_runtime, + return await async_deploy( + async_w3, async_math_contract_instance, address_conversion_func ) -@pytest_asyncio.fixture() -async def async_math_contract(async_w3, AsyncMathContract, address_conversion_func): - return await async_deploy(async_w3, AsyncMathContract, address_conversion_func) +@pytest.fixture +def async_simple_constructor_contract_instance(async_w3): + return async_w3.eth.contract(**SIMPLE_CONSTRUCTOR_CONTRACT_DATA) -@pytest.fixture() -def AsyncSimpleConstructorContract( - async_w3, - simple_constructor_contract_bytecode, - simple_constructor_contract_runtime, - simple_constructor_contract_abi, -): - return async_w3.eth.contract( - abi=simple_constructor_contract_abi, - bytecode=simple_constructor_contract_bytecode, - bytecode_runtime=simple_constructor_contract_runtime, - ) +@pytest.fixture +def async_constructor_with_args_contract_instance(async_w3): + return async_w3.eth.contract(**CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA) -@pytest.fixture() -def AsyncWithConstructorArgumentsContract( - async_w3, - contract_with_constructor_args_bytecode, - contract_with_constructor_args_runtime, - contract_with_constructor_args_abi, -): - return async_w3.eth.contract( - abi=contract_with_constructor_args_abi, - bytecode=contract_with_constructor_args_bytecode, - bytecode_runtime=contract_with_constructor_args_runtime, +@pytest.fixture +def async_non_strict_constructor_with_args_contract_instance(async_w3_non_strict_abi): + return async_w3_non_strict_abi.eth.contract( + **CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA ) -@pytest.fixture() -def AsyncNonStrictWithConstructorArgumentsContract( - async_w3_non_strict_abi, - contract_with_constructor_args_bytecode, - contract_with_constructor_args_runtime, - contract_with_constructor_args_abi, -): - return async_w3_non_strict_abi.eth.contract( - abi=contract_with_constructor_args_abi, - bytecode=contract_with_constructor_args_bytecode, - bytecode_runtime=contract_with_constructor_args_runtime, - ) +@pytest.fixture +def async_constructor_with_address_arg_contract_instance(async_w3): + return async_w3.eth.contract(**CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA) -@pytest.fixture() -def AsyncWithConstructorAddressArgumentsContract( +@pytest_asyncio.fixture +async def async_constructor_with_address_argument_contract( async_w3, - contract_with_constructor_address_bytecode, - contract_with_constructor_address_runtime, - contract_with_constructor_address_abi, + address_conversion_func, ): - return async_w3.eth.contract( - abi=contract_with_constructor_address_abi, - bytecode=contract_with_constructor_address_bytecode, - bytecode_runtime=contract_with_constructor_address_runtime, + async_constructor_with_address_arg_instance = async_w3.eth.contract( + **CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA ) - - -@pytest_asyncio.fixture() -async def async_address_contract( - async_w3, AsyncWithConstructorAddressArgumentsContract, address_conversion_func -): return await async_deploy( async_w3, - AsyncWithConstructorAddressArgumentsContract, + async_constructor_with_address_arg_instance, address_conversion_func, args=["0xd3CdA913deB6f67967B99D67aCDFa1712C293601"], ) -@pytest.fixture() -def AsyncAddressReflectorContract(async_w3): - return async_w3.eth.contract( - abi=ADDRESS_REFLECTOR_CONTRACT_ABI, - bytecode=ADDRESS_REFLECTOR_CONTRACT_BYTECODE, - bytecode_runtime=ADDRESS_REFLECTOR_CONTRACT_RUNTIME, +@pytest_asyncio.fixture +async def async_address_reflector_contract(async_w3, address_conversion_func): + async_address_reflector_contract_instance = async_w3.eth.contract( + **ADDRESS_REFLECTOR_CONTRACT_DATA, ) - - -@pytest_asyncio.fixture() -async def async_address_reflector_contract( - async_w3, AsyncAddressReflectorContract, address_conversion_func -): return await async_deploy( - async_w3, AsyncAddressReflectorContract, address_conversion_func + async_w3, async_address_reflector_contract_instance, address_conversion_func ) -@pytest.fixture() -def AsyncStringContract(async_w3, string_contract_kwargs): - return async_w3.eth.contract(**string_contract_kwargs) +@pytest.fixture +def async_string_contract_instance(async_w3): + return async_w3.eth.contract(**STRING_CONTRACT_DATA) -@pytest_asyncio.fixture() -async def async_string_contract(async_w3, AsyncStringContract, address_conversion_func): +@pytest_asyncio.fixture +async def async_string_contract( + async_w3, async_string_contract_instance, address_conversion_func +): return await async_deploy( - async_w3, AsyncStringContract, address_conversion_func, args=["Caqalai"] + async_w3, + async_string_contract_instance, + address_conversion_func, + args=["Caqalai"], ) -@pytest.fixture() -def AsyncBytesContract(async_w3, bytes_contract_kwargs): - return async_w3.eth.contract(**bytes_contract_kwargs) - - -@pytest.fixture() -def AsyncNonStrictBytesContract(async_w3_non_strict_abi, bytes_contract_kwargs): - return async_w3_non_strict_abi.eth.contract(**bytes_contract_kwargs) - - -@pytest.fixture() -def AsyncBytes32Contract(async_w3, bytes32_contract_kwargs): - return async_w3.eth.contract(**bytes32_contract_kwargs) - - -@pytest.fixture() -def AsyncArraysContract(async_w3, ARRAYS_CONTRACT): - return async_w3.eth.contract(**ARRAYS_CONTRACT) - - -@pytest_asyncio.fixture() -async def async_arrays_contract(async_w3, AsyncArraysContract, address_conversion_func): - # bytes_32 = [keccak('0'), keccak('1')] - bytes32_array = [ - b"\x04HR\xb2\xa6p\xad\xe5@~x\xfb(c\xc5\x1d\xe9\xfc\xb9eB\xa0q\x86\xfe:\xed\xa6\xbb\x8a\x11m", # noqa: E501 - b"\xc8\x9e\xfd\xaaT\xc0\xf2\x0cz\xdfa(\x82\xdf\tP\xf5\xa9Qc~\x03\x07\xcd\xcbLg/)\x8b\x8b\xc6", # noqa: E501 - ] - byte_arr = [b"\xff", b"\xff", b"\xff", b"\xff"] +@pytest_asyncio.fixture +async def async_arrays_contract(async_w3, address_conversion_func): + async_arrays_contract_instance = async_w3.eth.contract(**ARRAYS_CONTRACT_DATA) return await async_deploy( async_w3, - AsyncArraysContract, + async_arrays_contract_instance, address_conversion_func, - args=[bytes32_array, byte_arr], + args=[BYTES32_ARRAY, BYTES1_ARRAY], ) -@pytest.fixture() -def AsyncNonStrictArraysContract(async_w3_non_strict_abi, ARRAYS_CONTRACT): - return async_w3_non_strict_abi.eth.contract(**ARRAYS_CONTRACT) - - -@pytest_asyncio.fixture() +@pytest_asyncio.fixture async def async_non_strict_arrays_contract( - async_w3_non_strict_abi, AsyncNonStrictArraysContract, address_conversion_func + async_w3_non_strict_abi, address_conversion_func ): - # bytes_32 = [keccak('0'), keccak('1')] - bytes32_array = [ - b"\x04HR\xb2\xa6p\xad\xe5@~x\xfb(c\xc5\x1d\xe9\xfc\xb9eB\xa0q\x86\xfe:\xed\xa6\xbb\x8a\x11m", # noqa: E501 - b"\xc8\x9e\xfd\xaaT\xc0\xf2\x0cz\xdfa(\x82\xdf\tP\xf5\xa9Qc~\x03\x07\xcd\xcbLg/)\x8b\x8b\xc6", # noqa: E501 - ] - byte_arr = [b"\xff", b"\xff", b"\xff", b"\xff"] + async_non_strict_arrays_contract_instance = async_w3_non_strict_abi.eth.contract( + **ARRAYS_CONTRACT_DATA, + ) return await async_deploy( async_w3_non_strict_abi, - AsyncNonStrictArraysContract, + async_non_strict_arrays_contract_instance, address_conversion_func, - args=[bytes32_array, byte_arr], + args=[BYTES32_ARRAY, BYTES1_ARRAY], ) -@pytest.fixture() -def AsyncPayableTesterContract(async_w3, PAYABLE_TESTER_CONTRACT): - return async_w3.eth.contract(**PAYABLE_TESTER_CONTRACT) - - -@pytest_asyncio.fixture() -async def async_payable_tester_contract( - async_w3, AsyncPayableTesterContract, address_conversion_func -): +@pytest_asyncio.fixture +async def async_payable_tester_contract(async_w3, address_conversion_func): + async_payable_tester_contract_instance = async_w3.eth.contract( + **PAYABLE_TESTER_CONTRACT_DATA + ) return await async_deploy( - async_w3, AsyncPayableTesterContract, address_conversion_func + async_w3, async_payable_tester_contract_instance, address_conversion_func ) -@pytest.fixture -def AsyncFixedReflectionContract(async_w3): - return async_w3.eth.contract( - abi=CONTRACT_FIXED_ABI, bytecode=CONTRACT_REFLECTION_CODE +@pytest_asyncio.fixture +async def async_fixed_reflector_contract(async_w3, address_conversion_func): + async_fixed_reflector_contract_instance = async_w3.eth.contract( + abi=FIXED_REFLECTOR_CONTRACT_ABI, bytecode=FIXED_REFLECTOR_CONTRACT_BYTECODE ) - - -@pytest.fixture() -def AsyncFallbackFunctionContract(async_w3, FALLBACK_FUNCTION_CONTRACT): - return async_w3.eth.contract(**FALLBACK_FUNCTION_CONTRACT) - - -@pytest_asyncio.fixture() -async def async_fallback_function_contract( - async_w3, AsyncFallbackFunctionContract, address_conversion_func -): return await async_deploy( - async_w3, AsyncFallbackFunctionContract, address_conversion_func + async_w3, async_fixed_reflector_contract_instance, address_conversion_func ) -@pytest.fixture() -def AsyncNoReceiveFunctionContract(async_w3, NO_RECEIVE_FUNCTION_CONTRACT): - return async_w3.eth.contract(**NO_RECEIVE_FUNCTION_CONTRACT) - - -@pytest_asyncio.fixture() -async def async_no_receive_function_contract( - async_w3, AsyncNoReceiveFunctionContract, address_conversion_func -): +@pytest_asyncio.fixture +async def async_fallback_function_contract(async_w3, address_conversion_func): + async_fallback_function_contract_instance = async_w3.eth.contract( + **FALLBACK_FUNCTION_CONTRACT_DATA + ) return await async_deploy( - async_w3, AsyncNoReceiveFunctionContract, address_conversion_func + async_w3, async_fallback_function_contract_instance, address_conversion_func ) -@pytest.fixture() -def AsyncReceiveFunctionContract(async_w3, RECEIVE_FUNCTION_CONTRACT): - return async_w3.eth.contract(**RECEIVE_FUNCTION_CONTRACT) - - -@pytest_asyncio.fixture() -async def async_receive_function_contract( - async_w3, AsyncReceiveFunctionContract, address_conversion_func -): +@pytest_asyncio.fixture +async def async_no_receive_function_contract(async_w3, address_conversion_func): + async_no_receive_function_contract_instance = async_w3.eth.contract( + **NO_RECEIVE_FUNCTION_CONTRACT_DATA + ) return await async_deploy( - async_w3, AsyncReceiveFunctionContract, address_conversion_func + async_w3, async_no_receive_function_contract_instance, address_conversion_func ) -@pytest.fixture() -def AsyncCallerTesterContract(async_w3, CALLER_TESTER_CONTRACT): - return async_w3.eth.contract(**CALLER_TESTER_CONTRACT) +@pytest_asyncio.fixture +async def async_receive_function_contract(async_w3, address_conversion_func): + async_receive_function_contract_instance = async_w3.eth.contract( + **RECEIVE_FUNCTION_CONTRACT_DATA + ) + return await async_deploy( + async_w3, async_receive_function_contract_instance, address_conversion_func + ) -@pytest.fixture() -def AsyncRevertContract(async_w3, REVERT_FUNCTION_CONTRACT): - return async_w3.eth.contract(**REVERT_FUNCTION_CONTRACT) +@pytest_asyncio.fixture +async def async_contract_caller_tester_contract(async_w3, address_conversion_func): + async_contract_caller_tester_contract_instance = async_w3.eth.contract( + **CONTRACT_CALLER_TESTER_DATA + ) + return await async_deploy( + async_w3, + async_contract_caller_tester_contract_instance, + address_conversion_func, + ) -@pytest_asyncio.fixture() -async def async_revert_contract(async_w3, AsyncRevertContract, address_conversion_func): - return await async_deploy(async_w3, AsyncRevertContract, address_conversion_func) +@pytest_asyncio.fixture +async def async_revert_contract(async_w3, address_conversion_func): + async_revert_contract_instance = async_w3.eth.contract(**REVERT_CONTRACT_DATA) + return await async_deploy( + async_w3, async_revert_contract_instance, address_conversion_func + ) async def async_invoke_contract( @@ -1430,21 +585,21 @@ async def async_invoke_contract( return result -@pytest.fixture() +@pytest.fixture def async_build_transaction(request): return async_partial(async_invoke_contract, api_call_desig="build_transaction") -@pytest.fixture() +@pytest.fixture def async_transact(request): return async_partial(async_invoke_contract, api_call_desig="transact") -@pytest.fixture() +@pytest.fixture def async_call(request): return async_partial(async_invoke_contract, api_call_desig="call") -@pytest.fixture() +@pytest.fixture def async_estimate_gas(request): return async_partial(async_invoke_contract, api_call_desig="estimate_gas") diff --git a/tests/core/contracts/test_contract_ambiguous_functions.py b/tests/core/contracts/test_contract_ambiguous_functions.py index ffb474b5ef..14b5bf1feb 100644 --- a/tests/core/contracts/test_contract_ambiguous_functions.py +++ b/tests/core/contracts/test_contract_ambiguous_functions.py @@ -45,7 +45,7 @@ ] -@pytest.fixture() +@pytest.fixture def string_contract(w3, string_contract_instance, address_conversion_func): deploy_txn = string_contract_instance.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) diff --git a/tests/core/contracts/test_contract_build_transaction.py b/tests/core/contracts/test_contract_build_transaction.py index 2d6390044b..ad86a20b8b 100644 --- a/tests/core/contracts/test_contract_build_transaction.py +++ b/tests/core/contracts/test_contract_build_transaction.py @@ -325,10 +325,13 @@ async def test_async_build_transaction_with_contract_fallback_function( @pytest.mark.asyncio async def test_async_build_transaction_with_contract_class_method( - async_w3, AsyncMathContract, async_math_contract, async_build_transaction + async_w3, + async_math_contract_instance, + async_math_contract, + async_build_transaction, ): txn = await async_build_transaction( - contract=AsyncMathContract, + contract=async_math_contract_instance, contract_function="incrementCounter", tx_params={"to": async_math_contract.address}, ) diff --git a/tests/core/contracts/test_contract_call_interface.py b/tests/core/contracts/test_contract_call_interface.py index 2fdac82a3e..ef2f785f09 100644 --- a/tests/core/contracts/test_contract_call_interface.py +++ b/tests/core/contracts/test_contract_call_interface.py @@ -20,6 +20,14 @@ async_deploy, deploy, ) +from web3._utils.contract_sources.contract_data.bytes_contracts import ( + BYTES32_CONTRACT_DATA, + BYTES_CONTRACT_DATA, +) +from web3._utils.contract_sources.contract_data.tuple_contracts import ( + NESTED_TUPLE_CONTRACT_DATA, + TUPLE_CONTRACT_DATA, +) from web3._utils.ens import ( contract_ens_addresses, ) @@ -40,44 +48,66 @@ ) +@pytest.fixture +def tuple_contract(w3, address_conversion_func): + tuple_contract_instance = w3.eth.contract(**TUPLE_CONTRACT_DATA) + return deploy(w3, tuple_contract_instance, address_conversion_func) + + +@pytest.fixture +def nested_tuple_contract(w3, address_conversion_func): + nested_tuple_contract_instance = w3.eth.contract(**NESTED_TUPLE_CONTRACT_DATA) + return deploy(w3, nested_tuple_contract_instance, address_conversion_func) + + @pytest.fixture(params=[b"\x04\x06", "0x0406"]) -def bytes_contract(w3, bytes_contract, request, address_conversion_func): - return deploy(w3, bytes_contract, address_conversion_func, args=[request.param]) +def bytes_contract(w3, request, address_conversion_func): + bytes_contract_instance = w3.eth.contract(**BYTES_CONTRACT_DATA) + return deploy( + w3, bytes_contract_instance, address_conversion_func, args=[request.param] + ) @pytest.fixture(params=[b"\x04\x06", "0x0406"]) def non_strict_bytes_contract( - w3_non_strict_abi, non_strict_bytes_contract, request, address_conversion_func + w3_non_strict_abi, + request, + address_conversion_func, ): + non_strict_bytes_contract_instance = w3_non_strict_abi.eth.contract( + **BYTES_CONTRACT_DATA + ) return deploy( w3_non_strict_abi, - non_strict_bytes_contract, + non_strict_bytes_contract_instance, address_conversion_func, args=[request.param], ) -@pytest.fixture() -def fixed_reflection_contract(w3, FixedReflectionContract, address_conversion_func): - return deploy(w3, FixedReflectionContract, address_conversion_func) - - -@pytest.fixture() +@pytest.fixture def call_transaction(): return {"data": "0x61bc221a", "to": "0xc305c901078781C232A2a521C2aF7980f8385ee9"} +@pytest.fixture +def bytes32_contract_instance(w3): + return w3.eth.contract(**BYTES32_CONTRACT_DATA) + + @pytest.fixture( params=[ "0x0406040604060406040604060406040604060406040604060406040604060406", HexBytes("0406040604060406040604060406040604060406040604060406040604060406"), ] ) -def bytes32_contract(w3, bytes32_contract, request, address_conversion_func): - return deploy(w3, bytes32_contract, address_conversion_func, args=[request.param]) +def bytes32_contract(w3, bytes32_contract_instance, request, address_conversion_func): + return deploy( + w3, bytes32_contract_instance, address_conversion_func, args=[request.param] + ) -@pytest.fixture() +@pytest.fixture def undeployed_math_contract(math_contract_instance, address_conversion_func): empty_address = address_conversion_func( "0x000000000000000000000000000000000000dEaD" @@ -86,7 +116,7 @@ def undeployed_math_contract(math_contract_instance, address_conversion_func): return _undeployed_math_contract -@pytest.fixture() +@pytest.fixture def mismatched_math_contract( w3, string_contract_instance, math_contract_instance, address_conversion_func ): @@ -98,23 +128,13 @@ def mismatched_math_contract( return _mismatched_math_contract -@pytest.fixture() -def tuple_contract(w3, TupleContract, address_conversion_func): - return deploy(w3, TupleContract, address_conversion_func) - - -@pytest.fixture() -def nested_tuple_contract(w3, NestedTupleContract, address_conversion_func): - return deploy(w3, NestedTupleContract, address_conversion_func) - - def test_deploy_raises_due_to_strict_byte_checking_by_default( - w3, bytes32_contract, address_conversion_func + w3, bytes32_contract_instance, address_conversion_func ): with pytest.raises(TypeError): deploy( w3, - bytes32_contract, + bytes32_contract_instance, address_conversion_func, args=["0406040604060406040604060406040604060406040604060406040604060406"], ) @@ -455,6 +475,8 @@ def test_call_rejects_invalid_ens_name(address_reflector_contract, call): def test_call_missing_function(mismatched_math_contract, call): + # note: contract being called needs to have a fallback function + # (StringContract in this case) expected_missing_function_error_message = "Could not decode contract function call" with pytest.raises(BadFunctionCallOutput) as exception_info: call(contract=mismatched_math_contract, contract_function="return13") @@ -728,8 +750,8 @@ def test_call_sending_ether_to_nonpayable_function(payable_tester_contract, call ("reflect_short_u", Decimal("25.5")), ), ) -def test_reflect_fixed_value(fixed_reflection_contract, function, value): - contract_func = fixed_reflection_contract.functions[function] +def test_reflect_fixed_value(fixed_reflector_contract, function, value): + contract_func = fixed_reflector_contract.functions[function] reflected = contract_func(value).call({"gas": 420000}) assert reflected == value @@ -767,9 +789,9 @@ def test_reflect_fixed_value(fixed_reflection_contract, function, value): ), ) def test_invalid_fixed_value_reflections( - fixed_reflection_contract, function, value, error + fixed_reflector_contract, function, value, error ): - contract_func = fixed_reflection_contract.functions[function] + contract_func = fixed_reflector_contract.functions[function] with pytest.raises(Web3ValidationError, match=error): contract_func(value).call({"gas": 420000}) @@ -992,18 +1014,40 @@ def test_changing_default_block_identifier(w3, math_contract): @pytest_asyncio.fixture -async def async_bytes_contract(async_w3, AsyncBytesContract, address_conversion_func): +async def async_tuple_contract(async_w3, address_conversion_func): + async_tuple_contract_instance = async_w3.eth.contract(**TUPLE_CONTRACT_DATA) + return await async_deploy( + async_w3, async_tuple_contract_instance, address_conversion_func + ) + + +@pytest_asyncio.fixture +async def async_nested_tuple_contract(async_w3, address_conversion_func): + async_nested_tuple_contract_instance = async_w3.eth.contract( + **NESTED_TUPLE_CONTRACT_DATA + ) return await async_deploy( - async_w3, AsyncBytesContract, address_conversion_func, args=[b"\x04\x06"] + async_w3, async_nested_tuple_contract_instance, address_conversion_func ) -@pytest_asyncio.fixture() -async def async_fixed_reflection_contract( - async_w3, AsyncFixedReflectionContract, address_conversion_func +@pytest.fixture +def async_bytes_contract_instance(async_w3): + return async_w3.eth.contract(**BYTES_CONTRACT_DATA) + + +@pytest_asyncio.fixture(params=[b"\x04\x06", "0x0406"]) +async def async_bytes_contract( + async_w3, + request, + async_bytes_contract_instance, + address_conversion_func, ): return await async_deploy( - async_w3, AsyncFixedReflectionContract, address_conversion_func + async_w3, + async_bytes_contract_instance, + address_conversion_func, + args=[request.param], ) @@ -1011,57 +1055,48 @@ async def async_fixed_reflection_contract( params=[ "0x0406040604060406040604060406040604060406040604060406040604060406", HexBytes("0406040604060406040604060406040604060406040604060406040604060406"), - ] + ], ) -async def async_bytes32_contract( - async_w3, AsyncBytes32Contract, request, address_conversion_func -): +async def async_bytes32_contract(async_w3, request, address_conversion_func): + async_bytes32_contract_instance = async_w3.eth.contract(**BYTES32_CONTRACT_DATA) return await async_deploy( async_w3, - AsyncBytes32Contract, + async_bytes32_contract_instance, address_conversion_func, args=[request.param], ) -@pytest_asyncio.fixture() -async def async_undeployed_math_contract(AsyncMathContract, address_conversion_func): +@pytest_asyncio.fixture +async def async_undeployed_math_contract( + async_math_contract_instance, address_conversion_func +): empty_address = address_conversion_func( "0x000000000000000000000000000000000000dEaD" ) - _undeployed_math_contract = AsyncMathContract(address=empty_address) + _undeployed_math_contract = async_math_contract_instance(address=empty_address) return _undeployed_math_contract -@pytest_asyncio.fixture() +@pytest_asyncio.fixture async def async_mismatched_math_contract( - async_w3, AsyncStringContract, AsyncMathContract, address_conversion_func + async_w3, + async_string_contract_instance, + async_math_contract_instance, + address_conversion_func, ): - deploy_txn = await AsyncStringContract.constructor("Caqalai").transact() + deploy_txn = await async_string_contract_instance.constructor("Caqalai").transact() deploy_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = address_conversion_func(deploy_receipt["contractAddress"]) - _mismatched_math_contract = AsyncMathContract(address=address) + _mismatched_math_contract = async_math_contract_instance(address=address) return _mismatched_math_contract -@pytest_asyncio.fixture() -async def async_tuple_contract(async_w3, AsyncTupleContract, address_conversion_func): - return await async_deploy(async_w3, AsyncTupleContract, address_conversion_func) - - -@pytest_asyncio.fixture() -async def async_nested_tuple_contract( - async_w3, AsyncNestedTupleContract, address_conversion_func -): - return await async_deploy( - async_w3, AsyncNestedTupleContract, address_conversion_func - ) - - +@pytest.fixture @pytest.mark.asyncio async def test_async_deploy_raises_due_to_strict_byte_checking_by_default( - async_w3, AsyncBytesContract, address_conversion_func + async_w3, async_bytes_contract_instance, address_conversion_func ): with pytest.raises( TypeError, @@ -1069,7 +1104,10 @@ async def test_async_deploy_raises_due_to_strict_byte_checking_by_default( "Expected types are: bytes", ): await async_deploy( - async_w3, AsyncBytesContract, address_conversion_func, args=["0406"] + async_w3, + async_bytes_contract_instance, + address_conversion_func, + args=["0406"], ) @@ -1077,13 +1115,15 @@ async def test_async_deploy_raises_due_to_strict_byte_checking_by_default( @pytest.mark.parametrize("args", ("0x0406", "0406", HexBytes("0406"), b"\x04\x06")) async def test_async_deploy_with_non_strict_abi_check( async_w3_non_strict_abi, - AsyncNonStrictBytesContract, address_conversion_func, args, ): + async_non_strict_bytes_contract_instance = async_w3_non_strict_abi.eth.contract( + **BYTES_CONTRACT_DATA + ) deployed_contract = await async_deploy( async_w3_non_strict_abi, - AsyncNonStrictBytesContract, + async_non_strict_bytes_contract_instance, address_conversion_func, args=[args], ) @@ -1093,10 +1133,10 @@ async def test_async_deploy_with_non_strict_abi_check( @pytest.mark.asyncio async def test_async_invalid_address_in_deploy_arg( - AsyncWithConstructorAddressArgumentsContract, + async_constructor_with_address_arg_contract_instance, ): with pytest.raises(InvalidAddress): - await AsyncWithConstructorAddressArgumentsContract.constructor( + await async_constructor_with_address_arg_contract_instance.constructor( "0xd3cda913deb6f67967b99d67acdfa1712c293601", ).transact() @@ -1255,9 +1295,12 @@ async def test_async_call_get_byte_const_array_non_strict( @pytest.mark.asyncio -async def test_async_call_read_address_variable(async_address_contract, async_call): +async def test_async_call_read_address_variable( + async_constructor_with_address_argument_contract, async_call +): result = await async_call( - contract=async_address_contract, contract_function="testAddr" + contract=async_constructor_with_address_argument_contract, + contract_function="testAddr", ) assert result == "0xd3CdA913deB6f67967B99D67aCDFa1712C293601" @@ -1265,15 +1308,15 @@ async def test_async_call_read_address_variable(async_address_contract, async_ca @pytest.mark.xfail @pytest.mark.asyncio async def test_async_init_with_ens_name_arg( - async_w3, AsyncWithConstructorAddressArgumentsContract, async_call + async_w3, async_constructor_with_address_arg_contract_instance, async_call ): with contract_ens_addresses( - AsyncWithConstructorAddressArgumentsContract, + async_constructor_with_address_arg_contract_instance, [("arg-name.eth", "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413")], ): address_contract = await async_deploy( async_w3, - AsyncWithConstructorAddressArgumentsContract, + async_constructor_with_address_arg_contract_instance, args=[ "arg-name.eth", ], @@ -1461,6 +1504,8 @@ async def test_async_call_rejects_invalid_ens_name( @pytest.mark.asyncio async def test_async_call_missing_function(async_mismatched_math_contract, async_call): + # note: contract being called needs to have a fallback function + # (StringContract in this case) expected_missing_function_error_message = "Could not decode contract function call" with pytest.raises(BadFunctionCallOutput) as exception_info: await async_call( @@ -1687,9 +1732,9 @@ async def test_async_call_sending_ether_to_nonpayable_function( ), ) async def test_async_reflect_fixed_value( - async_fixed_reflection_contract, function, value + async_fixed_reflector_contract, function, value ): - contract_func = async_fixed_reflection_contract.functions[function] + contract_func = async_fixed_reflector_contract.functions[function] reflected = await contract_func(value).call({"gas": 420000}) assert reflected == value @@ -1728,9 +1773,9 @@ async def test_async_reflect_fixed_value( ), ) async def test_async_invalid_fixed_value_reflections( - async_fixed_reflection_contract, function, value, error + async_fixed_reflector_contract, function, value, error ): - contract_func = async_fixed_reflection_contract.functions[function] + contract_func = async_fixed_reflector_contract.functions[function] with pytest.raises(Web3ValidationError, match=error): await contract_func(value).call({"gas": 420000}) diff --git a/tests/core/contracts/test_contract_caller_interface.py b/tests/core/contracts/test_contract_caller_interface.py index 90245a127d..a644f3b081 100644 --- a/tests/core/contracts/test_contract_caller_interface.py +++ b/tests/core/contracts/test_contract_caller_interface.py @@ -1,11 +1,5 @@ import pytest -import pytest_asyncio - -from tests.core.contracts.utils import ( - async_deploy, - deploy, -) from web3.exceptions import ( MismatchedABI, NoABIFound, @@ -18,20 +12,6 @@ def address(w3): return w3.eth.accounts[1] -@pytest.fixture() -def caller_tester_contract(w3, CallerTesterContract, address_conversion_func): - return deploy(w3, CallerTesterContract, address_conversion_func) - - -@pytest_asyncio.fixture() -async def async_caller_tester_contract( - async_w3, AsyncCallerTesterContract, address_conversion_func -): - return await async_deploy( - async_w3, AsyncCallerTesterContract, address_conversion_func - ) - - @pytest.fixture() def transaction_dict(w3, address): return { @@ -109,16 +89,16 @@ def test_caller_with_block_identifier(w3, math_contract): def test_caller_with_block_identifier_and_transaction_dict( - w3, caller_tester_contract, transaction_dict, address + w3, contract_caller_tester_contract, transaction_dict, address ): start_num = w3.eth.get_block("latest").number - assert caller_tester_contract.caller.counter() == 0 + assert contract_caller_tester_contract.caller.counter() == 0 w3.provider.make_request(method="evm_mine", params=[5]) - caller_tester_contract.functions.increment().transact() + contract_caller_tester_contract.functions.increment().transact() block_id = start_num + 6 - contract = caller_tester_contract.caller( + contract = contract_caller_tester_contract.caller( transaction=transaction_dict, block_identifier=block_id ) @@ -133,9 +113,9 @@ def test_caller_with_block_identifier_and_transaction_dict( def test_caller_with_transaction_keyword( - w3, caller_tester_contract, transaction_dict, address + w3, contract_caller_tester_contract, transaction_dict, address ): - contract = caller_tester_contract.caller(transaction=transaction_dict) + contract = contract_caller_tester_contract.caller(transaction=transaction_dict) sender, _, gasLeft, value, _ = contract.returnMeta() @@ -145,9 +125,9 @@ def test_caller_with_transaction_keyword( def test_caller_with_dict_but_no_transaction_keyword( - w3, caller_tester_contract, transaction_dict, address + w3, contract_caller_tester_contract, transaction_dict, address ): - contract = caller_tester_contract.caller(transaction_dict) + contract = contract_caller_tester_contract.caller(transaction_dict) sender, _, gasLeft, value, _ = contract.returnMeta() @@ -157,9 +137,9 @@ def test_caller_with_dict_but_no_transaction_keyword( def test_caller_with_args_and_no_transaction_keyword( - w3, caller_tester_contract, transaction_dict, address + w3, contract_caller_tester_contract, transaction_dict, address ): - contract = caller_tester_contract.caller(transaction_dict) + contract = contract_caller_tester_contract.caller(transaction_dict) sender, _, gasLeft, value, _ = contract.returnMeta() @@ -249,17 +229,17 @@ async def test_async_caller_with_block_identifier(async_w3, async_math_contract) @pytest.mark.asyncio async def test_async_caller_with_block_identifier_and_transaction_dict( - async_w3, async_caller_tester_contract, transaction_dict, address + async_w3, async_contract_caller_tester_contract, transaction_dict, address ): start = await async_w3.eth.get_block("latest") start_num = start.number - assert await async_caller_tester_contract.caller.counter() == 0 + assert await async_contract_caller_tester_contract.caller.counter() == 0 await async_w3.provider.make_request(method="evm_mine", params=[5]) - await async_caller_tester_contract.functions.increment().transact() + await async_contract_caller_tester_contract.functions.increment().transact() block_id = start_num + 6 - contract = async_caller_tester_contract.caller( + contract = async_contract_caller_tester_contract.caller( transaction=transaction_dict, block_identifier=block_id ) @@ -275,9 +255,11 @@ async def test_async_caller_with_block_identifier_and_transaction_dict( @pytest.mark.asyncio async def test_async_caller_with_transaction_keyword( - async_w3, async_caller_tester_contract, transaction_dict, address + async_w3, async_contract_caller_tester_contract, transaction_dict, address ): - contract = async_caller_tester_contract.caller(transaction=transaction_dict) + contract = async_contract_caller_tester_contract.caller( + transaction=transaction_dict + ) sender, _, gasLeft, value, _ = await contract.returnMeta() @@ -288,9 +270,9 @@ async def test_async_caller_with_transaction_keyword( @pytest.mark.asyncio async def test_async_caller_with_dict_but_no_transaction_keyword( - async_w3, async_caller_tester_contract, transaction_dict, address + async_w3, async_contract_caller_tester_contract, transaction_dict, address ): - contract = async_caller_tester_contract.caller(transaction_dict) + contract = async_contract_caller_tester_contract.caller(transaction_dict) sender, _, gasLeft, value, _ = await contract.returnMeta() @@ -301,9 +283,9 @@ async def test_async_caller_with_dict_but_no_transaction_keyword( @pytest.mark.asyncio async def test_async_caller_with_args_and_no_transaction_keyword( - async_w3, async_caller_tester_contract, transaction_dict, address + async_w3, async_contract_caller_tester_contract, transaction_dict, address ): - contract = async_caller_tester_contract.caller(transaction_dict) + contract = async_contract_caller_tester_contract.caller(transaction_dict) sender, _, gasLeft, value, _ = await contract.returnMeta() diff --git a/tests/core/contracts/test_contract_class_construction.py b/tests/core/contracts/test_contract_class_construction.py index a6a200d449..78d3cc0fe0 100644 --- a/tests/core/contracts/test_contract_class_construction.py +++ b/tests/core/contracts/test_contract_class_construction.py @@ -16,15 +16,15 @@ def test_class_construction_sets_class_vars( w3, math_contract_abi, math_contract_bytecode, math_contract_runtime ): - MathContract = w3.eth.contract( + math_contract_instance = w3.eth.contract( abi=math_contract_abi, bytecode=math_contract_bytecode, bytecode_runtime=math_contract_runtime, ) - assert MathContract.w3 == w3 - assert MathContract.bytecode == decode_hex(math_contract_bytecode) - assert MathContract.bytecode_runtime == decode_hex(math_contract_runtime) + assert math_contract_instance.w3 == w3 + assert math_contract_instance.bytecode == decode_hex(math_contract_bytecode) + assert math_contract_instance.bytecode_runtime == decode_hex(math_contract_runtime) def test_error_to_instantiate_base_class(): @@ -35,10 +35,10 @@ def test_error_to_instantiate_base_class(): def test_abi_as_json_string(w3, math_contract_abi, some_address): abi_str = json.dumps(math_contract_abi) - MathContract = w3.eth.contract(abi=abi_str) - assert MathContract.abi == math_contract_abi + math_contract_instance = w3.eth.contract(abi=abi_str) + assert math_contract_instance.abi == math_contract_abi - math = MathContract(some_address) + math = math_contract_instance(some_address) assert math.abi == math_contract_abi diff --git a/tests/core/contracts/test_contract_constructor.py b/tests/core/contracts/test_contract_constructor.py index 6a6fe5954e..cf4f2a48dc 100644 --- a/tests/core/contracts/test_contract_constructor.py +++ b/tests/core/contracts/test_contract_constructor.py @@ -4,6 +4,12 @@ decode_hex, ) +from web3._utils.contract_sources.contract_data.constructor_contracts import ( + CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME, + CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME, + SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME, +) + TEST_ADDRESS = "0x16D9983245De15E7A9A73bC586E01FF6E08dE737" EXPECTED_DATA_A = 1234 EXPECTED_DATA_B = ( @@ -115,7 +121,6 @@ def test_contract_constructor_transact_no_constructor( def test_contract_constructor_transact_without_arguments( w3, simple_constructor_contract_instance, - simple_constructor_contract_runtime, address_conversion_func, ): deploy_txn = simple_constructor_contract_instance.constructor().transact() @@ -127,7 +132,7 @@ def test_contract_constructor_transact_without_arguments( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(simple_constructor_contract_runtime) + assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME) @pytest.mark.parametrize( @@ -142,7 +147,6 @@ def test_contract_constructor_transact_without_arguments( def test_contract_constructor_transact_with_arguments_non_strict( w3_non_strict_abi, non_strict_contract_with_constructor_args_instance, - contract_with_constructor_args_runtime, constructor_args, constructor_kwargs, expected_a, @@ -160,7 +164,7 @@ def test_contract_constructor_transact_with_arguments_non_strict( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) + assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) assert ( expected_a == non_strict_contract_with_constructor_args_instance(address=contract_address) @@ -178,7 +182,6 @@ def test_contract_constructor_transact_with_arguments_non_strict( def test_contract_constructor_transact_with_address_argument( w3, contract_with_constructor_address_instance, - contract_with_constructor_address_runtime, address_conversion_func, ): deploy_txn = contract_with_constructor_address_instance.constructor( @@ -189,7 +192,9 @@ def test_contract_constructor_transact_with_address_argument( assert txn_receipt["contractAddress"] contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) + assert blockchain_code == decode_hex( + CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME + ) assert ( TEST_ADDRESS == contract_with_constructor_address_instance(address=contract_address) @@ -274,19 +279,21 @@ def test_contract_constructor_build_transaction_with_arguments( def test_async_contract_constructor_abi_encoding_with_no_constructor_fn( - AsyncMathContract, math_contract_bytecode + async_math_contract_instance, math_contract_bytecode ): - deploy_data = AsyncMathContract.constructor()._encode_data_in_transaction() + deploy_data = ( + async_math_contract_instance.constructor()._encode_data_in_transaction() + ) assert deploy_data == math_contract_bytecode @pytest.mark.asyncio async def test_async_contract_constructor_gas_estimate_no_constructor( - async_w3, AsyncMathContract + async_w3, async_math_contract_instance ): - gas_estimate = await AsyncMathContract.constructor().estimate_gas() + gas_estimate = await async_math_contract_instance.constructor().estimate_gas() - deploy_txn = await AsyncMathContract.constructor().transact() + deploy_txn = await async_math_contract_instance.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -295,13 +302,13 @@ async def test_async_contract_constructor_gas_estimate_no_constructor( @pytest.mark.asyncio async def test_async_contract_constructor_gas_estimate_with_block_id( - async_w3, AsyncMathContract + async_w3, async_math_contract_instance ): block_identifier = None - gas_estimate = await AsyncMathContract.constructor().estimate_gas( + gas_estimate = await async_math_contract_instance.constructor().estimate_gas( block_identifier=block_identifier ) - deploy_txn = await AsyncMathContract.constructor().transact() + deploy_txn = await async_math_contract_instance.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -310,11 +317,15 @@ async def test_async_contract_constructor_gas_estimate_with_block_id( @pytest.mark.asyncio async def test_async_contract_constructor_gas_estimate_without_arguments( - async_w3, AsyncSimpleConstructorContract + async_w3, async_simple_constructor_contract_instance ): - gas_estimate = await AsyncSimpleConstructorContract.constructor().estimate_gas() + gas_estimate = ( + await async_simple_constructor_contract_instance.constructor().estimate_gas() + ) - deploy_txn = await AsyncSimpleConstructorContract.constructor().transact() + deploy_txn = ( + await async_simple_constructor_contract_instance.constructor().transact() + ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -333,17 +344,21 @@ async def test_async_contract_constructor_gas_estimate_without_arguments( ) async def test_async_contract_constructor_gas_estimate_with_arguments_non_strict( async_w3_non_strict_abi, - AsyncNonStrictWithConstructorArgumentsContract, + async_non_strict_constructor_with_args_contract_instance, constructor_args, constructor_kwargs, ): - gas_estimate = await AsyncNonStrictWithConstructorArgumentsContract.constructor( - *constructor_args, **constructor_kwargs - ).estimate_gas() + gas_estimate = ( + await async_non_strict_constructor_with_args_contract_instance.constructor( + *constructor_args, **constructor_kwargs + ).estimate_gas() + ) - deploy_txn = await AsyncNonStrictWithConstructorArgumentsContract.constructor( - *constructor_args, **constructor_kwargs - ).transact() + deploy_txn = ( + await async_non_strict_constructor_with_args_contract_instance.constructor( + *constructor_args, **constructor_kwargs + ).transact() + ) txn_receipt = await async_w3_non_strict_abi.eth.wait_for_transaction_receipt( deploy_txn ) @@ -353,14 +368,18 @@ async def test_async_contract_constructor_gas_estimate_with_arguments_non_strict @pytest.mark.asyncio -async def test_async_contract_constructor_gas_estimate_with_address_argument( - async_w3, AsyncWithConstructorAddressArgumentsContract, address_conversion_func +async def test_async_contract_constructor_with_address_argument_gas_estimate( + async_w3, + async_constructor_with_address_arg_contract_instance, + address_conversion_func, ): - gas_estimate = await AsyncWithConstructorAddressArgumentsContract.constructor( - address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") - ).estimate_gas() + gas_estimate = ( + await async_constructor_with_address_arg_contract_instance.constructor( + address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") + ).estimate_gas() + ) - deploy_txn = await AsyncWithConstructorAddressArgumentsContract.constructor( + deploy_txn = await async_constructor_with_address_arg_contract_instance.constructor( address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") ).transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -371,9 +390,12 @@ async def test_async_contract_constructor_gas_estimate_with_address_argument( @pytest.mark.asyncio async def test_async_contract_constructor_transact_no_constructor( - async_w3, AsyncMathContract, math_contract_runtime, address_conversion_func + async_w3, + async_math_contract_instance, + math_contract_runtime, + address_conversion_func, ): - deploy_txn = await AsyncMathContract.constructor().transact() + deploy_txn = await async_math_contract_instance.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -388,11 +410,12 @@ async def test_async_contract_constructor_transact_no_constructor( @pytest.mark.asyncio async def test_async_contract_constructor_transact_without_arguments( async_w3, - AsyncSimpleConstructorContract, - simple_constructor_contract_runtime, + async_simple_constructor_contract_instance, address_conversion_func, ): - deploy_txn = await AsyncSimpleConstructorContract.constructor().transact() + deploy_txn = ( + await async_simple_constructor_contract_instance.constructor().transact() + ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -401,7 +424,7 @@ async def test_async_contract_constructor_transact_without_arguments( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(simple_constructor_contract_runtime) + assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME) @pytest.mark.asyncio @@ -416,17 +439,18 @@ async def test_async_contract_constructor_transact_without_arguments( ) async def test_async_contract_constructor_transact_with_arguments_non_strict( async_w3_non_strict_abi, - AsyncNonStrictWithConstructorArgumentsContract, - contract_with_constructor_args_runtime, + async_non_strict_constructor_with_args_contract_instance, constructor_args, constructor_kwargs, expected_a, expected_b, address_conversion_func, ): - deploy_txn = await AsyncNonStrictWithConstructorArgumentsContract.constructor( - *constructor_args, **constructor_kwargs - ).transact() + deploy_txn = ( + await async_non_strict_constructor_with_args_contract_instance.constructor( + *constructor_args, **constructor_kwargs + ).transact() + ) txn_receipt = await async_w3_non_strict_abi.eth.wait_for_transaction_receipt( deploy_txn @@ -437,10 +461,10 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = await async_w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) + assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) assert ( expected_a - == await AsyncNonStrictWithConstructorArgumentsContract( + == await async_non_strict_constructor_with_args_contract_instance( address=contract_address ) .functions.data_a() @@ -448,7 +472,7 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( ) assert ( expected_b - == await AsyncNonStrictWithConstructorArgumentsContract( + == await async_non_strict_constructor_with_args_contract_instance( address=contract_address ) .functions.data_b() @@ -459,11 +483,10 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( @pytest.mark.asyncio async def test_async_contract_constructor_transact_with_address_arguments( async_w3, - AsyncWithConstructorAddressArgumentsContract, - contract_with_constructor_address_runtime, + async_constructor_with_address_arg_contract_instance, address_conversion_func, ): - deploy_txn = await AsyncWithConstructorAddressArgumentsContract.constructor( + deploy_txn = await async_constructor_with_address_arg_contract_instance.constructor( TEST_ADDRESS ).transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -471,10 +494,14 @@ async def test_async_contract_constructor_transact_with_address_arguments( assert txn_receipt["contractAddress"] contract_address = address_conversion_func(txn_receipt["contractAddress"]) blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) + assert blockchain_code == decode_hex( + CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME + ) assert ( TEST_ADDRESS - == await AsyncWithConstructorAddressArgumentsContract(address=contract_address) + == await async_constructor_with_address_arg_contract_instance( + address=contract_address + ) .functions.testAddr() .call() ) @@ -482,24 +509,26 @@ async def test_async_contract_constructor_transact_with_address_arguments( @pytest.mark.asyncio async def test_async_contract_constructor_build_transaction_to_field_error( - AsyncMathContract, + async_math_contract_instance, ): with pytest.raises(ValueError): - await AsyncMathContract.constructor().build_transaction({"to": "123"}) + await async_math_contract_instance.constructor().build_transaction( + {"to": "123"} + ) @pytest.mark.asyncio async def test_async_contract_constructor_build_transaction_no_constructor( - async_w3, AsyncMathContract, address_conversion_func + async_w3, async_math_contract_instance, address_conversion_func ): async_w3_accounts = await async_w3.eth.accounts - txn_hash = await AsyncMathContract.constructor().transact( + txn_hash = await async_math_contract_instance.constructor().transact( {"from": address_conversion_func(async_w3_accounts[0])} ) txn = await async_w3.eth.get_transaction(txn_hash) async_w3_coinbase = await async_w3.eth.coinbase nonce = await async_w3.eth.get_transaction_count(async_w3_coinbase) - unsent_txn = await AsyncMathContract.constructor().build_transaction( + unsent_txn = await async_math_contract_instance.constructor().build_transaction( {"nonce": nonce} ) assert txn["data"] == unsent_txn["data"] @@ -512,16 +541,16 @@ async def test_async_contract_constructor_build_transaction_no_constructor( @pytest.mark.asyncio async def test_async_contract_constructor_build_transaction_without_arguments( - async_w3, AsyncMathContract, address_conversion_func + async_w3, async_math_contract_instance, address_conversion_func ): async_w3_accounts = await async_w3.eth.accounts - txn_hash = await AsyncMathContract.constructor().transact( + txn_hash = await async_math_contract_instance.constructor().transact( {"from": address_conversion_func(async_w3_accounts[0])} ) txn = await async_w3.eth.get_transaction(txn_hash) async_w3_coinbase = await async_w3.eth.coinbase nonce = await async_w3.eth.get_transaction_count(async_w3_coinbase) - unsent_txn = await AsyncMathContract.constructor().build_transaction( + unsent_txn = await async_math_contract_instance.constructor().build_transaction( {"nonce": nonce} ) assert txn["data"] == unsent_txn["data"] @@ -544,21 +573,25 @@ async def test_async_contract_constructor_build_transaction_without_arguments( ) async def test_async_contract_constructor_build_transaction_with_arguments( async_w3_non_strict_abi, - AsyncNonStrictWithConstructorArgumentsContract, + async_non_strict_constructor_with_args_contract_instance, constructor_args, constructor_kwargs, address_conversion_func, ): async_w3_accounts = await async_w3_non_strict_abi.eth.accounts - txn_hash = await AsyncNonStrictWithConstructorArgumentsContract.constructor( - *constructor_args, **constructor_kwargs - ).transact({"from": address_conversion_func(async_w3_accounts[0])}) + txn_hash = ( + await async_non_strict_constructor_with_args_contract_instance.constructor( + *constructor_args, **constructor_kwargs + ).transact({"from": address_conversion_func(async_w3_accounts[0])}) + ) txn = await async_w3_non_strict_abi.eth.get_transaction(txn_hash) async_w3_coinbase = await async_w3_non_strict_abi.eth.coinbase nonce = await async_w3_non_strict_abi.eth.get_transaction_count(async_w3_coinbase) - unsent_txn = await AsyncNonStrictWithConstructorArgumentsContract.constructor( - *constructor_args, **constructor_kwargs - ).build_transaction({"nonce": nonce}) + unsent_txn = ( + await async_non_strict_constructor_with_args_contract_instance.constructor( + *constructor_args, **constructor_kwargs + ).build_transaction({"nonce": nonce}) + ) assert txn["data"] == unsent_txn["data"] new_txn_hash = await async_w3_non_strict_abi.eth.send_transaction(unsent_txn) diff --git a/tests/core/contracts/test_contract_constructor_encoding.py b/tests/core/contracts/test_contract_constructor_encoding.py index 6144bb5618..7f0054290b 100644 --- a/tests/core/contracts/test_contract_constructor_encoding.py +++ b/tests/core/contracts/test_contract_constructor_encoding.py @@ -5,6 +5,10 @@ remove_0x_prefix, ) +from web3._utils.contract_sources.contract_data.constructor_contracts import ( + SIMPLE_CONSTRUCTOR_CONTRACT_BYTECODE, +) + def test_contract_constructor_abi_encoding_with_no_constructor_fn( math_contract_instance, math_contract_bytecode @@ -14,10 +18,10 @@ def test_contract_constructor_abi_encoding_with_no_constructor_fn( def test_contract_constructor_abi_encoding_with_constructor_with_no_args( - simple_constructor_contract_instance, simple_constructor_contract_bytecode + simple_constructor_contract_instance, ): deploy_data = simple_constructor_contract_instance._encode_constructor_data() - assert deploy_data == simple_constructor_contract_bytecode + assert deploy_data == SIMPLE_CONSTRUCTOR_CONTRACT_BYTECODE @pytest.mark.parametrize( diff --git a/tests/core/contracts/test_contract_deployment.py b/tests/core/contracts/test_contract_deployment.py index 05b88bd6ad..8149c9e721 100644 --- a/tests/core/contracts/test_contract_deployment.py +++ b/tests/core/contracts/test_contract_deployment.py @@ -7,6 +7,11 @@ from web3 import ( constants, ) +from web3._utils.contract_sources.contract_data.constructor_contracts import ( + CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME, + CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME, + SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME, +) def test_contract_deployment_no_constructor( @@ -27,7 +32,6 @@ def test_contract_deployment_no_constructor( def test_contract_deployment_with_constructor_without_args( w3, simple_constructor_contract_instance, - simple_constructor_contract_runtime, ): deploy_txn = simple_constructor_contract_instance.constructor().transact() @@ -38,7 +42,7 @@ def test_contract_deployment_with_constructor_without_args( contract_address = txn_receipt["contractAddress"] blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(simple_constructor_contract_runtime) + assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME) @pytest.mark.parametrize( @@ -51,7 +55,6 @@ def test_contract_deployment_with_constructor_without_args( def test_contract_deployment_with_constructor_with_arguments_strict_by_default( w3, contract_with_constructor_args_instance, - contract_with_constructor_args_runtime, constructor_arg, ): deploy_txn = contract_with_constructor_args_instance.constructor( @@ -65,13 +68,12 @@ def test_contract_deployment_with_constructor_with_arguments_strict_by_default( contract_address = txn_receipt["contractAddress"] blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) + assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) def test_contract_deployment_with_constructor_with_arguments_non_strict( w3_non_strict_abi, non_strict_contract_with_constructor_args_instance, - contract_with_constructor_args_runtime, ): deploy_txn = non_strict_contract_with_constructor_args_instance.constructor( 1234, "abcd" @@ -84,12 +86,11 @@ def test_contract_deployment_with_constructor_with_arguments_non_strict( contract_address = txn_receipt["contractAddress"] blockchain_code = w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) + assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) def test_contract_deployment_with_constructor_with_arguments_strict_error( contract_with_constructor_args_instance, - contract_with_constructor_args_runtime, ): with pytest.raises( TypeError, @@ -100,9 +101,8 @@ def test_contract_deployment_with_constructor_with_arguments_strict_error( def test_contract_deployment_with_constructor_with_address_argument( w3, - contract_with_constructor_address_instance, # noqa: E501 - contract_with_constructor_address_runtime, -): # noqa: E501 + contract_with_constructor_address_instance, +): deploy_txn = contract_with_constructor_address_instance.constructor( "0x16D9983245De15E7A9A73bC586E01FF6E08dE737", ).transact() @@ -114,14 +114,16 @@ def test_contract_deployment_with_constructor_with_address_argument( contract_address = txn_receipt["contractAddress"] blockchain_code = w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) + assert blockchain_code == decode_hex( + CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME + ) @pytest.mark.asyncio async def test_async_contract_deployment_no_constructor( - async_w3, AsyncMathContract, math_contract_runtime + async_w3, async_math_contract_instance, math_contract_runtime ): - deploy_txn = await AsyncMathContract.constructor().transact() + deploy_txn = await async_math_contract_instance.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -136,10 +138,11 @@ async def test_async_contract_deployment_no_constructor( @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_no_args( async_w3, - AsyncSimpleConstructorContract, - simple_constructor_contract_runtime, + async_simple_constructor_contract_instance, ): - deploy_txn = await AsyncSimpleConstructorContract.constructor().transact() + deploy_txn = ( + await async_simple_constructor_contract_instance.constructor().transact() + ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -148,7 +151,7 @@ async def test_async_contract_deployment_with_constructor_no_args( contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(simple_constructor_contract_runtime) + assert blockchain_code == decode_hex(SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME) @pytest.mark.asyncio @@ -161,12 +164,11 @@ async def test_async_contract_deployment_with_constructor_no_args( ) async def test_async_contract_deployment_with_constructor_arguments( async_w3, - AsyncWithConstructorArgumentsContract, - contract_with_constructor_args_runtime, + async_constructor_with_args_contract_instance, constructor_arg, ): - deploy_txn = await AsyncWithConstructorArgumentsContract.constructor( + deploy_txn = await async_constructor_with_args_contract_instance.constructor( 1234, constructor_arg ).transact() @@ -177,18 +179,19 @@ async def test_async_contract_deployment_with_constructor_arguments( contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) + assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_with_arguments_non_strict( async_w3_non_strict_abi, - AsyncNonStrictWithConstructorArgumentsContract, - contract_with_constructor_args_runtime, + async_non_strict_constructor_with_args_contract_instance, ): - deploy_txn = await AsyncNonStrictWithConstructorArgumentsContract.constructor( - 1234, "abcd" - ).transact() # noqa: E501 + deploy_txn = ( + await async_non_strict_constructor_with_args_contract_instance.constructor( + 1234, "abcd" + ).transact() + ) # noqa: E501 txn_receipt = await async_w3_non_strict_abi.eth.wait_for_transaction_receipt( deploy_txn @@ -199,28 +202,28 @@ async def test_async_contract_deployment_with_constructor_with_arguments_non_str contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3_non_strict_abi.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_args_runtime) + assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_arguments_strict_error( - AsyncWithConstructorArgumentsContract, - contract_with_constructor_args_runtime, + async_constructor_with_args_contract_instance, ): with pytest.raises( TypeError, match="One or more arguments could not be encoded to the necessary ABI type. Expected types are: uint256, bytes32", # noqa: E501 ): - await AsyncWithConstructorArgumentsContract.constructor(1234, "abcd").transact() + await async_constructor_with_args_contract_instance.constructor( + 1234, "abcd" + ).transact() @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_with_address_argument( async_w3, - AsyncWithConstructorAddressArgumentsContract, # noqa: E501 - contract_with_constructor_address_runtime, + async_constructor_with_address_arg_contract_instance, ): # noqa: E501 - deploy_txn = await AsyncWithConstructorAddressArgumentsContract.constructor( + deploy_txn = await async_constructor_with_address_arg_contract_instance.constructor( "0x16D9983245De15E7A9A73bC586E01FF6E08dE737", ).transact() @@ -231,4 +234,6 @@ async def test_async_contract_deployment_with_constructor_with_address_argument( contract_address = txn_receipt["contractAddress"] blockchain_code = await async_w3.eth.get_code(contract_address) - assert blockchain_code == decode_hex(contract_with_constructor_address_runtime) + assert blockchain_code == decode_hex( + CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME + ) diff --git a/tests/core/contracts/test_contract_transact_interface.py b/tests/core/contracts/test_contract_transact_interface.py index 7ff3aee1f5..94f0d606f9 100644 --- a/tests/core/contracts/test_contract_transact_interface.py +++ b/tests/core/contracts/test_contract_transact_interface.py @@ -88,11 +88,11 @@ def test_transacting_with_contract_with_arguments( assert final_value - initial_value == 5 -def test_deploy_when_default_account_is_set(w3, string_contract_kwargs): +def test_deploy_when_default_account_is_set(w3, string_contract_data): w3.eth.default_account = w3.eth.accounts[1] assert w3.eth.default_account is not empty - StringContract = w3.eth.contract(**string_contract_kwargs) + StringContract = w3.eth.contract(**string_contract_data) deploy_txn = StringContract.constructor("Caqalai").transact() w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -202,9 +202,9 @@ def test_transacting_with_contract_with_byte_array_argument_non_strict( def test_transacting_with_contract_respects_explicit_gas( - w3, string_contract_kwargs, wait_for_block, call, transact + w3, string_contract_data, wait_for_block, call, transact ): - StringContract = w3.eth.contract(**string_contract_kwargs) + StringContract = w3.eth.contract(**string_contract_data) deploy_txn = StringContract.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn, 30) @@ -228,9 +228,9 @@ def test_transacting_with_contract_respects_explicit_gas( def test_auto_gas_computation_when_transacting( - w3, string_contract_kwargs, wait_for_block, call, transact + w3, string_contract_data, wait_for_block, call, transact ): - StringContract = w3.eth.contract(**string_contract_kwargs) + StringContract = w3.eth.contract(**string_contract_data) deploy_txn = StringContract.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn, 30) @@ -392,14 +392,12 @@ async def test_async_transacting_with_contract_with_arguments( @pytest.mark.asyncio -async def test_async_deploy_when_default_account_is_set( - async_w3, string_contract_kwargs -): +async def test_async_deploy_when_default_account_is_set(async_w3, string_contract_data): async_w3_accounts = await async_w3.eth.accounts async_w3.eth.default_account = async_w3_accounts[1] assert async_w3.eth.default_account is not empty - StringContract = async_w3.eth.contract(**string_contract_kwargs) + StringContract = async_w3.eth.contract(**string_contract_data) deploy_txn = await StringContract.constructor("Caqalai").transact() await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -513,10 +511,10 @@ async def test_async_transacting_with_contract_with_byte_array_argument_non_stri @pytest.mark.asyncio async def test_async_transacting_with_contract_respects_explicit_gas( - async_w3, string_contract_kwargs, async_call, async_transact + async_w3, string_contract_data, async_call, async_transact ): - StringContract = async_w3.eth.contract(**string_contract_kwargs) + StringContract = async_w3.eth.contract(**string_contract_data) deploy_txn = await StringContract.constructor("Caqalai").transact() deploy_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn, 30) @@ -543,10 +541,10 @@ async def test_async_transacting_with_contract_respects_explicit_gas( @pytest.mark.asyncio async def test_async_auto_gas_computation_when_transacting( - async_w3, string_contract_kwargs, async_call, async_transact + async_w3, string_contract_data, async_call, async_transact ): - StringContract = async_w3.eth.contract(**string_contract_kwargs) + StringContract = async_w3.eth.contract(**string_contract_data) deploy_txn = await StringContract.constructor("Caqalai").transact() deploy_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn, 30) diff --git a/tests/core/contracts/test_extracting_event_data.py b/tests/core/contracts/test_extracting_event_data.py index b5e7026455..60018d63cf 100644 --- a/tests/core/contracts/test_extracting_event_data.py +++ b/tests/core/contracts/test_extracting_event_data.py @@ -24,87 +24,40 @@ @pytest.fixture() -def Emitter(w3, emitter_contract_kwargs): - return w3.eth.contract(**emitter_contract_kwargs) - - -@pytest.fixture() -def emitter(w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func): - wait_for_block(w3) - deploy_txn_hash = Emitter.constructor().transact({"gas": 30029121}) - deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) - contract_address = address_conversion_func(deploy_receipt["contractAddress"]) - - bytecode = w3.eth.get_code(contract_address) - assert bytecode == Emitter.bytecode_runtime - _emitter = Emitter(address=contract_address) - assert _emitter.address == contract_address - return _emitter - - -@pytest.fixture() -def EventContract(w3, event_contract_kwargs): - return w3.eth.contract(**event_contract_kwargs) - - -@pytest.fixture() -def event_contract( - w3, EventContract, wait_for_transaction, wait_for_block, address_conversion_func -): - - wait_for_block(w3) - deploy_txn_hash = EventContract.constructor().transact( - {"from": w3.eth.coinbase, "gas": 1000000} - ) - deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) - contract_address = address_conversion_func(deploy_receipt["contractAddress"]) +def dup_txn_receipt(w3, indexed_event_contract, wait_for_transaction, event_contract): - bytecode = w3.eth.get_code(contract_address) - assert bytecode == EventContract.bytecode_runtime - event_contract = EventContract(address=contract_address) - assert event_contract.address == contract_address - return event_contract + emitter_fn = indexed_event_contract.functions.logTwoEvents + txn_hash = emitter_fn(12345).transact() + wait_for_transaction(w3, txn_hash) -@pytest.fixture() -def IndexedEventContract(w3, INDEXED_EVENT_CONTRACT): - return w3.eth.contract(**INDEXED_EVENT_CONTRACT) + event_contract_fn = event_contract.functions.logTwoEvents + dup_txn_hash = event_contract_fn(12345).transact() + return wait_for_transaction(w3, dup_txn_hash) -@pytest.fixture() -def indexed_event_contract( +@pytest.fixture +def emitter( w3, - IndexedEventContract, + emitter_contract_data, wait_for_transaction, wait_for_block, address_conversion_func, ): + emitter_contract_instance = w3.eth.contract(**emitter_contract_data) wait_for_block(w3) - deploy_txn_hash = IndexedEventContract.constructor().transact( - {"from": w3.eth.coinbase, "gas": 1000000} + deploy_txn_hash = emitter_contract_instance.constructor().transact( + {"gas": 30029121} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == IndexedEventContract.bytecode_runtime - indexed_event_contract = IndexedEventContract(address=contract_address) - assert indexed_event_contract.address == contract_address - return indexed_event_contract - - -@pytest.fixture() -def dup_txn_receipt(w3, indexed_event_contract, wait_for_transaction, event_contract): - - emitter_fn = indexed_event_contract.functions.logTwoEvents - - txn_hash = emitter_fn(12345).transact() - wait_for_transaction(w3, txn_hash) - - event_contract_fn = event_contract.functions.logTwoEvents - dup_txn_hash = event_contract_fn(12345).transact() - return wait_for_transaction(w3, dup_txn_hash) + assert bytecode == emitter_contract_instance.bytecode_runtime + _emitter = emitter_contract_instance(address=contract_address) + assert _emitter.address == contract_address + return _emitter @pytest.mark.parametrize( @@ -158,15 +111,15 @@ def test_event_data_extraction( w3, emitter, wait_for_transaction, - emitter_log_topics, - emitter_event_ids, + emitter_contract_log_topics, + emitter_contract_event_ids, contract_fn, event_name, call_args, expected_args, ): emitter_fn = emitter.functions[contract_fn] - event_id = getattr(emitter_event_ids, event_name) + event_id = getattr(emitter_contract_event_ids, event_name) txn_hash = emitter_fn(event_id, *call_args).transact() txn_receipt = wait_for_transaction(w3, txn_hash) @@ -175,7 +128,7 @@ def test_event_data_extraction( event_abi = emitter._find_matching_event_abi(event_name) - event_topic = getattr(emitter_log_topics, event_name) + event_topic = getattr(emitter_contract_log_topics, event_name) is_anonymous = event_abi["anonymous"] if is_anonymous: @@ -213,7 +166,12 @@ def test_event_data_extraction( ), ) def test_event_data_extraction_bytes( - w3, emitter, wait_for_transaction, emitter_log_topics, call_args, expected_args + w3, + emitter, + wait_for_transaction, + emitter_contract_log_topics, + call_args, + expected_args, ): emitter_fn = emitter.functions.logListArgs txn_hash = emitter_fn(*call_args).transact() @@ -225,7 +183,7 @@ def test_event_data_extraction_bytes( event_name = "LogListArgs" event_abi = emitter._find_matching_event_abi(event_name) - event_topic = getattr(emitter_log_topics, event_name) + event_topic = getattr(emitter_contract_log_topics, event_name) assert event_topic in log_entry["topics"] @@ -262,7 +220,7 @@ def test_event_data_extraction_bytes_non_strict( w3_non_strict_abi, non_strict_emitter, wait_for_transaction, - emitter_log_topics, + emitter_contract_log_topics, call_args, expected_args, ): @@ -276,7 +234,7 @@ def test_event_data_extraction_bytes_non_strict( event_name = "LogListArgs" event_abi = non_strict_emitter._find_matching_event_abi(event_name) - event_topic = getattr(emitter_log_topics, event_name) + event_topic = getattr(emitter_contract_log_topics, event_name) assert event_topic in log_entry["topics"] @@ -305,7 +263,11 @@ def test_event_data_extraction_bytes_strict_with_errors(emitter, call_args): def test_dynamic_length_argument_extraction( - w3, emitter, wait_for_transaction, emitter_log_topics, emitter_event_ids + w3, + emitter, + wait_for_transaction, + emitter_contract_log_topics, + emitter_contract_event_ids, ): string_0 = "this-is-the-first-string-which-exceeds-32-bytes-in-length" string_1 = "this-is-the-second-string-which-exceeds-32-bytes-in-length" @@ -317,7 +279,7 @@ def test_dynamic_length_argument_extraction( event_abi = emitter._find_matching_event_abi("LogDynamicArgs") - event_topic = emitter_log_topics.LogDynamicArgs + event_topic = emitter_contract_log_topics.LogDynamicArgs assert event_topic in log_entry["topics"] string_0_topic = w3.keccak(text=string_0) @@ -339,7 +301,7 @@ def test_dynamic_length_argument_extraction( def test_argument_extraction_strict_bytes_types( - w3, emitter, wait_for_transaction, emitter_log_topics + w3, emitter, wait_for_transaction, emitter_contract_log_topics ): arg_0 = [b"12"] arg_1 = [b"12"] @@ -352,7 +314,7 @@ def test_argument_extraction_strict_bytes_types( event_abi = emitter._find_matching_event_abi("LogListArgs") - event_topic = emitter_log_topics.LogListArgs + event_topic = emitter_contract_log_topics.LogListArgs assert event_topic in log_entry["topics"] encoded_arg_0 = w3.codec.encode(["bytes2"], arg_0) @@ -588,7 +550,7 @@ def test_argument_extraction_strict_bytes_types( def test_event_rich_log( w3, emitter, - emitter_event_ids, + emitter_contract_event_ids, wait_for_transaction, contract_fn, event_name, @@ -599,8 +561,8 @@ def test_event_rich_log( ): emitter_fn = emitter.functions[contract_fn] - if hasattr(emitter_event_ids, event_name): - event_id = getattr(emitter_event_ids, event_name) + if hasattr(emitter_contract_event_ids, event_name): + event_id = getattr(emitter_contract_event_ids, event_name) txn_hash = emitter_fn(event_id, *call_args).transact() else: # Some tests do not rely on the event_id. Rather than @@ -852,7 +814,7 @@ def test_event_rich_log( def test_event_rich_log_non_strict( w3_non_strict_abi, non_strict_emitter, - emitter_event_ids, + emitter_contract_event_ids, wait_for_transaction, contract_fn, event_name, @@ -863,8 +825,8 @@ def test_event_rich_log_non_strict( ): emitter_fn = non_strict_emitter.functions[contract_fn] - if hasattr(emitter_event_ids, event_name): - event_id = getattr(emitter_event_ids, event_name) + if hasattr(emitter_contract_event_ids, event_name): + event_id = getattr(emitter_contract_event_ids, event_name) txn_hash = emitter_fn(event_id, *call_args).transact() else: # Some tests do not rely on the event_id. Rather than @@ -902,7 +864,7 @@ def test_event_rich_log_non_strict( @pytest.mark.parametrize("process_receipt", (True, False)) def test_event_rich_log_with_byte_args( - w3, emitter, emitter_event_ids, wait_for_transaction, process_receipt + w3, emitter, emitter_contract_event_ids, wait_for_transaction, process_receipt ): txn_hash = emitter.functions.logListArgs([b"13"], [b"54"]).transact() txn_receipt = wait_for_transaction(w3, txn_hash) @@ -936,7 +898,6 @@ def test_event_rich_log_with_byte_args( def test_receipt_processing_with_discard_flag( event_contract, indexed_event_contract, dup_txn_receipt, wait_for_transaction ): - event_instance = indexed_event_contract.events.LogSingleWithIndex() returned_logs = event_instance.process_receipt(dup_txn_receipt, errors=DISCARD) @@ -946,21 +907,21 @@ def test_receipt_processing_with_discard_flag( def test_receipt_processing_with_ignore_flag( event_contract, indexed_event_contract, dup_txn_receipt, wait_for_transaction ): - event_instance = indexed_event_contract.events.LogSingleWithIndex() + returned_logs = event_instance.process_receipt(dup_txn_receipt, errors=IGNORE) assert len(returned_logs) == 2 - # Check that the correct error is appended to the log - first_log = returned_logs[0] - log_error = re.compile("Expected 1 log topics. Got 0") - assert log_error.search(str(first_log.errors)) is not None - # Then, do the same with the other log: second_log = returned_logs[1] abi_error = re.compile("The event signature did not match the provided ABI") assert abi_error.search(str(second_log.errors)) is not None + # Check that the correct error is appended to the log + first_log = returned_logs[0] + log_error = re.compile("Expected 1 log topics. Got 0") + assert log_error.search(str(first_log.errors)) is not None + for log in returned_logs: # Check that the returned log is the same as what got sent in, # except for the added errors field diff --git a/tests/core/contracts/test_extracting_event_data_old.py b/tests/core/contracts/test_extracting_event_data_old.py index 4804836a31..071e92238b 100644 --- a/tests/core/contracts/test_extracting_event_data_old.py +++ b/tests/core/contracts/test_extracting_event_data_old.py @@ -10,20 +10,25 @@ @pytest.fixture() -def Emitter(w3, emitter_contract_kwargs): - return w3.eth.contract(**emitter_contract_kwargs) - +def emitter( + w3, + emitter_contract_data, + wait_for_transaction, + wait_for_block, + address_conversion_func, +): + emitter_contract_instance = w3.eth.contract(**emitter_contract_data) -@pytest.fixture() -def emitter(w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func): wait_for_block(w3) - deploy_txn_hash = Emitter.constructor().transact({"gas": 10000000}) + deploy_txn_hash = emitter_contract_instance.constructor().transact( + {"gas": 10000000} + ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == Emitter.bytecode_runtime - _emitter = Emitter(address=contract_address) + assert bytecode == emitter_contract_instance.bytecode_runtime + _emitter = emitter_contract_instance(address=contract_address) assert _emitter.address == contract_address return _emitter @@ -79,15 +84,15 @@ def test_event_data_extraction( w3, emitter, wait_for_transaction, - emitter_log_topics, - emitter_event_ids, + emitter_contract_log_topics, + emitter_contract_event_ids, contract_fn, event_name, call_args, expected_args, ): function = getattr(emitter.functions, contract_fn) - event_id = getattr(emitter_event_ids, event_name) + event_id = getattr(emitter_contract_event_ids, event_name) txn_hash = function(event_id, *call_args).transact() txn_receipt = wait_for_transaction(w3, txn_hash) @@ -96,7 +101,7 @@ def test_event_data_extraction( event_abi = emitter._find_matching_event_abi(event_name) - event_topic = getattr(emitter_log_topics, event_name) + event_topic = getattr(emitter_contract_log_topics, event_name) is_anonymous = event_abi["anonymous"] if is_anonymous: @@ -115,7 +120,11 @@ def test_event_data_extraction( def test_dynamic_length_argument_extraction( - w3, emitter, wait_for_transaction, emitter_log_topics, emitter_event_ids + w3, + emitter, + wait_for_transaction, + emitter_contract_log_topics, + emitter_contract_event_ids, ): string_0 = "this-is-the-first-string-which-exceeds-32-bytes-in-length" string_1 = "this-is-the-second-string-which-exceeds-32-bytes-in-length" @@ -127,7 +136,7 @@ def test_dynamic_length_argument_extraction( event_abi = emitter._find_matching_event_abi("LogDynamicArgs") - event_topic = emitter_log_topics.LogDynamicArgs + event_topic = emitter_contract_log_topics.LogDynamicArgs assert event_topic in log_entry["topics"] string_0_topic = w3.keccak(text=string_0) diff --git a/tests/core/contracts/test_offchain_lookup.py b/tests/core/contracts/test_offchain_lookup.py index cb7dfd2c56..42e6aa1bde 100644 --- a/tests/core/contracts/test_offchain_lookup.py +++ b/tests/core/contracts/test_offchain_lookup.py @@ -4,14 +4,12 @@ abi, ) +from web3._utils.contract_sources.contract_data.offchain_lookup import ( + OFFCHAIN_LOOKUP_DATA, +) from web3._utils.module_testing.module_testing_utils import ( mock_offchain_lookup_request_response, ) -from web3._utils.module_testing.offchain_lookup_contract import ( - OFFCHAIN_LOOKUP_ABI, - OFFCHAIN_LOOKUP_BYTECODE, - OFFCHAIN_LOOKUP_BYTECODE_RUNTIME, -) from web3._utils.type_conversion import ( to_hex_if_bytes, ) @@ -22,39 +20,34 @@ ) # "test offchain lookup" as an abi-encoded string -OFFCHAIN_LOOKUP_TEST_DATA = "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001474657374206f6666636861696e206c6f6f6b7570000000000000000000000000" # noqa: E501 +OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA = "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001474657374206f6666636861696e206c6f6f6b7570000000000000000000000000" # noqa: E501 # "web3py" as an abi-encoded string WEB3PY_AS_HEXBYTES = "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067765623370790000000000000000000000000000000000000000000000000000" # noqa: E501 @pytest.fixture -def offchain_lookup_contract_factory(w3): - # compiled from `web3/_utils/module_testing/contract_sources/OffchainLookup.sol` - return w3.eth.contract( - abi=OFFCHAIN_LOOKUP_ABI, - bytecode=OFFCHAIN_LOOKUP_BYTECODE, - bytecode_runtime=OFFCHAIN_LOOKUP_BYTECODE_RUNTIME, - ) +def offchain_lookup_contract_instance(w3): + return w3.eth.contract(**OFFCHAIN_LOOKUP_DATA) @pytest.fixture def offchain_lookup_contract( w3, wait_for_block, - offchain_lookup_contract_factory, + offchain_lookup_contract_instance, wait_for_transaction, address_conversion_func, ): wait_for_block(w3) - deploy_txn_hash = offchain_lookup_contract_factory.constructor().transact( + deploy_txn_hash = offchain_lookup_contract_instance.constructor().transact( {"gas": 10000000} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == offchain_lookup_contract_factory.bytecode_runtime - deployed_offchain_lookup = offchain_lookup_contract_factory( + assert bytecode == offchain_lookup_contract_instance.bytecode_runtime + deployed_offchain_lookup = offchain_lookup_contract_instance( address=contract_address ) assert deployed_offchain_lookup.address == contract_address @@ -68,11 +61,11 @@ def test_offchain_lookup_functionality( normalized_address = to_hex_if_bytes(offchain_lookup_contract.address) mock_offchain_lookup_request_response( monkeypatch, - mocked_request_url=f"https://web3.py/gateway/{normalized_address}/{OFFCHAIN_LOOKUP_TEST_DATA}.json", # noqa: E501 + mocked_request_url=f"https://web3.py/gateway/{normalized_address}/{OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA}.json", # noqa: E501 mocked_json_data=WEB3PY_AS_HEXBYTES, ) response = offchain_lookup_contract.caller.testOffchainLookup( - OFFCHAIN_LOOKUP_TEST_DATA + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA ) assert abi.decode(["string"], response)[0] == "web3py" @@ -83,24 +76,26 @@ def test_eth_call_offchain_lookup_raises_when_ccip_read_is_disabled( # test ContractFunction call with pytest.raises(OffchainLookup): offchain_lookup_contract.functions.testOffchainLookup( - OFFCHAIN_LOOKUP_TEST_DATA + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA ).call(ccip_read_enabled=False) # test ContractCaller call with pytest.raises(OffchainLookup): offchain_lookup_contract.caller(ccip_read_enabled=False).testOffchainLookup( - OFFCHAIN_LOOKUP_TEST_DATA + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA ) # test global flag on the provider w3.provider.global_ccip_read_enabled = False with pytest.raises(OffchainLookup): - offchain_lookup_contract.caller.testOffchainLookup(OFFCHAIN_LOOKUP_TEST_DATA) + offchain_lookup_contract.caller.testOffchainLookup( + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA + ) with pytest.raises(OffchainLookup): offchain_lookup_contract.caller(ccip_read_enabled=False).testOffchainLookup( - OFFCHAIN_LOOKUP_TEST_DATA + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA ) w3.provider.global_ccip_read_enabled = True # cleanup @@ -114,14 +109,14 @@ def test_offchain_lookup_call_flag_overrides_provider_flag( normalized_address = to_hex_if_bytes(offchain_lookup_contract.address) mock_offchain_lookup_request_response( monkeypatch, - mocked_request_url=f"https://web3.py/gateway/{normalized_address}/{OFFCHAIN_LOOKUP_TEST_DATA}.json", # noqa: E501 + mocked_request_url=f"https://web3.py/gateway/{normalized_address}/{OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA}.json", # noqa: E501 mocked_json_data=WEB3PY_AS_HEXBYTES, ) w3.provider.global_ccip_read_enabled = False response = offchain_lookup_contract.functions.testOffchainLookup( - OFFCHAIN_LOOKUP_TEST_DATA + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA ).call(ccip_read_enabled=True) assert abi.decode(["string"], response)[0] == "web3py" @@ -135,12 +130,14 @@ def test_offchain_lookup_raises_for_improperly_formatted_rest_request_response( normalized_address = to_hex_if_bytes(offchain_lookup_contract.address) mock_offchain_lookup_request_response( monkeypatch, - mocked_request_url=f"https://web3.py/gateway/{normalized_address}/{OFFCHAIN_LOOKUP_TEST_DATA}.json", # noqa: E501 + mocked_request_url=f"https://web3.py/gateway/{normalized_address}/{OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA}.json", # noqa: E501 mocked_json_data=WEB3PY_AS_HEXBYTES, json_data_field="not_data", ) with pytest.raises(Web3ValidationError, match="missing 'data' field"): - offchain_lookup_contract.caller.testOffchainLookup(OFFCHAIN_LOOKUP_TEST_DATA) + offchain_lookup_contract.caller.testOffchainLookup( + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA + ) @pytest.mark.parametrize("status_code_non_4xx_error", [100, 300, 500, 600]) @@ -160,7 +157,7 @@ def test_eth_call_offchain_lookup_tries_next_url_for_non_4xx_error_status_and_te # non 4xx status and that the POST logic is also working as expected. mock_offchain_lookup_request_response( monkeypatch, - mocked_request_url=f"https://web3.py/gateway/{normalized_contract_address}/{OFFCHAIN_LOOKUP_TEST_DATA}.json", # noqa: E501 + mocked_request_url=f"https://web3.py/gateway/{normalized_contract_address}/{OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA}.json", # noqa: E501 mocked_status_code=status_code_non_4xx_error, mocked_json_data=WEB3PY_AS_HEXBYTES, ) @@ -171,10 +168,10 @@ def test_eth_call_offchain_lookup_tries_next_url_for_non_4xx_error_status_and_te mocked_status_code=200, mocked_json_data=WEB3PY_AS_HEXBYTES, sender=normalized_contract_address, - calldata=OFFCHAIN_LOOKUP_TEST_DATA, + calldata=OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA, ) response = offchain_lookup_contract.caller.testOffchainLookup( - OFFCHAIN_LOOKUP_TEST_DATA + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA ) assert abi.decode(["string"], response)[0] == "web3py" @@ -190,12 +187,14 @@ def test_eth_call_offchain_lookup_calls_raise_for_status_for_4xx_status_code( ).lower() mock_offchain_lookup_request_response( monkeypatch, - mocked_request_url=f"https://web3.py/gateway/{normalized_contract_address}/{OFFCHAIN_LOOKUP_TEST_DATA}.json", # noqa: E501 + mocked_request_url=f"https://web3.py/gateway/{normalized_contract_address}/{OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA}.json", # noqa: E501 mocked_status_code=status_code_4xx_error, mocked_json_data=WEB3PY_AS_HEXBYTES, ) with pytest.raises(Exception, match="called raise_for_status\\(\\)"): - offchain_lookup_contract.caller.testOffchainLookup(OFFCHAIN_LOOKUP_TEST_DATA) + offchain_lookup_contract.caller.testOffchainLookup( + OFFCHAIN_LOOKUP_CONTRACT_TEST_DATA + ) def test_offchain_lookup_raises_on_continuous_redirect( diff --git a/tests/core/contracts/utils.py b/tests/core/contracts/utils.py index 75ba472fe2..1edf353f49 100644 --- a/tests/core/contracts/utils.py +++ b/tests/core/contracts/utils.py @@ -3,25 +3,25 @@ ) -def deploy(w3, Contract, apply_func=identity, args=None): +def deploy(w3, contract_instance, apply_func=identity, args=None): args = args or [] - deploy_txn = Contract.constructor(*args).transact() + deploy_txn = contract_instance.constructor(*args).transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = apply_func(deploy_receipt["contractAddress"]) - contract = Contract(address=address) + contract = contract_instance(address=address) assert contract.address == address assert len(w3.eth.get_code(contract.address)) > 0 return contract -async def async_deploy(async_web3, Contract, apply_func=identity, args=None): +async def async_deploy(async_web3, contract_instance, apply_func=identity, args=None): args = args or [] - deploy_txn = await Contract.constructor(*args).transact() + deploy_txn = await contract_instance.constructor(*args).transact() deploy_receipt = await async_web3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = apply_func(deploy_receipt["contractAddress"]) - contract = Contract(address=address) + contract = contract_instance(address=address) assert contract.address == address assert len(await async_web3.eth.get_code(contract.address)) > 0 return contract diff --git a/tests/core/filtering/conftest.py b/tests/core/filtering/conftest.py index a772126669..78659ddb28 100644 --- a/tests/core/filtering/conftest.py +++ b/tests/core/filtering/conftest.py @@ -3,8 +3,6 @@ from eth_utils import ( apply_key_map, - encode_hex, - event_signature_to_log_topic, ) import pytest_asyncio @@ -17,11 +15,6 @@ from tests.utils import ( async_partial, ) -from web3._utils.module_testing.emitter_contract import ( - EMITTER_CONTRACT_ABI, - EMITTER_CONTRACT_BYTECODE, - EMITTER_CONTRACT_RUNTIME, -) @pytest.fixture( @@ -33,122 +26,28 @@ def w3(request): return _w3_fixture_logic(request) -@pytest.fixture() -def EMITTER_CODE(): - return EMITTER_CONTRACT_BYTECODE - - -@pytest.fixture() -def EMITTER_RUNTIME(): - return EMITTER_CONTRACT_RUNTIME - - -@pytest.fixture() -def EMITTER_ABI(): - return EMITTER_CONTRACT_ABI - - -@pytest.fixture() -def EMITTER(emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi): - return { - "bytecode": emitter_contract_bytecode, - "bytecode_runtime": emitter_contract_runtime, - "abi": emitter_contract_abi, - } - +@pytest.fixture +def emitter_contract_instance(w3, emitter_contract_data): + return w3.eth.contract(**emitter_contract_data) -@pytest.fixture() -def Emitter(w3, emitter_contract_kwargs): - return w3.eth.contract(**emitter_contract_kwargs) - -@pytest.fixture() -def emitter(w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func): +@pytest.fixture +def emitter( + w3, + emitter_contract_instance, + wait_for_transaction, + wait_for_block, + address_conversion_func, +): return _emitter_fixture_logic( - w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func - ) - - -class LogFunctions: - LogAnonymous = 0 - LogNoArguments = 1 - LogSingleArg = 2 - LogDoubleArg = 3 - LogTripleArg = 4 - LogQuadrupleArg = 5 - LogSingleAnonymous = 6 - LogSingleWithIndex = 7 - LogDoubleAnonymous = 8 - LogDoubleWithIndex = 9 - LogTripleWithIndex = 10 - LogQuadrupleWithIndex = 11 - LogBytes = 12 - LogString = 13 - LogDynamicArgs = 14 - LogListArgs = 15 - LogAddressIndexed = 16 - LogAddressNotIndexed = 17 - - -@pytest.fixture(scope="module") -def emitter_event_ids(): - return LogFunctions - - -class LogTopics: - LogAnonymous = encode_hex(event_signature_to_log_topic("LogAnonymous()")) - LogNoArguments = encode_hex(event_signature_to_log_topic("LogNoArguments()")) - LogSingleArg = encode_hex(event_signature_to_log_topic("LogSingleArg(uint256)")) - LogSingleAnonymous = encode_hex( - event_signature_to_log_topic("LogSingleAnonymous(uint256)") - ) - LogSingleWithIndex = encode_hex( - event_signature_to_log_topic("LogSingleWithIndex(uint256)") - ) - LogDoubleArg = encode_hex( - event_signature_to_log_topic("LogDoubleArg(uint256,uint256)") - ) - LogDoubleAnonymous = encode_hex( - event_signature_to_log_topic("LogDoubleAnonymous(uint256,uint256)") - ) # noqa: E501 - LogDoubleWithIndex = encode_hex( - event_signature_to_log_topic("LogDoubleWithIndex(uint256,uint256)") - ) # noqa: E501 - LogTripleArg = encode_hex( - event_signature_to_log_topic("LogTripleArg(uint256,uint256,uint256)") - ) - LogTripleWithIndex = encode_hex( - event_signature_to_log_topic("LogTripleWithIndex(uint256,uint256,uint256)") - ) # noqa: E501 - LogQuadrupleArg = encode_hex( - event_signature_to_log_topic("LogQuadrupleArg(uint256,uint256,uint256,uint256)") - ) # noqa: E501 - LogQuadrupleWithIndex = encode_hex( - event_signature_to_log_topic( - "LogQuadrupleWithIndex(uint256,uint256,uint256,uint256)" - ) - ) # noqa: E501 - LogBytes = encode_hex(event_signature_to_log_topic("LogBytes(bytes)")) - LogString = encode_hex(event_signature_to_log_topic("LogString(string)")) - LogDynamicArgs = encode_hex( - event_signature_to_log_topic("LogDynamicArgs(string,string)") - ) - LogListArgs = encode_hex( - event_signature_to_log_topic("LogListArgs(bytes2[],bytes2[])") - ) - LogAddressIndexed = encode_hex( - event_signature_to_log_topic("LogAddressIndexed(address,address)") - ) - LogAddressNotIndexed = encode_hex( - event_signature_to_log_topic("LogAddressNotIndexed(address,address)") + w3, + emitter_contract_instance, + wait_for_transaction, + wait_for_block, + address_conversion_func, ) -@pytest.fixture() -def emitter_log_topics(): - return LogTopics - - def return_filter(contract, args): event_name = args[0] kwargs = apply_key_map({"filter": "argument_filters"}, args[1]) @@ -174,22 +73,22 @@ def async_w3(request): return _async_w3_fixture_logic(request) -@pytest.fixture() -def AsyncEmitter(async_w3, emitter_contract_kwargs): - return async_w3.eth.contract(**emitter_contract_kwargs) +@pytest.fixture +def async_emitter_contract_instance(async_w3, emitter_contract_data): + return async_w3.eth.contract(**emitter_contract_data) -@pytest_asyncio.fixture() +@pytest_asyncio.fixture async def async_emitter( async_w3, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, async_wait_for_block, address_conversion_func, ): return await _async_emitter_fixture_logic( async_w3, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, async_wait_for_block, address_conversion_func, diff --git a/tests/core/filtering/test_basic_filter_tests.py b/tests/core/filtering/test_basic_filter_tests.py index cb47271de3..77ad7bcf35 100644 --- a/tests/core/filtering/test_basic_filter_tests.py +++ b/tests/core/filtering/test_basic_filter_tests.py @@ -2,7 +2,7 @@ def test_filtering_sequential_blocks_with_bounded_range( - w3, emitter, Emitter, wait_for_transaction + w3, emitter, wait_for_transaction ): builder = emitter.events.LogNoArguments.build_filter() builder.fromBlock = "latest" @@ -17,7 +17,7 @@ def test_filtering_sequential_blocks_with_bounded_range( assert len(filter_.get_new_entries()) == 100 -def test_filtering_starting_block_range(w3, emitter, Emitter, wait_for_transaction): +def test_filtering_starting_block_range(w3, emitter, wait_for_transaction): for i in range(10): emitter.functions.logNoArgs(which=1).transact() builder = emitter.events.LogNoArguments.build_filter() diff --git a/tests/core/filtering/test_contract_data_filters.py b/tests/core/filtering/test_contract_data_filters.py index 7375587d4f..e1dd33063d 100644 --- a/tests/core/filtering/test_contract_data_filters.py +++ b/tests/core/filtering/test_contract_data_filters.py @@ -18,35 +18,6 @@ _async_wait_for_block_fixture_logic, _async_wait_for_transaction_fixture_logic, ) -from web3._utils.module_testing.emitter_contract import ( - EMITTER_CONTRACT_ABI, - EMITTER_CONTRACT_BYTECODE, - EMITTER_CONTRACT_RUNTIME, -) - - -@pytest.fixture(scope="module") -def EMITTER_CODE(): - return EMITTER_CONTRACT_BYTECODE - - -@pytest.fixture(scope="module") -def EMITTER_RUNTIME(): - return EMITTER_CONTRACT_RUNTIME - - -@pytest.fixture(scope="module") -def EMITTER_ABI(): - return EMITTER_CONTRACT_ABI - - -@pytest.fixture(scope="module") -def EMITTER(emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi): - return { - "bytecode": emitter_contract_bytecode, - "bytecode_runtime": emitter_contract_runtime, - "abi": emitter_contract_abi, - } def not_empty_string(x): @@ -115,14 +86,20 @@ def w3(request): @pytest.fixture(scope="module") -def Emitter(w3, emitter_contract_kwargs): - return w3.eth.contract(**emitter_contract_kwargs) - - -@pytest.fixture(scope="module") -def emitter(w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func): +def emitter( + w3, + emitter_contract_data, + wait_for_transaction, + wait_for_block, + address_conversion_func, +): + emitter_contract_instance = w3.eth.contract(**emitter_contract_data) return _emitter_fixture_logic( - w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func + w3, + emitter_contract_instance, + wait_for_transaction, + wait_for_block, + address_conversion_func, ) @@ -228,7 +205,7 @@ def test_data_filters_with_fixed_arguments( assert log_entries[0]["transactionHash"] == txn_hashes[0] -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) @given(vals=array_values()) @settings(max_examples=5, deadline=None) @@ -236,7 +213,7 @@ def test_data_filters_with_list_arguments( w3, emitter, wait_for_transaction, - call_as_instance, + call_deployed_contract, create_filter, api_style, vals, @@ -312,21 +289,22 @@ def async_w3(request): @pytest.fixture(scope="module") -def AsyncEmitter(async_w3, emitter_contract_kwargs): - return async_w3.eth.contract(**emitter_contract_kwargs) +def async_emitter_contract_instance(async_w3, emitter_contract_data): + async_w3.eth.contract(**emitter_contract_data) @pytest_asyncio.fixture(scope="module") async def async_emitter( async_w3, - AsyncEmitter, + emitter_contract_data, async_wait_for_transaction, async_wait_for_block, address_conversion_func, ): + async_emitter_contract_instance = async_w3.eth.contract(**emitter_contract_data) return await _async_emitter_fixture_logic( async_w3, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, async_wait_for_block, address_conversion_func, diff --git a/tests/core/filtering/test_contract_get_logs.py b/tests/core/filtering/test_contract_get_logs.py index 3b73fa3cb3..c9abc013de 100644 --- a/tests/core/filtering/test_contract_get_logs.py +++ b/tests/core/filtering/test_contract_get_logs.py @@ -14,10 +14,10 @@ def test_contract_get_logs_all( w3, emitter, wait_for_transaction, - emitter_event_ids, + emitter_contract_event_ids, ): contract = emitter - event_id = emitter_event_ids.LogNoArguments + event_id = emitter_contract_event_ids.LogNoArguments txn_hash = contract.functions.logNoArgs(event_id).transact() wait_for_transaction(w3, txn_hash) @@ -31,10 +31,10 @@ def test_contract_get_logs_range( w3, emitter, wait_for_transaction, - emitter_event_ids, + emitter_contract_event_ids, ): contract = emitter - event_id = emitter_event_ids.LogNoArguments + event_id = emitter_contract_event_ids.LogNoArguments assert w3.eth.block_number == 2 txn_hash = contract.functions.logNoArgs(event_id).transact() @@ -53,13 +53,13 @@ def test_contract_get_logs_range( def test_contract_get_logs_argument_filter( - w3, emitter, wait_for_transaction, emitter_event_ids + w3, emitter, wait_for_transaction, emitter_contract_event_ids ): contract = emitter txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex # 1 = arg0 # 4 = arg1 # 1 = arg2 @@ -105,10 +105,10 @@ async def test_async_contract_get_logs_all( async_w3, async_emitter, async_wait_for_transaction, - emitter_event_ids, + emitter_contract_event_ids, ): contract = async_emitter - event_id = emitter_event_ids.LogNoArguments + event_id = emitter_contract_event_ids.LogNoArguments txn_hash = await contract.functions.logNoArgs(event_id).transact() await async_wait_for_transaction(async_w3, txn_hash) @@ -124,10 +124,10 @@ async def test_async_contract_get_logs_range( async_w3, async_emitter, async_wait_for_transaction, - emitter_event_ids, + emitter_contract_event_ids, ): contract = async_emitter - event_id = emitter_event_ids.LogNoArguments + event_id = emitter_contract_event_ids.LogNoArguments eth_block_number = await async_w3.eth.block_number assert eth_block_number == 2 @@ -156,13 +156,13 @@ async def test_async_contract_get_logs_range( @pytest.mark.asyncio async def test_async_contract_get_logs_argument_filter( - async_w3, async_emitter, async_wait_for_transaction, emitter_event_ids + async_w3, async_emitter, async_wait_for_transaction, emitter_contract_event_ids ): contract = async_emitter txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex # 1 = arg0 # 4 = arg1 # 1 = arg2 diff --git a/tests/core/filtering/test_contract_on_event_filtering.py b/tests/core/filtering/test_contract_on_event_filtering.py index a5907eca31..df95b2aaa7 100644 --- a/tests/core/filtering/test_contract_on_event_filtering.py +++ b/tests/core/filtering/test_contract_on_event_filtering.py @@ -6,14 +6,18 @@ ) -@pytest.mark.parametrize("call_as_instance", (True, False)) -def test_create_filter_address_parameter(emitter, Emitter, call_as_instance): - if call_as_instance: +@pytest.mark.parametrize("call_deployed_contract", (True, False)) +def test_create_filter_address_parameter( + emitter, emitter_contract_instance, call_deployed_contract +): + if call_deployed_contract: event_filter = emitter.events.LogNoArguments.create_filter(fromBlock="latest") else: - event_filter = Emitter.events.LogNoArguments.create_filter(fromBlock="latest") + event_filter = emitter_contract_instance.events.LogNoArguments.create_filter( + fromBlock="latest" + ) - if call_as_instance: + if call_deployed_contract: # Assert this is a single string value, and not a list of addresses assert is_address(event_filter.filter_params["address"]) else: @@ -21,30 +25,32 @@ def test_create_filter_address_parameter(emitter, Emitter, call_as_instance): assert "address" not in event_filter.filter_params -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) def test_on_filter_using_get_entries_interface( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = emitter else: - contract = Emitter + contract = emitter_contract_instance if api_style == "build_filter": event_filter = contract.events.LogNoArguments.build_filter().deploy(w3) else: event_filter = create_filter(emitter, ["LogNoArguments", {}]) - txn_hash = emitter.functions.logNoArgs(emitter_event_ids.LogNoArguments).transact() + txn_hash = emitter.functions.logNoArgs( + emitter_contract_event_ids.LogNoArguments + ).transact() wait_for_transaction(w3, txn_hash) log_entries = event_filter.get_new_entries() @@ -56,23 +62,23 @@ def test_on_filter_using_get_entries_interface( assert len(new_entries) == 0 -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) def test_on_sync_filter_with_event_name_and_single_argument( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = emitter else: - contract = Emitter + contract = emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -92,7 +98,7 @@ def test_on_sync_filter_with_event_name_and_single_argument( ) txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex txn_hashes.append(emitter.functions.logTriple(event_id, 2, 1, 3).transact()) txn_hashes.append(emitter.functions.logTriple(event_id, 1, 2, 3).transact()) txn_hashes.append(emitter.functions.logTriple(event_id, 12345, 2, 54321).transact()) @@ -104,23 +110,23 @@ def test_on_sync_filter_with_event_name_and_single_argument( assert {log["transactionHash"] for log in seen_logs} == set(txn_hashes[1:]) -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) def test_on_sync_filter_with_event_name_and_non_indexed_argument( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = emitter else: - contract = Emitter + contract = emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -142,7 +148,7 @@ def test_on_sync_filter_with_event_name_and_non_indexed_argument( ) txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex txn_hashes.append(emitter.functions.logTriple(event_id, 2, 1, 3).transact()) txn_hashes.append(emitter.functions.logTriple(event_id, 1, 2, 3).transact()) txn_hashes.append(emitter.functions.logTriple(event_id, 12345, 2, 54321).transact()) @@ -164,38 +170,40 @@ def test_on_sync_filter_with_event_name_and_non_indexed_argument( def test_filter_with_contract_address( - w3, emitter, emitter_event_ids, wait_for_transaction + w3, emitter, emitter_contract_event_ids, wait_for_transaction ): event_filter = w3.eth.filter(filter_params={"address": emitter.address}) - txn_hash = emitter.functions.logNoArgs(emitter_event_ids.LogNoArguments).transact() + txn_hash = emitter.functions.logNoArgs( + emitter_contract_event_ids.LogNoArguments + ).transact() wait_for_transaction(w3, txn_hash) seen_logs = event_filter.get_new_entries() assert len(seen_logs) == 1 assert seen_logs[0]["transactionHash"] == txn_hash -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) def test_on_sync_filter_with_topic_filter_options_on_old_apis( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = emitter else: - contract = Emitter + contract = emitter_contract_instance event_filter = create_filter( contract, ["LogTripleWithIndex", {"filter": {"arg1": [1, 2], "arg2": [1, 2]}}] ) txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex txn_hashes.append(emitter.functions.logTriple(event_id, 1, 1, 1).transact()) txn_hashes.append(emitter.functions.logTriple(event_id, 1, 1, 2).transact()) txn_hashes.append(emitter.functions.logTriple(event_id, 1, 2, 2).transact()) @@ -226,20 +234,22 @@ def event_loop(): @pytest.mark.asyncio -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) async def test_async_create_filter_address_parameter( - async_emitter, AsyncEmitter, call_as_instance + async_emitter, async_emitter_contract_instance, call_deployed_contract ): - if call_as_instance: + if call_deployed_contract: event_filter = await async_emitter.events.LogNoArguments.create_filter( fromBlock="latest" ) else: - event_filter = await AsyncEmitter.events.LogNoArguments.create_filter( - fromBlock="latest" + event_filter = ( + await async_emitter_contract_instance.events.LogNoArguments.create_filter( + fromBlock="latest" + ) ) - if call_as_instance: + if call_deployed_contract: # Assert this is a single string value, and not a list of addresses assert is_address(event_filter.filter_params["address"]) else: @@ -248,23 +258,23 @@ async def test_async_create_filter_address_parameter( @pytest.mark.asyncio -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) async def test_on_async_filter_using_get_entries_interface( async_w3, async_emitter, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, async_create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = async_emitter else: - contract = AsyncEmitter + contract = async_emitter_contract_instance if api_style == "build_filter": event_filter = await contract.events.LogNoArguments.build_filter().deploy( @@ -274,7 +284,7 @@ async def test_on_async_filter_using_get_entries_interface( event_filter = await async_create_filter(async_emitter, ["LogNoArguments", {}]) txn_hash = await async_emitter.functions.logNoArgs( - emitter_event_ids.LogNoArguments + emitter_contract_event_ids.LogNoArguments ).transact() await async_wait_for_transaction(async_w3, txn_hash) @@ -288,23 +298,23 @@ async def test_on_async_filter_using_get_entries_interface( @pytest.mark.asyncio -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) async def test_on_async_filter_with_event_name_and_single_argument( async_w3, async_emitter, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, async_create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = async_emitter else: - contract = AsyncEmitter + contract = async_emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -324,7 +334,7 @@ async def test_on_async_filter_with_event_name_and_single_argument( ) txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex txn_hashes.append( await async_emitter.functions.logTriple(event_id, 2, 1, 3).transact() ) @@ -343,23 +353,23 @@ async def test_on_async_filter_with_event_name_and_single_argument( @pytest.mark.asyncio -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) async def test_on_async_filter_with_event_name_and_non_indexed_argument( async_w3, async_emitter, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, async_create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = async_emitter else: - contract = AsyncEmitter + contract = async_emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -381,7 +391,7 @@ async def test_on_async_filter_with_event_name_and_non_indexed_argument( ) txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex txn_hashes.append( await async_emitter.functions.logTriple(event_id, 2, 1, 3).transact() ) @@ -410,13 +420,13 @@ async def test_on_async_filter_with_event_name_and_non_indexed_argument( @pytest.mark.asyncio async def test_async_filter_with_contract_address( - async_w3, async_emitter, emitter_event_ids, async_wait_for_transaction + async_w3, async_emitter, emitter_contract_event_ids, async_wait_for_transaction ): event_filter = await async_w3.eth.filter( filter_params={"address": async_emitter.address} ) txn_hash = await async_emitter.functions.logNoArgs( - emitter_event_ids.LogNoArguments + emitter_contract_event_ids.LogNoArguments ).transact() await async_wait_for_transaction(async_w3, txn_hash) seen_logs = await event_filter.get_new_entries() @@ -425,28 +435,28 @@ async def test_async_filter_with_contract_address( @pytest.mark.asyncio -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) async def test_on_async_filter_with_topic_filter_options_on_old_apis( async_w3, async_emitter, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, async_create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = async_emitter else: - contract = AsyncEmitter + contract = async_emitter_contract_instance event_filter = await async_create_filter( contract, ["LogTripleWithIndex", {"filter": {"arg1": [1, 2], "arg2": [1, 2]}}] ) txn_hashes = [] - event_id = emitter_event_ids.LogTripleWithIndex + event_id = emitter_contract_event_ids.LogTripleWithIndex txn_hashes.append( await async_emitter.functions.logTriple(event_id, 1, 1, 1).transact() ) diff --git a/tests/core/filtering/test_contract_past_event_filtering.py b/tests/core/filtering/test_contract_past_event_filtering.py index 40e8f13b4a..1b5c54b0ab 100644 --- a/tests/core/filtering/test_contract_past_event_filtering.py +++ b/tests/core/filtering/test_contract_past_event_filtering.py @@ -6,22 +6,22 @@ ) -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) def test_on_filter_using_get_all_entries_interface( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = emitter else: - contract = Emitter + contract = emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() @@ -32,7 +32,9 @@ def test_on_filter_using_get_all_entries_interface( contract, ["LogNoArguments", {"fromBlock": "latest"}] ) - txn_hash = emitter.functions.logNoArgs(emitter_event_ids.LogNoArguments).transact() + txn_hash = emitter.functions.logNoArgs( + emitter_contract_event_ids.LogNoArguments + ).transact() wait_for_transaction(w3, txn_hash) log_entries = event_filter.get_all_entries() @@ -47,25 +49,27 @@ def test_on_filter_using_get_all_entries_interface( assert log_entries_2[0]["transactionHash"] == txn_hash -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) def test_get_all_entries_returned_block_data( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, create_filter, ): - txn_hash = emitter.functions.logNoArgs(emitter_event_ids.LogNoArguments).transact() + txn_hash = emitter.functions.logNoArgs( + emitter_contract_event_ids.LogNoArguments + ).transact() txn_receipt = wait_for_transaction(w3, txn_hash) - if call_as_instance: + if call_deployed_contract: contract = emitter else: - contract = Emitter + contract = emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() @@ -99,22 +103,22 @@ def event_loop(): @pytest.mark.asyncio -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) async def test_on_async_filter_using_get_all_entries_interface( async_w3, async_emitter, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, async_create_filter, ): - if call_as_instance: + if call_deployed_contract: contract = async_emitter else: - contract = AsyncEmitter + contract = async_emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() @@ -126,7 +130,7 @@ async def test_on_async_filter_using_get_all_entries_interface( ) txn_hash = await async_emitter.functions.logNoArgs( - emitter_event_ids.LogNoArguments + emitter_contract_event_ids.LogNoArguments ).transact() await async_wait_for_transaction(async_w3, txn_hash) @@ -143,27 +147,27 @@ async def test_on_async_filter_using_get_all_entries_interface( @pytest.mark.asyncio -@pytest.mark.parametrize("call_as_instance", (True, False)) +@pytest.mark.parametrize("call_deployed_contract", (True, False)) @pytest.mark.parametrize("api_style", ("v4", "build_filter")) async def test_async_get_all_entries_returned_block_data( async_w3, async_emitter, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, - emitter_event_ids, - call_as_instance, + emitter_contract_event_ids, + call_deployed_contract, api_style, async_create_filter, ): txn_hash = await async_emitter.functions.logNoArgs( - emitter_event_ids.LogNoArguments + emitter_contract_event_ids.LogNoArguments ).transact() txn_receipt = await async_wait_for_transaction(async_w3, txn_hash) - if call_as_instance: + if call_deployed_contract: contract = async_emitter else: - contract = AsyncEmitter + contract = async_emitter_contract_instance if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() diff --git a/tests/core/filtering/test_contract_topic_filters.py b/tests/core/filtering/test_contract_topic_filters.py index 3f2f57d330..93d3cadd54 100644 --- a/tests/core/filtering/test_contract_topic_filters.py +++ b/tests/core/filtering/test_contract_topic_filters.py @@ -18,35 +18,6 @@ _async_wait_for_block_fixture_logic, _async_wait_for_transaction_fixture_logic, ) -from web3._utils.module_testing.emitter_contract import ( - EMITTER_CONTRACT_ABI, - EMITTER_CONTRACT_BYTECODE, - EMITTER_CONTRACT_RUNTIME, -) - - -@pytest.fixture(scope="module") -def EMITTER_CODE(): - return EMITTER_CONTRACT_BYTECODE - - -@pytest.fixture(scope="module") -def EMITTER_RUNTIME(): - return EMITTER_CONTRACT_RUNTIME - - -@pytest.fixture(scope="module") -def EMITTER_ABI(): - return EMITTER_CONTRACT_ABI - - -@pytest.fixture(scope="module") -def EMITTER(emitter_contract_bytecode, emitter_contract_runtime, emitter_contract_abi): - return { - "bytecode": emitter_contract_bytecode, - "bytecode_runtime": emitter_contract_runtime, - "abi": emitter_contract_abi, - } def not_empty_string(x): @@ -115,14 +86,20 @@ def w3(request): @pytest.fixture(scope="module") -def Emitter(w3, emitter_contract_kwargs): - return w3.eth.contract(**emitter_contract_kwargs) - - -@pytest.fixture(scope="module") -def emitter(w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func): +def emitter( + w3, + emitter_contract_data, + wait_for_transaction, + wait_for_block, + address_conversion_func, +): + emitter_contract_instance = w3.eth.contract(**emitter_contract_data) return _emitter_fixture_logic( - w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func + w3, + emitter_contract_instance, + wait_for_transaction, + wait_for_block, + address_conversion_func, ) @@ -292,22 +269,19 @@ def async_w3(request): return _async_w3_fixture_logic(request) -@pytest_asyncio.fixture(scope="module") -def AsyncEmitter(async_w3, EMITTER): - return async_w3.eth.contract(**EMITTER) - - @pytest_asyncio.fixture(scope="module") async def async_emitter( async_w3, - AsyncEmitter, + emitter_contract_data, async_wait_for_transaction, async_wait_for_block, address_conversion_func, ): + async_emitter_contract_instance = async_w3.eth.contract(**emitter_contract_data) + return await _async_emitter_fixture_logic( async_w3, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, async_wait_for_block, address_conversion_func, @@ -327,7 +301,6 @@ async def test_async_topic_filters_with_dynamic_arguments( vals, ): if api_style == "build_filter": - filter_builder = async_emitter.events.LogDynamicArgs.build_filter() filter_builder.args["arg0"].match_single(vals["matching"]) event_filter = await filter_builder.deploy(async_w3) diff --git a/tests/core/filtering/test_filter_against_transaction_logs.py b/tests/core/filtering/test_filter_against_transaction_logs.py index 49172f0891..d97f06c1fe 100644 --- a/tests/core/filtering/test_filter_against_transaction_logs.py +++ b/tests/core/filtering/test_filter_against_transaction_logs.py @@ -2,12 +2,14 @@ def test_sync_filter_against_log_events( - w3, emitter, wait_for_transaction, emitter_event_ids + w3, emitter, wait_for_transaction, emitter_contract_event_ids ): txn_filter = w3.eth.filter({}) txn_hashes = set() txn_hashes.add( - emitter.functions.logNoArgs(emitter_event_ids.LogNoArguments).transact() + emitter.functions.logNoArgs( + emitter_contract_event_ids.LogNoArguments + ).transact() ) for txn_hash in txn_hashes: @@ -20,13 +22,13 @@ def test_sync_filter_against_log_events( @pytest.mark.asyncio async def test_async_filter_against_log_events( - async_w3, async_emitter, async_wait_for_transaction, emitter_event_ids + async_w3, async_emitter, async_wait_for_transaction, emitter_contract_event_ids ): txn_filter = await async_w3.eth.filter({}) txn_hashes = set() txn_hashes.add( await async_emitter.functions.logNoArgs( - emitter_event_ids.LogNoArguments + emitter_contract_event_ids.LogNoArguments ).transact() ) diff --git a/tests/core/filtering/test_filters_against_many_blocks.py b/tests/core/filtering/test_filters_against_many_blocks.py index 9a8633d230..26db54d0f2 100644 --- a/tests/core/filtering/test_filters_against_many_blocks.py +++ b/tests/core/filtering/test_filters_against_many_blocks.py @@ -36,9 +36,9 @@ def single_transaction(w3): def test_event_filter_new_events( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, + emitter_contract_event_ids, api_style, create_filter, ): @@ -103,16 +103,18 @@ def test_transaction_filter_without_mining(w3): def test_event_filter_new_events_many_deployed_contracts( w3, emitter, - Emitter, + emitter_contract_instance, wait_for_transaction, - emitter_event_ids, + emitter_contract_event_ids, api_style, create_filter, ): matching_transact = emitter.functions.logNoArgs(which=1).transact - deployed_contract_addresses = deploy_contracts(w3, Emitter, wait_for_transaction) + deployed_contract_addresses = deploy_contracts( + w3, emitter_contract_instance, wait_for_transaction + ) def gen_non_matching_transact(): while True: @@ -120,7 +122,7 @@ def gen_non_matching_transact(): random.randint(0, len(deployed_contract_addresses) - 1) ] yield w3.eth.contract( - address=contract_address, abi=Emitter.abi + address=contract_address, abi=emitter_contract_instance.abi ).functions.logNoArgs(which=1).transact non_matching_transact = gen_non_matching_transact() @@ -265,7 +267,7 @@ async def test_async_transaction_filter_without_mining(async_w3): async def test_async_event_filter_new_events_many_deployed_contracts( async_w3, async_emitter, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, api_style, ): @@ -273,7 +275,7 @@ async def test_async_event_filter_new_events_many_deployed_contracts( matching_transact = async_emitter.functions.logNoArgs(which=1).transact deployed_contract_addresses = await async_deploy_contracts( - async_w3, AsyncEmitter, async_wait_for_transaction + async_w3, async_emitter_contract_instance, async_wait_for_transaction ) async def gen_non_matching_transact(): @@ -282,7 +284,7 @@ async def gen_non_matching_transact(): random.randint(0, len(deployed_contract_addresses) - 1) ] yield async_w3.eth.contract( - address=contract_address, abi=AsyncEmitter.abi + address=contract_address, abi=async_emitter_contract_instance.abi ).functions.logNoArgs(which=1).transact non_matching_transact = gen_non_matching_transact() diff --git a/tests/core/filtering/utils.py b/tests/core/filtering/utils.py index 5c38af984d..ed9a79ed26 100644 --- a/tests/core/filtering/utils.py +++ b/tests/core/filtering/utils.py @@ -22,16 +22,22 @@ def _w3_fixture_logic(request): def _emitter_fixture_logic( - w3, Emitter, wait_for_transaction, wait_for_block, address_conversion_func + w3, + emitter_contract_instance, + wait_for_transaction, + wait_for_block, + address_conversion_func, ): wait_for_block(w3) - deploy_txn_hash = Emitter.constructor().transact({"gas": 10000000}) + deploy_txn_hash = emitter_contract_instance.constructor().transact( + {"gas": 10000000} + ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == Emitter.bytecode_runtime - _emitter = Emitter(address=contract_address) + assert bytecode == emitter_contract_instance.bytecode_runtime + _emitter = emitter_contract_instance(address=contract_address) assert _emitter.address == contract_address return _emitter @@ -51,18 +57,20 @@ def _async_w3_fixture_logic(request): async def _async_emitter_fixture_logic( async_w3, - AsyncEmitter, + async_emitter_contract_instance, async_wait_for_transaction, async_wait_for_block, address_conversion_func, ): await async_wait_for_block(async_w3) - deploy_txn_hash = await AsyncEmitter.constructor().transact({"gas": 10000000}) + deploy_txn_hash = await async_emitter_contract_instance.constructor().transact( + {"gas": 10000000} + ) deploy_receipt = await async_wait_for_transaction(async_w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = await async_w3.eth.get_code(contract_address) - assert bytecode == AsyncEmitter.bytecode_runtime - _emitter = AsyncEmitter(address=contract_address) + assert bytecode == async_emitter_contract_instance.bytecode_runtime + _emitter = async_emitter_contract_instance(address=contract_address) assert _emitter.address == contract_address return _emitter diff --git a/tests/integration/README.md b/tests/integration/README.md index 8d55dcd396..70999a6f8f 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -39,7 +39,7 @@ A block as returned by `web3.eth.get_block` that has a single transaction. #### `math_contract` An deployed Contract instance of the *Math* contract found in -`web3._utils.module_testing.math_contract`. +`web3._utils.contract_sources.MathContract.sol`. #### `unlocked_account` @@ -65,8 +65,8 @@ The transaction hash of a transaction which has been mined. #### `emitter_contract` -An deployed Contract instance of the *Emitter* contract found in -`web3._utils.module_testing.emitter_contract`. +A deployed Contract instance of the *EmitterContract* contract found in +`web3._utils.contract_sources.EmitterContract.sol`. #### `block_with_txn_with_log` diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 40cf489998..78d12b6481 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -1,20 +1,20 @@ import asyncio import pytest -from web3._utils.module_testing.emitter_contract import ( +from web3._utils.contract_sources.contract_data.emitter_contract import ( EMITTER_CONTRACT_ABI, EMITTER_CONTRACT_BYTECODE, ) -from web3._utils.module_testing.math_contract import ( - MATH_ABI, - MATH_BYTECODE, +from web3._utils.contract_sources.contract_data.math_contract import ( + MATH_CONTRACT_ABI, + MATH_CONTRACT_BYTECODE, ) -from web3._utils.module_testing.offchain_lookup_contract import ( +from web3._utils.contract_sources.contract_data.offchain_lookup import ( OFFCHAIN_LOOKUP_ABI, OFFCHAIN_LOOKUP_BYTECODE, ) -from web3._utils.module_testing.revert_contract import ( - _REVERT_CONTRACT_ABI, +from web3._utils.contract_sources.contract_data.revert_contract import ( + REVERT_CONTRACT_ABI, REVERT_CONTRACT_BYTECODE, ) @@ -58,7 +58,9 @@ def pytest_collection_modifyitems(items, config): @pytest.fixture(scope="module") def math_contract_factory(w3): - contract_factory = w3.eth.contract(abi=MATH_ABI, bytecode=MATH_BYTECODE) + contract_factory = w3.eth.contract( + abi=MATH_CONTRACT_ABI, bytecode=MATH_CONTRACT_BYTECODE + ) return contract_factory @@ -73,7 +75,7 @@ def emitter_contract_factory(w3): @pytest.fixture(scope="module") def revert_contract_factory(w3): contract_factory = w3.eth.contract( - abi=_REVERT_CONTRACT_ABI, bytecode=REVERT_CONTRACT_BYTECODE + abi=REVERT_CONTRACT_ABI, bytecode=REVERT_CONTRACT_BYTECODE ) return contract_factory diff --git a/tests/integration/generate_fixtures/go_ethereum.py b/tests/integration/generate_fixtures/go_ethereum.py index 1b23be6d43..af9c03d44f 100644 --- a/tests/integration/generate_fixtures/go_ethereum.py +++ b/tests/integration/generate_fixtures/go_ethereum.py @@ -23,21 +23,23 @@ import common from web3 import Web3 -from web3._utils.module_testing.emitter_contract import ( +from web3._utils.contract_sources.contract_data._custom_contract_data import ( + EMITTER_ENUM, +) +from web3._utils.contract_sources.contract_data.emitter_contract import ( EMITTER_CONTRACT_ABI, EMITTER_CONTRACT_BYTECODE, - EMITTER_ENUM, ) -from web3._utils.module_testing.math_contract import ( - MATH_ABI, - MATH_BYTECODE, +from web3._utils.contract_sources.contract_data.math_contract import ( + MATH_CONTRACT_ABI, + MATH_CONTRACT_BYTECODE, ) -from web3._utils.module_testing.offchain_lookup_contract import ( +from web3._utils.contract_sources.contract_data.offchain_lookup import ( OFFCHAIN_LOOKUP_ABI, OFFCHAIN_LOOKUP_BYTECODE, ) -from web3._utils.module_testing.revert_contract import ( - _REVERT_CONTRACT_ABI, +from web3._utils.contract_sources.contract_data.revert_contract import ( + REVERT_CONTRACT_ABI, REVERT_CONTRACT_BYTECODE, ) @@ -217,8 +219,8 @@ def setup_chain_state(w3): # Math Contract # math_contract_factory = w3.eth.contract( - abi=MATH_ABI, - bytecode=MATH_BYTECODE, + abi=MATH_CONTRACT_ABI, + bytecode=MATH_CONTRACT_BYTECODE, ) math_deploy_receipt = common.deploy_contract(w3, "math", math_contract_factory) assert is_dict(math_deploy_receipt) @@ -255,7 +257,7 @@ def setup_chain_state(w3): # Revert Contract # revert_contract_factory = w3.eth.contract( - abi=_REVERT_CONTRACT_ABI, + abi=REVERT_CONTRACT_ABI, bytecode=REVERT_CONTRACT_BYTECODE, ) revert_deploy_receipt = common.deploy_contract( diff --git a/tests/integration/geth-1.10.25-fixture.zip b/tests/integration/geth-1.10.25-fixture.zip index bef01879a58bf1dd27e17a5a3a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{RWm=sr=XweF zP)QCvtRhAN5z}5tgU1R5*V6_nl##&bDq>_~ZQ&3IAOeUh$uNW;0Tb1fz~qT31J>}8D56;66W>%5pY?H9^kA-`SfR&DX;~e4t=vKpk7Un^ykmCJ7AXpKd@zeT)d zK5eu}ALy+;F?yj6f`R@7R6-9(bYTMz>xk&jUa+}NdHmoB(vze*YLs_Xpn@2Lj2(Dh zhzG26o_L4wdhWMkaun7Ul<^xN%fG89M#*YHnIlTJ(nbCs<5y1^uQmWZ6+;z7gp0uN zkLUT_C*eXIk%r+(xNrcX9@G*2TL&kj|B$L-UN96`w+I`s_&;EdQy#1!EV2RRjYP;c z^mpotvu#Mk2;gfXk7z}<-^Z^JMz2781u;Pr{NznKDOwJEqD zfrBT&zoP}u0zIKf;N?#!|Naj7ISX8Ui3A#+09lK|qY({N!n`}6}EwXnf-?<>Y~959X(K5jSQr8B-@J$1w#7y)rMtTTNFG9-t^e}O>9e&A1y*dp{SQGQ6#iR~=hP9L zPY12v{Ev3-Qy^^wh#Aq50!a%+2{$_-81Io{0Krd4uM=0.7.0; + +contract ArraysContract { + bytes32[] public bytes32Value; + bytes32[] public bytes32ConstValue = [keccak256('A'), keccak256('B')]; + bytes1[] public byteValue; + bytes1[] public byteConstValue = [bytes1(hex"00"), bytes1(hex"01")]; + + constructor(bytes32[] memory _bytes32Value, bytes1[] memory _byteValue) { + bytes32Value = _bytes32Value; + byteValue = _byteValue; + } + + function getBytes32ConstValue() public view returns (bytes32[] memory) { + return bytes32ConstValue; + } + + function getByteConstValue() public view returns (bytes1[] memory){ + return byteConstValue; + } + + function setBytes32Value(bytes32[] memory _bytes32Value) public { + bytes32Value = _bytes32Value; + } + + function getBytes32Value() public view returns (bytes32[] memory) { + return bytes32Value; + } + + function setByteValue(bytes1[] memory _byteValue) public { + byteValue = _byteValue; + } + + function getByteValue() public view returns (bytes1[] memory) { + return byteValue; + } +} \ No newline at end of file diff --git a/web3/_utils/contract_sources/ConstructorContracts.sol b/web3/_utils/contract_sources/ConstructorContracts.sol index 1172aa822e..32d0e87850 100644 --- a/web3/_utils/contract_sources/ConstructorContracts.sol +++ b/web3/_utils/contract_sources/ConstructorContracts.sol @@ -1,10 +1,10 @@ pragma solidity >=0.7.0; -contract SimpleConstructor { +contract SimpleConstructorContract { constructor() {} } -contract ConstructorWithArguments { +contract ConstructorWithArgumentsContract { uint256 public data_a; bytes32 public data_b; @@ -14,7 +14,7 @@ contract ConstructorWithArguments { } } -contract ConstructorWithAddressArgument { +contract ConstructorWithAddressArgumentContract { address public testAddr; constructor(address _testAddr) { diff --git a/web3/_utils/contract_sources/ContractCallerTester.sol b/web3/_utils/contract_sources/ContractCallerTester.sol new file mode 100644 index 0000000000..62e06dc719 --- /dev/null +++ b/web3/_utils/contract_sources/ContractCallerTester.sol @@ -0,0 +1,21 @@ +pragma solidity >=0.7.0; + +contract ContractCallerTester { + int public count; + + function add(int256 a, int256 b) public payable returns (int256) { + return a + b; + } + + function increment() public returns (int256) { + return count += 1; + } + + function counter() public payable returns (int256) { + return count; + } + + function returnMeta() public payable returns (address, bytes memory, uint256, uint, uint) { + return (msg.sender, msg.data, gasleft(), msg.value, block.number); + } +} \ No newline at end of file diff --git a/web3/_utils/contract_sources/Emitter.sol b/web3/_utils/contract_sources/EmitterContract.sol similarity index 99% rename from web3/_utils/contract_sources/Emitter.sol rename to web3/_utils/contract_sources/EmitterContract.sol index 621d35c3c1..798bd940fe 100644 --- a/web3/_utils/contract_sources/Emitter.sol +++ b/web3/_utils/contract_sources/EmitterContract.sol @@ -1,7 +1,7 @@ pragma solidity >=0.8.0; -contract Emitter { +contract EmitterContract { event LogAnonymous() anonymous; event LogNoArguments(); event LogSingleArg(uint arg0); @@ -10,7 +10,6 @@ contract Emitter { event LogQuadrupleArg(uint arg0, uint arg1, uint arg2, uint arg3); event LogString(string v); event LogBytes(bytes v); - event LogSingleWithIndex(uint indexed arg0); event LogSingleAnonymous(uint indexed arg0) anonymous; event LogDoubleWithIndex(uint arg0, uint indexed arg1); diff --git a/web3/_utils/contract_sources/EventContracts.sol b/web3/_utils/contract_sources/EventContracts.sol new file mode 100644 index 0000000000..87230b4d14 --- /dev/null +++ b/web3/_utils/contract_sources/EventContracts.sol @@ -0,0 +1,21 @@ +pragma solidity >=0.6.0; + +contract EventContract { + event LogSingleArg(uint256 arg0); + event LogSingleWithIndex(uint256 arg0); + + function logTwoEvents(uint256 _arg0) public { + emit LogSingleWithIndex(_arg0); + emit LogSingleArg(_arg0); + } +} + +contract IndexedEventContract { + event LogSingleArg(uint256 arg0); + event LogSingleWithIndex(uint256 indexed arg0); + + function logTwoEvents(uint256 _arg0) public { + emit LogSingleWithIndex(_arg0); + emit LogSingleArg(_arg0); + } +} diff --git a/web3/_utils/contract_sources/FallbackFunctionContract.sol b/web3/_utils/contract_sources/FallbackFunctionContract.sol new file mode 100644 index 0000000000..2b061e7b33 --- /dev/null +++ b/web3/_utils/contract_sources/FallbackFunctionContract.sol @@ -0,0 +1,8 @@ +pragma solidity >=0.5.4; + +contract FallbackFunctionContract { + uint data; + constructor() payable { data = 0; } + function getData() public view returns (uint r) { return data; } + fallback() external { data = 1; } +} diff --git a/web3/_utils/contract_sources/OffchainLookup.sol b/web3/_utils/contract_sources/OffchainLookup.sol index 3d2a1649d7..ef199f126a 100644 --- a/web3/_utils/contract_sources/OffchainLookup.sol +++ b/web3/_utils/contract_sources/OffchainLookup.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.13; -contract OffchainLookupTests { +contract OffchainLookup { string[] urls = ["https://web3.py/gateway/{sender}/{data}.json", "https://web3.py/gateway/{sender}.json"]; error OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData); diff --git a/web3/_utils/contract_sources/PayableTester.sol b/web3/_utils/contract_sources/PayableTester.sol new file mode 100644 index 0000000000..5de0407e76 --- /dev/null +++ b/web3/_utils/contract_sources/PayableTester.sol @@ -0,0 +1,10 @@ +pragma solidity >=0.6.0; + + +contract PayableTesterContract { + bool public wasCalled; + + function doNoValueCall() external { + wasCalled = true; + } +} diff --git a/web3/_utils/contract_sources/ReceiveFunctionContracts.sol b/web3/_utils/contract_sources/ReceiveFunctionContracts.sol new file mode 100644 index 0000000000..739ecaefc3 --- /dev/null +++ b/web3/_utils/contract_sources/ReceiveFunctionContracts.sol @@ -0,0 +1,38 @@ +pragma solidity >=0.6.0; + + +contract ReceiveFunctionContract { + string text; + + fallback() external payable { + text = 'fallback'; + } + + receive() external payable { + text = 'receive'; + } + + function getText() public view returns (string memory) { + return text; + } + + function setText(string memory new_text) public returns (string memory) { + return text = new_text; + } +} + +contract NoReceiveFunctionContract { + string text; + + fallback() external { + text = 'fallback'; + } + + function getText() public view returns (string memory) { + return text; + } + + function setText(string memory new_text) public returns (string memory) { + return text = new_text; + } +} diff --git a/web3/_utils/contract_sources/AddressReflector.sol b/web3/_utils/contract_sources/ReflectorContracts.sol similarity index 86% rename from web3/_utils/contract_sources/AddressReflector.sol rename to web3/_utils/contract_sources/ReflectorContracts.sol index d4802a8eac..c7c4772872 100644 --- a/web3/_utils/contract_sources/AddressReflector.sol +++ b/web3/_utils/contract_sources/ReflectorContracts.sol @@ -1,6 +1,6 @@ pragma solidity >=0.4.0; -contract AddressReflector { +contract AddressReflectorContract { function reflect(address arg) public pure returns(address) { return arg; } diff --git a/web3/_utils/contract_sources/RevertContract.sol b/web3/_utils/contract_sources/RevertContract.sol new file mode 100644 index 0000000000..07f24a7d9b --- /dev/null +++ b/web3/_utils/contract_sources/RevertContract.sol @@ -0,0 +1,15 @@ +pragma solidity >=0.6.1; + +contract RevertContract { + function normalFunction() public pure returns (bool) { + return true; + } + + function revertWithMessage() public pure { + revert('Function has been reverted.'); + } + + function revertWithoutMessage() public pure { + revert(); + } +} diff --git a/web3/_utils/contract_sources/StringContract.sol b/web3/_utils/contract_sources/StringContract.sol index 0d54a96334..acd852d4e3 100644 --- a/web3/_utils/contract_sources/StringContract.sol +++ b/web3/_utils/contract_sources/StringContract.sol @@ -1,22 +1,22 @@ -pragma solidity >=0.7.0; +pragma solidity >=0.6.0; contract StringContract { - string const = "never used"; - string value; + string public value; constructor (string memory _value) { value = _value; } - function constValue() public payable returns(string memory) { - return const; - } - - function getValue() public payable returns(string memory) { + function getValue() external payable returns(string memory) { return value; } - function setValue(string memory _value) public { + function setValue(string memory _value) external { value = _value; } + + // for testing contract call to unknown function selector + fallback(bytes calldata _calldata) external returns(bytes memory) { + return _calldata; + } } diff --git a/web3/_utils/contract_sources/TupleContracts.sol b/web3/_utils/contract_sources/TupleContracts.sol new file mode 100644 index 0000000000..23ca6e99f4 --- /dev/null +++ b/web3/_utils/contract_sources/TupleContracts.sol @@ -0,0 +1,20 @@ +pragma solidity >=0.6.0; + +contract TupleContract { + struct T { int x; bool[2] y; address[] z; } + struct S { uint a; uint[] b; T[] c; } + + function method(S memory s) public pure returns (S memory) { + return s; + } +} + +contract NestedTupleContract { + struct U { int x; int y; } + struct T { U[] u; } + struct S { T[] t; } + + function method(S memory s) public pure returns (S memory) { + return s; + } +} diff --git a/web3/_utils/contract_sources/__init__.py b/web3/_utils/contract_sources/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/web3/_utils/contract_sources/compile_contracts.py b/web3/_utils/contract_sources/compile_contracts.py new file mode 100644 index 0000000000..ce72097d33 --- /dev/null +++ b/web3/_utils/contract_sources/compile_contracts.py @@ -0,0 +1,123 @@ +import os +import re +import sys +from typing import ( + Any, +) + +import solcx + +SOLIDITY_VERSION_REGEX = re.compile(r"\d*\.\d+") # 0.0.0 pattern +CONFIGURED_SOLIDITY_VERSION = "0.8.17" + +user_provided_version = sys.argv[-1] + +solidity_version = ( + user_provided_version + if SOLIDITY_VERSION_REGEX.match(user_provided_version) + else CONFIGURED_SOLIDITY_VERSION +) + + +solcx.install_solc(solidity_version) +solcx.set_solc_version(solidity_version) + + +def compile_dot_sol_files(dot_sol_filename: str) -> dict[str, Any]: + compiled = solcx.compile_files( + [f"./{dot_sol_filename}"], + output_values=["abi", "bin", "bin-runtime"], + ) + return compiled + + +def get_compiled_contract_data( + sol_file_output: dict[str, dict[str, str]], + dot_sol_filename: str, + contract_name: str = None, +) -> dict[str, str]: + if not contract_name: + contract_name = dot_sol_filename.replace(".sol", "") + + contract_data = None + for key in sol_file_output.keys(): + if f":{contract_name}" in key: + contract_data = sol_file_output[key] + if not contract_data: + raise Exception(f"Could not find compiled data for contract: {contract_name}") + + contract_data["bin"] = f"0x{contract_data['bin']}" + contract_data["bin-runtime"] = f"0x{contract_data['bin-runtime']}" + + return contract_data + + +contracts_in_file = {} + +for filename in os.listdir(os.getcwd()): + if ".sol" in filename: + with open(os.path.join(os.getcwd(), filename), "r") as f: + dot_sol_file = f.readlines() + + contract_names = [] + + for line in dot_sol_file: + if all(_ in line for _ in ["contract", "{"]) and "abstract" not in line: + start_index = line.find("contract ") + len("contract ") + end_index = line[start_index:].find(" ") + start_index + contract_name = line[start_index:end_index] + contract_names.append(contract_name) + + contracts_in_file[filename] = contract_names + + +for dot_sol_filename in contracts_in_file.keys(): + filename_no_extension = dot_sol_filename.replace(".sol", "") + split_and_lowercase = [ + i.lower() for i in re.split(r"([A-Z][a-z]*)", filename_no_extension) if i + ] + python_filename = f"{'_'.join(split_and_lowercase)}.py" + python_file_path = os.path.join(os.getcwd(), "contract_data", python_filename) + + try: + # clean up existing files + os.remove(python_file_path) + except FileNotFoundError: + pass + + print(f"compiling {dot_sol_filename}") + compiled_dot_sol_data = compile_dot_sol_files(dot_sol_filename) + + with open(python_file_path, "w") as f: + f.write(f'"""\nGenerated by `{os.path.basename(__file__)}` script.\n') + f.write(f'Compiled with Solidity v{solidity_version}.\n"""\n\n') + + for c in contracts_in_file[dot_sol_filename]: + c_name_split_and_uppercase = [ + i.upper() for i in re.split(r"([A-Z0-9][a-z0-9]*)", c) if i + ] + contract_upper = "_".join(c_name_split_and_uppercase) + + c_data = get_compiled_contract_data( + compiled_dot_sol_data, dot_sol_filename, c + ) + + contract_source = ( + f"# source: web3/_utils/contract_sources/{dot_sol_filename}:{c}" + ) + if len(contract_source) > 88: + contract_source += " # noqa: E501" + + f.write(f"{contract_source}\n") + f.write(f'{contract_upper}_BYTECODE = "{c_data["bin"]}" # noqa: E501\n') + f.write( + f'{contract_upper}_RUNTIME = "{c_data["bin-runtime"]}" # noqa: E501\n' + ) + f.write(f"{contract_upper}_ABI = {c_data['abi']}\n") + f.write(contract_upper + "_DATA = {\n") + f.write(f' "bytecode": {contract_upper}_BYTECODE,\n') + f.write(f' "bytecode_runtime": {contract_upper}_RUNTIME,\n') + f.write(f' "abi": {contract_upper}_ABI,\n') + f.write("}\n\n\n") + +os.system(f"black {os.getcwd()}") diff --git a/web3/_utils/contract_sources/contract_data/__init__.py b/web3/_utils/contract_sources/contract_data/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/web3/_utils/contract_sources/contract_data/_custom_contract_data.py b/web3/_utils/contract_sources/contract_data/_custom_contract_data.py new file mode 100644 index 0000000000..af6c64736f --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/_custom_contract_data.py @@ -0,0 +1,21 @@ +EMITTER_ENUM = { + "LogAnonymous": 0, + "LogNoArguments": 1, + "LogSingleArg": 2, + "LogDoubleArg": 3, + "LogTripleArg": 4, + "LogQuadrupleArg": 5, + "LogSingleAnonymous": 6, + "LogSingleWithIndex": 7, + "LogDoubleAnonymous": 8, + "LogDoubleWithIndex": 9, + "LogTripleWithIndex": 10, + "LogQuadrupleWithIndex": 11, + "LogBytes": 12, + "LogString": 13, + "LogDynamicArgs": 14, + "LogListArgs": 15, + "LogAddressIndexed": 16, + "LogAddressNotIndexed": 17, + "LogStructArgs": 18, +} diff --git a/web3/_utils/contract_sources/contract_data/address_reflector.py b/web3/_utils/contract_sources/contract_data/address_reflector.py new file mode 100644 index 0000000000..e82f121f75 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/address_reflector.py @@ -0,0 +1,29 @@ +""" +Generated by `compile_contract_sources.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/AddressReflector.sol:AddressReflector +ADDRESS_REFLECTOR_BYTECODE = "0x608060405234801561001057600080fd5b50610430806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea264697066735822122035083763a0f4c4f5a71055f0da2f3d4f78e64159a8f3bc215c430daec7ac5e2064736f6c63430008110033" # noqa: E501 +ADDRESS_REFLECTOR_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea264697066735822122035083763a0f4c4f5a71055f0da2f3d4f78e64159a8f3bc215c430daec7ac5e2064736f6c63430008110033" # noqa: E501 +ADDRESS_REFLECTOR_ABI = [ + { + "inputs": [{"internalType": "address", "name": "arg", "type": "address"}], + "name": "reflect", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "pure", + "type": "function", + }, + { + "inputs": [{"internalType": "address[]", "name": "arg", "type": "address[]"}], + "name": "reflect", + "outputs": [{"internalType": "address[]", "name": "", "type": "address[]"}], + "stateMutability": "pure", + "type": "function", + }, +] +ADDRESS_REFLECTOR_DATA = { + "bytecode": ADDRESS_REFLECTOR_BYTECODE, + "bytecode_runtime": ADDRESS_REFLECTOR_RUNTIME, + "abi": ADDRESS_REFLECTOR_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/arrays_contract.py b/web3/_utils/contract_sources/contract_data/arrays_contract.py new file mode 100644 index 0000000000..bbd86f8c0e --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/arrays_contract.py @@ -0,0 +1,97 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/ArraysContract.sol:ArraysContract +ARRAYS_CONTRACT_BYTECODE = "0x608060405260405180604001604052807f03783fac2efed8fbc9ad443e592ee30e61d65f471140c10ca155e937b435b76081526020017f1f675bff07515f5df96737194ea945c36c41e7b4fcef307b7cd4d0e602a6911181525060019060026200006b929190620001aa565b50604051806040016040528060007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020017f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681525060039060026200013c929190620001fc565b503480156200014a57600080fd5b5060405162001380380380620013808339818101604052810190620001709190620006df565b816000908051906020019062000188929190620002aa565b508060029080519060200190620001a1929190620002fc565b50505062000764565b828054828255906000526020600020908101928215620001e9579160200282015b82811115620001e8578251825591602001919060010190620001cb565b5b509050620001f89190620003aa565b5090565b82805482825590600052602060002090601f01602090048101928215620002975791602002820160005b838211156200026657835183826101000a81548160ff021916908360f81c0217905550926020019260010160208160000104928301926001030262000226565b8015620002955782816101000a81549060ff021916905560010160208160000104928301926001030262000266565b505b509050620002a69190620003c9565b5090565b828054828255906000526020600020908101928215620002e9579160200282015b82811115620002e8578251825591602001919060010190620002cb565b5b509050620002f89190620003aa565b5090565b82805482825590600052602060002090601f01602090048101928215620003975791602002820160005b838211156200036657835183826101000a81548160ff021916908360f81c0217905550926020019260010160208160000104928301926001030262000326565b8015620003955782816101000a81549060ff021916905560010160208160000104928301926001030262000366565b505b509050620003a69190620003c9565b5090565b5b80821115620003c5576000816000905550600101620003ab565b5090565b5b80821115620003e4576000816000905550600101620003ca565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200044c8262000401565b810181811067ffffffffffffffff821117156200046e576200046d62000412565b5b80604052505050565b600062000483620003e8565b905062000491828262000441565b919050565b600067ffffffffffffffff821115620004b457620004b362000412565b5b602082029050602081019050919050565b600080fd5b6000819050919050565b620004df81620004ca565b8114620004eb57600080fd5b50565b600081519050620004ff81620004d4565b92915050565b60006200051c620005168462000496565b62000477565b90508083825260208201905060208402830185811115620005425762000541620004c5565b5b835b818110156200056f57806200055a8882620004ee565b84526020840193505060208101905062000544565b5050509392505050565b600082601f830112620005915762000590620003fc565b5b8151620005a384826020860162000505565b91505092915050565b600067ffffffffffffffff821115620005ca57620005c962000412565b5b602082029050602081019050919050565b60007fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6200061281620005db565b81146200061e57600080fd5b50565b600081519050620006328162000607565b92915050565b60006200064f6200064984620005ac565b62000477565b90508083825260208201905060208402830185811115620006755762000674620004c5565b5b835b81811015620006a257806200068d888262000621565b84526020840193505060208101905062000677565b5050509392505050565b600082601f830112620006c457620006c3620003fc565b5b8151620006d684826020860162000638565b91505092915050565b60008060408385031215620006f957620006f8620003f2565b5b600083015167ffffffffffffffff8111156200071a5762000719620003f7565b5b620007288582860162000579565b925050602083015167ffffffffffffffff8111156200074c576200074b620003f7565b5b6200075a85828601620006ac565b9150509250929050565b610c0c80620007746000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063542d83de11610066578063542d83de1461015b578063605ba2711461018b5780638abe51fd146101a9578063962e450c146101c7578063bb69679b146101f75761009e565b80630afe5e33146100a357806312c9dcc8146100c15780631579bf66146100f15780633ddcea2f1461010f57806351b487881461012b575b600080fd5b6100ab610213565b6040516100b891906106d7565b60405180910390f35b6100db60048036038101906100d69190610743565b61026b565b6040516100e891906107ab565b60405180910390f35b6100f961029f565b6040516101069190610884565b60405180910390f35b61012960048036038101906101249190610a2b565b61033c565b005b61014560048036038101906101409190610743565b610356565b6040516101529190610a83565b60405180910390f35b61017560048036038101906101709190610743565b61037a565b6040516101829190610a83565b60405180910390f35b61019361039e565b6040516101a091906106d7565b60405180910390f35b6101b16103f6565b6040516101be9190610884565b60405180910390f35b6101e160048036038101906101dc9190610743565b610493565b6040516101ee91906107ab565b60405180910390f35b610211600480360381019061020c9190610b8d565b6104c7565b005b6060600180548060200260200160405190810160405280929190818152602001828054801561026157602002820191906000526020600020905b81548152602001906001019080831161024d575b5050505050905090565b6002818154811061027b57600080fd5b9060005260206000209060209182820401919006915054906101000a900460f81b81565b6060600380548060200260200160405190810160405280929190818152602001828054801561033257602002820191906000526020600020906000905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020826000010492830192600103820291508084116102dc5790505b5050505050905090565b80600290805190602001906103529291906104e1565b5050565b6001818154811061036657600080fd5b906000526020600020016000915090505481565b6000818154811061038a57600080fd5b906000526020600020016000915090505481565b606060008054806020026020016040519081016040528092919081815260200182805480156103ec57602002820191906000526020600020905b8154815260200190600101908083116103d8575b5050505050905090565b6060600280548060200260200160405190810160405280929190818152602001828054801561048957602002820191906000526020600020906000905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020826000010492830192600103820291508084116104335790505b5050505050905090565b600381815481106104a357600080fd5b9060005260206000209060209182820401919006915054906101000a900460f81b81565b80600090805190602001906104dd929190610588565b5050565b82805482825590600052602060002090601f016020900481019282156105775791602002820160005b8382111561054857835183826101000a81548160ff021916908360f81c0217905550926020019260010160208160000104928301926001030261050a565b80156105755782816101000a81549060ff0219169055600101602081600001049283019260010302610548565b505b50905061058491906105d5565b5090565b8280548282559060005260206000209081019282156105c4579160200282015b828111156105c35782518255916020019190600101906105a8565b5b5090506105d191906105f2565b5090565b5b808211156105ee5760008160009055506001016105d6565b5090565b5b8082111561060b5760008160009055506001016105f3565b5090565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b61064e8161063b565b82525050565b60006106608383610645565b60208301905092915050565b6000602082019050919050565b60006106848261060f565b61068e818561061a565b93506106998361062b565b8060005b838110156106ca5781516106b18882610654565b97506106bc8361066c565b92505060018101905061069d565b5085935050505092915050565b600060208201905081810360008301526106f18184610679565b905092915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6107208161070d565b811461072b57600080fd5b50565b60008135905061073d81610717565b92915050565b60006020828403121561075957610758610703565b5b60006107678482850161072e565b91505092915050565b60007fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6107a581610770565b82525050565b60006020820190506107c0600083018461079c565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6107fb81610770565b82525050565b600061080d83836107f2565b60208301905092915050565b6000602082019050919050565b6000610831826107c6565b61083b81856107d1565b9350610846836107e2565b8060005b8381101561087757815161085e8882610801565b975061086983610819565b92505060018101905061084a565b5085935050505092915050565b6000602082019050818103600083015261089e8184610826565b905092915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6108f4826108ab565b810181811067ffffffffffffffff82111715610913576109126108bc565b5b80604052505050565b60006109266106f9565b905061093282826108eb565b919050565b600067ffffffffffffffff821115610952576109516108bc565b5b602082029050602081019050919050565b600080fd5b61097181610770565b811461097c57600080fd5b50565b60008135905061098e81610968565b92915050565b60006109a76109a284610937565b61091c565b905080838252602082019050602084028301858111156109ca576109c9610963565b5b835b818110156109f357806109df888261097f565b8452602084019350506020810190506109cc565b5050509392505050565b600082601f830112610a1257610a116108a6565b5b8135610a22848260208601610994565b91505092915050565b600060208284031215610a4157610a40610703565b5b600082013567ffffffffffffffff811115610a5f57610a5e610708565b5b610a6b848285016109fd565b91505092915050565b610a7d8161063b565b82525050565b6000602082019050610a986000830184610a74565b92915050565b600067ffffffffffffffff821115610ab957610ab86108bc565b5b602082029050602081019050919050565b610ad38161063b565b8114610ade57600080fd5b50565b600081359050610af081610aca565b92915050565b6000610b09610b0484610a9e565b61091c565b90508083825260208201905060208402830185811115610b2c57610b2b610963565b5b835b81811015610b555780610b418882610ae1565b845260208401935050602081019050610b2e565b5050509392505050565b600082601f830112610b7457610b736108a6565b5b8135610b84848260208601610af6565b91505092915050565b600060208284031215610ba357610ba2610703565b5b600082013567ffffffffffffffff811115610bc157610bc0610708565b5b610bcd84828501610b5f565b9150509291505056fea26469706673582212208c21ac9e510a097aed789e8e3d64755d3ee254c3b6b641a72843a1d910822fc364736f6c63430008110033" # noqa: E501 +ARRAYS_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063542d83de11610066578063542d83de1461015b578063605ba2711461018b5780638abe51fd146101a9578063962e450c146101c7578063bb69679b146101f75761009e565b80630afe5e33146100a357806312c9dcc8146100c15780631579bf66146100f15780633ddcea2f1461010f57806351b487881461012b575b600080fd5b6100ab610213565b6040516100b891906106d7565b60405180910390f35b6100db60048036038101906100d69190610743565b61026b565b6040516100e891906107ab565b60405180910390f35b6100f961029f565b6040516101069190610884565b60405180910390f35b61012960048036038101906101249190610a2b565b61033c565b005b61014560048036038101906101409190610743565b610356565b6040516101529190610a83565b60405180910390f35b61017560048036038101906101709190610743565b61037a565b6040516101829190610a83565b60405180910390f35b61019361039e565b6040516101a091906106d7565b60405180910390f35b6101b16103f6565b6040516101be9190610884565b60405180910390f35b6101e160048036038101906101dc9190610743565b610493565b6040516101ee91906107ab565b60405180910390f35b610211600480360381019061020c9190610b8d565b6104c7565b005b6060600180548060200260200160405190810160405280929190818152602001828054801561026157602002820191906000526020600020905b81548152602001906001019080831161024d575b5050505050905090565b6002818154811061027b57600080fd5b9060005260206000209060209182820401919006915054906101000a900460f81b81565b6060600380548060200260200160405190810160405280929190818152602001828054801561033257602002820191906000526020600020906000905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020826000010492830192600103820291508084116102dc5790505b5050505050905090565b80600290805190602001906103529291906104e1565b5050565b6001818154811061036657600080fd5b906000526020600020016000915090505481565b6000818154811061038a57600080fd5b906000526020600020016000915090505481565b606060008054806020026020016040519081016040528092919081815260200182805480156103ec57602002820191906000526020600020905b8154815260200190600101908083116103d8575b5050505050905090565b6060600280548060200260200160405190810160405280929190818152602001828054801561048957602002820191906000526020600020906000905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020826000010492830192600103820291508084116104335790505b5050505050905090565b600381815481106104a357600080fd5b9060005260206000209060209182820401919006915054906101000a900460f81b81565b80600090805190602001906104dd929190610588565b5050565b82805482825590600052602060002090601f016020900481019282156105775791602002820160005b8382111561054857835183826101000a81548160ff021916908360f81c0217905550926020019260010160208160000104928301926001030261050a565b80156105755782816101000a81549060ff0219169055600101602081600001049283019260010302610548565b505b50905061058491906105d5565b5090565b8280548282559060005260206000209081019282156105c4579160200282015b828111156105c35782518255916020019190600101906105a8565b5b5090506105d191906105f2565b5090565b5b808211156105ee5760008160009055506001016105d6565b5090565b5b8082111561060b5760008160009055506001016105f3565b5090565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b61064e8161063b565b82525050565b60006106608383610645565b60208301905092915050565b6000602082019050919050565b60006106848261060f565b61068e818561061a565b93506106998361062b565b8060005b838110156106ca5781516106b18882610654565b97506106bc8361066c565b92505060018101905061069d565b5085935050505092915050565b600060208201905081810360008301526106f18184610679565b905092915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6107208161070d565b811461072b57600080fd5b50565b60008135905061073d81610717565b92915050565b60006020828403121561075957610758610703565b5b60006107678482850161072e565b91505092915050565b60007fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6107a581610770565b82525050565b60006020820190506107c0600083018461079c565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6107fb81610770565b82525050565b600061080d83836107f2565b60208301905092915050565b6000602082019050919050565b6000610831826107c6565b61083b81856107d1565b9350610846836107e2565b8060005b8381101561087757815161085e8882610801565b975061086983610819565b92505060018101905061084a565b5085935050505092915050565b6000602082019050818103600083015261089e8184610826565b905092915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6108f4826108ab565b810181811067ffffffffffffffff82111715610913576109126108bc565b5b80604052505050565b60006109266106f9565b905061093282826108eb565b919050565b600067ffffffffffffffff821115610952576109516108bc565b5b602082029050602081019050919050565b600080fd5b61097181610770565b811461097c57600080fd5b50565b60008135905061098e81610968565b92915050565b60006109a76109a284610937565b61091c565b905080838252602082019050602084028301858111156109ca576109c9610963565b5b835b818110156109f357806109df888261097f565b8452602084019350506020810190506109cc565b5050509392505050565b600082601f830112610a1257610a116108a6565b5b8135610a22848260208601610994565b91505092915050565b600060208284031215610a4157610a40610703565b5b600082013567ffffffffffffffff811115610a5f57610a5e610708565b5b610a6b848285016109fd565b91505092915050565b610a7d8161063b565b82525050565b6000602082019050610a986000830184610a74565b92915050565b600067ffffffffffffffff821115610ab957610ab86108bc565b5b602082029050602081019050919050565b610ad38161063b565b8114610ade57600080fd5b50565b600081359050610af081610aca565b92915050565b6000610b09610b0484610a9e565b61091c565b90508083825260208201905060208402830185811115610b2c57610b2b610963565b5b835b81811015610b555780610b418882610ae1565b845260208401935050602081019050610b2e565b5050509392505050565b600082601f830112610b7457610b736108a6565b5b8135610b84848260208601610af6565b91505092915050565b600060208284031215610ba357610ba2610703565b5b600082013567ffffffffffffffff811115610bc157610bc0610708565b5b610bcd84828501610b5f565b9150509291505056fea26469706673582212208c21ac9e510a097aed789e8e3d64755d3ee254c3b6b641a72843a1d910822fc364736f6c63430008110033" # noqa: E501 +ARRAYS_CONTRACT_ABI = [ + { + "inputs": [ + {"internalType": "bytes32[]", "name": "_bytes32Value", "type": "bytes32[]"}, + {"internalType": "bytes1[]", "name": "_byteValue", "type": "bytes1[]"}, + ], + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "inputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "name": "byteConstValue", + "outputs": [{"internalType": "bytes1", "name": "", "type": "bytes1"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "name": "byteValue", + "outputs": [{"internalType": "bytes1", "name": "", "type": "bytes1"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "name": "bytes32ConstValue", + "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "name": "bytes32Value", + "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "getByteConstValue", + "outputs": [{"internalType": "bytes1[]", "name": "", "type": "bytes1[]"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "getByteValue", + "outputs": [{"internalType": "bytes1[]", "name": "", "type": "bytes1[]"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "getBytes32ConstValue", + "outputs": [{"internalType": "bytes32[]", "name": "", "type": "bytes32[]"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "getBytes32Value", + "outputs": [{"internalType": "bytes32[]", "name": "", "type": "bytes32[]"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes1[]", "name": "_byteValue", "type": "bytes1[]"} + ], + "name": "setByteValue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes32[]", "name": "_bytes32Value", "type": "bytes32[]"} + ], + "name": "setBytes32Value", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, +] +ARRAYS_CONTRACT_DATA = { + "bytecode": ARRAYS_CONTRACT_BYTECODE, + "bytecode_runtime": ARRAYS_CONTRACT_RUNTIME, + "abi": ARRAYS_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/bytes_contracts.py b/web3/_utils/contract_sources/contract_data/bytes_contracts.py new file mode 100644 index 0000000000..4b535a170f --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/bytes_contracts.py @@ -0,0 +1,79 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/BytesContracts.sol:BytesContract +BYTES_CONTRACT_BYTECODE = "0x60806040526040518060400160405280600281526020017f0123000000000000000000000000000000000000000000000000000000000000815250600090816200004a919062000311565b503480156200005857600080fd5b5060405162000de638038062000de683398181016040528101906200007e91906200055c565b80600190816200008f9190620005b8565b50506200069f565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200011957607f821691505b6020821081036200012f576200012e620000d1565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001997fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200015a565b620001a586836200015a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620001f2620001ec620001e684620001bd565b620001c7565b620001bd565b9050919050565b6000819050919050565b6200020e83620001d1565b620002266200021d82620001f9565b84845462000167565b825550505050565b600090565b6200023d6200022e565b6200024a81848462000203565b505050565b5b8181101562000272576200026660008262000233565b60018101905062000250565b5050565b601f821115620002c1576200028b8162000135565b62000296846200014a565b81016020851015620002a6578190505b620002be620002b5856200014a565b8301826200024f565b50505b505050565b600082821c905092915050565b6000620002e660001984600802620002c6565b1980831691505092915050565b6000620003018383620002d3565b9150826002028217905092915050565b6200031c8262000097565b67ffffffffffffffff811115620003385762000337620000a2565b5b62000344825462000100565b6200035182828562000276565b600060209050601f83116001811462000389576000841562000374578287015190505b620003808582620002f3565b865550620003f0565b601f198416620003998662000135565b60005b82811015620003c3578489015182556001820191506020850194506020810190506200039c565b86831015620003e35784890151620003df601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b620004328262000416565b810181811067ffffffffffffffff82111715620004545762000453620000a2565b5b80604052505050565b600062000469620003f8565b905062000477828262000427565b919050565b600067ffffffffffffffff8211156200049a5762000499620000a2565b5b620004a58262000416565b9050602081019050919050565b60005b83811015620004d2578082015181840152602081019050620004b5565b60008484015250505050565b6000620004f5620004ef846200047c565b6200045d565b90508281526020810184848401111562000514576200051362000411565b5b62000521848285620004b2565b509392505050565b600082601f8301126200054157620005406200040c565b5b815162000553848260208601620004de565b91505092915050565b60006020828403121562000575576200057462000402565b5b600082015167ffffffffffffffff81111562000596576200059562000407565b5b620005a48482850162000529565b91505092915050565b600081519050919050565b620005c382620005ad565b67ffffffffffffffff811115620005df57620005de620000a2565b5b620005eb825462000100565b620005f882828562000276565b600060209050601f8311600181146200063057600084156200061b578287015190505b620006278582620002f3565b86555062000697565b601f198416620006408662000135565b60005b828110156200066a5784890151825560018201915060208501945060208101905062000643565b868310156200068a578489015162000686601f891682620002d3565b8355505b6001600288020188555050505b505050505050565b61073780620006af6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee14610064578063439970aa14610082575b600080fd5b61004e61009e565b60405161005b9190610265565b60405180910390f35b61006c610130565b6040516100799190610265565b60405180910390f35b61009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea264697066735822122079b820450b5fde98cf8014fef032b7c988897fb9315212b570ae68a3b64084a064736f6c63430008110033" # noqa: E501 +BYTES_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee14610064578063439970aa14610082575b600080fd5b61004e61009e565b60405161005b9190610265565b60405180910390f35b61006c610130565b6040516100799190610265565b60405180910390f35b61009c600480360381019061009791906103d0565b6101c2565b005b6060600180546100ad90610448565b80601f01602080910402602001604051908101604052809291908181526020018280546100d990610448565b80156101265780601f106100fb57610100808354040283529160200191610126565b820191906000526020600020905b81548152906001019060200180831161010957829003601f168201915b5050505050905090565b60606000805461013f90610448565b80601f016020809104026020016040519081016040528092919081815260200182805461016b90610448565b80156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b5050505050905090565b80600190816101d1919061062f565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561020f5780820151818401526020810190506101f4565b60008484015250505050565b6000601f19601f8301169050919050565b6000610237826101d5565b61024181856101e0565b93506102518185602086016101f1565b61025a8161021b565b840191505092915050565b6000602082019050818103600083015261027f818461022c565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102dd8261021b565b810181811067ffffffffffffffff821117156102fc576102fb6102a5565b5b80604052505050565b600061030f610287565b905061031b82826102d4565b919050565b600067ffffffffffffffff82111561033b5761033a6102a5565b5b6103448261021b565b9050602081019050919050565b82818337600083830152505050565b600061037361036e84610320565b610305565b90508281526020810184848401111561038f5761038e6102a0565b5b61039a848285610351565b509392505050565b600082601f8301126103b7576103b661029b565b5b81356103c7848260208601610360565b91505092915050565b6000602082840312156103e6576103e5610291565b5b600082013567ffffffffffffffff81111561040457610403610296565b5b610410848285016103a2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061046057607f821691505b60208210810361047357610472610419565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104db7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261049e565b6104e5868361049e565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061052c610527610522846104fd565b610507565b6104fd565b9050919050565b6000819050919050565b61054683610511565b61055a61055282610533565b8484546104ab565b825550505050565b600090565b61056f610562565b61057a81848461053d565b505050565b5b8181101561059e57610593600082610567565b600181019050610580565b5050565b601f8211156105e3576105b481610479565b6105bd8461048e565b810160208510156105cc578190505b6105e06105d88561048e565b83018261057f565b50505b505050565b600082821c905092915050565b6000610606600019846008026105e8565b1980831691505092915050565b600061061f83836105f5565b9150826002028217905092915050565b610638826101d5565b67ffffffffffffffff811115610651576106506102a5565b5b61065b8254610448565b6106668282856105a2565b600060209050601f8311600181146106995760008415610687578287015190505b6106918582610613565b8655506106f9565b601f1984166106a786610479565b60005b828110156106cf578489015182556001820191506020850194506020810190506106aa565b868310156106ec57848901516106e8601f8916826105f5565b8355505b6001600288020188555050505b50505050505056fea264697066735822122079b820450b5fde98cf8014fef032b7c988897fb9315212b570ae68a3b64084a064736f6c63430008110033" # noqa: E501 +BYTES_CONTRACT_ABI = [ + { + "inputs": [{"internalType": "bytes", "name": "_value", "type": "bytes"}], + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "inputs": [], + "name": "constValue", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "getValue", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "bytes", "name": "_value", "type": "bytes"}], + "name": "setValue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, +] +BYTES_CONTRACT_DATA = { + "bytecode": BYTES_CONTRACT_BYTECODE, + "bytecode_runtime": BYTES_CONTRACT_RUNTIME, + "abi": BYTES_CONTRACT_ABI, +} + + +# source: web3/_utils/contract_sources/BytesContracts.sol:Bytes32Contract +BYTES32_CONTRACT_BYTECODE = "0x60806040527f012301230123012301230123012301230123012301230123012301230123012360005534801561003457600080fd5b5060405161025d38038061025d8339818101604052810190610056919061009e565b80600181905550506100cb565b600080fd5b6000819050919050565b61007b81610068565b811461008657600080fd5b50565b60008151905061009881610072565b92915050565b6000602082840312156100b4576100b3610063565b5b60006100c284828501610089565b91505092915050565b610183806100da6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee1461006457806358825b1014610082575b600080fd5b61004e61009e565b60405161005b91906100d4565b60405180910390f35b61006c6100a8565b60405161007991906100d4565b60405180910390f35b61009c60048036038101906100979190610120565b6100b1565b005b6000600154905090565b60008054905090565b8060018190555050565b6000819050919050565b6100ce816100bb565b82525050565b60006020820190506100e960008301846100c5565b92915050565b600080fd5b6100fd816100bb565b811461010857600080fd5b50565b60008135905061011a816100f4565b92915050565b600060208284031215610136576101356100ef565b5b60006101448482850161010b565b9150509291505056fea26469706673582212207f2269970fdd74807e2d21ccbbe4bae3f852e5fedde98719a243f48bca6b1fa964736f6c63430008110033" # noqa: E501 +BYTES32_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063209652551461004657806330de3cee1461006457806358825b1014610082575b600080fd5b61004e61009e565b60405161005b91906100d4565b60405180910390f35b61006c6100a8565b60405161007991906100d4565b60405180910390f35b61009c60048036038101906100979190610120565b6100b1565b005b6000600154905090565b60008054905090565b8060018190555050565b6000819050919050565b6100ce816100bb565b82525050565b60006020820190506100e960008301846100c5565b92915050565b600080fd5b6100fd816100bb565b811461010857600080fd5b50565b60008135905061011a816100f4565b92915050565b600060208284031215610136576101356100ef565b5b60006101448482850161010b565b9150509291505056fea26469706673582212207f2269970fdd74807e2d21ccbbe4bae3f852e5fedde98719a243f48bca6b1fa964736f6c63430008110033" # noqa: E501 +BYTES32_CONTRACT_ABI = [ + { + "inputs": [{"internalType": "bytes32", "name": "_value", "type": "bytes32"}], + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "inputs": [], + "name": "constValue", + "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "getValue", + "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "bytes32", "name": "_value", "type": "bytes32"}], + "name": "setValue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, +] +BYTES32_CONTRACT_DATA = { + "bytecode": BYTES32_CONTRACT_BYTECODE, + "bytecode_runtime": BYTES32_CONTRACT_RUNTIME, + "abi": BYTES32_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/constructor_contracts.py b/web3/_utils/contract_sources/contract_data/constructor_contracts.py new file mode 100644 index 0000000000..ef4190e704 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/constructor_contracts.py @@ -0,0 +1,74 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/ConstructorContracts.sol:SimpleConstructorContract # noqa: E501 +SIMPLE_CONSTRUCTOR_CONTRACT_BYTECODE = "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220da06e0463d6a8580cff9f1e7934ce1b2f5b8b2bae8de664662738c02f755ee4564736f6c63430008110033" # noqa: E501 +SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME = "0x6080604052600080fdfea2646970667358221220da06e0463d6a8580cff9f1e7934ce1b2f5b8b2bae8de664662738c02f755ee4564736f6c63430008110033" # noqa: E501 +SIMPLE_CONSTRUCTOR_CONTRACT_ABI = [ + {"inputs": [], "stateMutability": "nonpayable", "type": "constructor"} +] +SIMPLE_CONSTRUCTOR_CONTRACT_DATA = { + "bytecode": SIMPLE_CONSTRUCTOR_CONTRACT_BYTECODE, + "bytecode_runtime": SIMPLE_CONSTRUCTOR_CONTRACT_RUNTIME, + "abi": SIMPLE_CONSTRUCTOR_CONTRACT_ABI, +} + + +# source: web3/_utils/contract_sources/ConstructorContracts.sol:ConstructorWithArgumentsContract # noqa: E501 +CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50604051610214380380610214833981810160405281019061003291906100b8565b816000819055508060018190555050506100f8565b600080fd5b6000819050919050565b61005f8161004c565b811461006a57600080fd5b50565b60008151905061007c81610056565b92915050565b6000819050919050565b61009581610082565b81146100a057600080fd5b50565b6000815190506100b28161008c565b92915050565b600080604083850312156100cf576100ce610047565b5b60006100dd8582860161006d565b92505060206100ee858286016100a3565b9150509250929050565b61010d806101076000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806388ec1346146037578063d4c46c76146051575b600080fd5b603d606b565b60405160489190608e565b60405180910390f35b60576071565b6040516062919060be565b60405180910390f35b60005481565b60015481565b6000819050919050565b6088816077565b82525050565b600060208201905060a160008301846081565b92915050565b6000819050919050565b60b88160a7565b82525050565b600060208201905060d1600083018460b1565b9291505056fea264697066735822122042e6d559441ea02e39756bdc74c95f4da95672f703694cad4bc6568dcfa32d7664736f6c63430008110033" # noqa: E501 +CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME = "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806388ec1346146037578063d4c46c76146051575b600080fd5b603d606b565b60405160489190608e565b60405180910390f35b60576071565b6040516062919060be565b60405180910390f35b60005481565b60015481565b6000819050919050565b6088816077565b82525050565b600060208201905060a160008301846081565b92915050565b6000819050919050565b60b88160a7565b82525050565b600060208201905060d1600083018460b1565b9291505056fea264697066735822122042e6d559441ea02e39756bdc74c95f4da95672f703694cad4bc6568dcfa32d7664736f6c63430008110033" # noqa: E501 +CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_ABI = [ + { + "inputs": [ + {"internalType": "uint256", "name": "a", "type": "uint256"}, + {"internalType": "bytes32", "name": "b", "type": "bytes32"}, + ], + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "inputs": [], + "name": "data_a", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "data_b", + "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], + "stateMutability": "view", + "type": "function", + }, +] +CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA = { + "bytecode": CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_BYTECODE, + "bytecode_runtime": CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME, + "abi": CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_ABI, +} + + +# source: web3/_utils/contract_sources/ConstructorContracts.sol:ConstructorWithAddressArgumentContract # noqa: E501 +CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b5060405161020d38038061020d833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b60f7806101166000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c806334664e3a14602d575b600080fd5b60336047565b604051603e919060a8565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000609482606b565b9050919050565b60a281608b565b82525050565b600060208201905060bb6000830184609b565b9291505056fea2646970667358221220a2033400b3f8a2ff265192f4234996bca3b25af27a799ddb8d1ae2e2bcc165a664736f6c63430008110033" # noqa: E501 +CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME = "0x6080604052348015600f57600080fd5b506004361060285760003560e01c806334664e3a14602d575b600080fd5b60336047565b604051603e919060a8565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000609482606b565b9050919050565b60a281608b565b82525050565b600060208201905060bb6000830184609b565b9291505056fea2646970667358221220a2033400b3f8a2ff265192f4234996bca3b25af27a799ddb8d1ae2e2bcc165a664736f6c63430008110033" # noqa: E501 +CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_ABI = [ + { + "inputs": [{"internalType": "address", "name": "_testAddr", "type": "address"}], + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "inputs": [], + "name": "testAddr", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function", + }, +] +CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA = { + "bytecode": CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_BYTECODE, + "bytecode_runtime": CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_RUNTIME, + "abi": CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/contract_caller_tester.py b/web3/_utils/contract_sources/contract_data/contract_caller_tester.py new file mode 100644 index 0000000000..3f9bc7a834 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/contract_caller_tester.py @@ -0,0 +1,59 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/ContractCallerTester.sol:ContractCallerTester +CONTRACT_CALLER_TESTER_BYTECODE = "0x608060405234801561001057600080fd5b50610458806100206000396000f3fe60806040526004361061004a5760003560e01c806306661abd1461004f57806361bc221a1461007a578063a5f3c23b14610098578063c7fa7d66146100c8578063d09de08a146100ea575b600080fd5b34801561005b57600080fd5b50610064610115565b60405161007191906101df565b60405180910390f35b61008261011b565b60405161008f91906101df565b60405180910390f35b6100b260048036038101906100ad919061022b565b610124565b6040516100bf91906101df565b60405180910390f35b6100d061013a565b6040516100e1959493929190610355565b60405180910390f35b3480156100f657600080fd5b506100ff6101a7565b60405161010c91906101df565b60405180910390f35b60005481565b60008054905090565b6000818361013291906103de565b905092915050565b600060606000806000336000365a344384848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505093509091929350945094509450945094509091929394565b600060016000808282546101bb91906103de565b925050819055905090565b6000819050919050565b6101d9816101c6565b82525050565b60006020820190506101f460008301846101d0565b92915050565b600080fd5b610208816101c6565b811461021357600080fd5b50565b600081359050610225816101ff565b92915050565b60008060408385031215610242576102416101fa565b5b600061025085828601610216565b925050602061026185828601610216565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102968261026b565b9050919050565b6102a68161028b565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156102e65780820151818401526020810190506102cb565b60008484015250505050565b6000601f19601f8301169050919050565b600061030e826102ac565b61031881856102b7565b93506103288185602086016102c8565b610331816102f2565b840191505092915050565b6000819050919050565b61034f8161033c565b82525050565b600060a08201905061036a600083018861029d565b818103602083015261037c8187610303565b905061038b6040830186610346565b6103986060830185610346565b6103a56080830184610346565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e9826101c6565b91506103f4836101c6565b92508282019050828112156000831216838212600084121516171561041c5761041b6103af565b5b9291505056fea26469706673582212204625bd56480b2c7c4d0164f97398e5d871be2d10c7ff6251d9c31837585b51aa64736f6c63430008110033" # noqa: E501 +CONTRACT_CALLER_TESTER_RUNTIME = "0x60806040526004361061004a5760003560e01c806306661abd1461004f57806361bc221a1461007a578063a5f3c23b14610098578063c7fa7d66146100c8578063d09de08a146100ea575b600080fd5b34801561005b57600080fd5b50610064610115565b60405161007191906101df565b60405180910390f35b61008261011b565b60405161008f91906101df565b60405180910390f35b6100b260048036038101906100ad919061022b565b610124565b6040516100bf91906101df565b60405180910390f35b6100d061013a565b6040516100e1959493929190610355565b60405180910390f35b3480156100f657600080fd5b506100ff6101a7565b60405161010c91906101df565b60405180910390f35b60005481565b60008054905090565b6000818361013291906103de565b905092915050565b600060606000806000336000365a344384848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505093509091929350945094509450945094509091929394565b600060016000808282546101bb91906103de565b925050819055905090565b6000819050919050565b6101d9816101c6565b82525050565b60006020820190506101f460008301846101d0565b92915050565b600080fd5b610208816101c6565b811461021357600080fd5b50565b600081359050610225816101ff565b92915050565b60008060408385031215610242576102416101fa565b5b600061025085828601610216565b925050602061026185828601610216565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102968261026b565b9050919050565b6102a68161028b565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156102e65780820151818401526020810190506102cb565b60008484015250505050565b6000601f19601f8301169050919050565b600061030e826102ac565b61031881856102b7565b93506103288185602086016102c8565b610331816102f2565b840191505092915050565b6000819050919050565b61034f8161033c565b82525050565b600060a08201905061036a600083018861029d565b818103602083015261037c8187610303565b905061038b6040830186610346565b6103986060830185610346565b6103a56080830184610346565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e9826101c6565b91506103f4836101c6565b92508282019050828112156000831216838212600084121516171561041c5761041b6103af565b5b9291505056fea26469706673582212204625bd56480b2c7c4d0164f97398e5d871be2d10c7ff6251d9c31837585b51aa64736f6c63430008110033" # noqa: E501 +CONTRACT_CALLER_TESTER_ABI = [ + { + "inputs": [ + {"internalType": "int256", "name": "a", "type": "int256"}, + {"internalType": "int256", "name": "b", "type": "int256"}, + ], + "name": "add", + "outputs": [{"internalType": "int256", "name": "", "type": "int256"}], + "stateMutability": "payable", + "type": "function", + }, + { + "inputs": [], + "name": "count", + "outputs": [{"internalType": "int256", "name": "", "type": "int256"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "counter", + "outputs": [{"internalType": "int256", "name": "", "type": "int256"}], + "stateMutability": "payable", + "type": "function", + }, + { + "inputs": [], + "name": "increment", + "outputs": [{"internalType": "int256", "name": "", "type": "int256"}], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [], + "name": "returnMeta", + "outputs": [ + {"internalType": "address", "name": "", "type": "address"}, + {"internalType": "bytes", "name": "", "type": "bytes"}, + {"internalType": "uint256", "name": "", "type": "uint256"}, + {"internalType": "uint256", "name": "", "type": "uint256"}, + {"internalType": "uint256", "name": "", "type": "uint256"}, + ], + "stateMutability": "payable", + "type": "function", + }, +] +CONTRACT_CALLER_TESTER_DATA = { + "bytecode": CONTRACT_CALLER_TESTER_BYTECODE, + "bytecode_runtime": CONTRACT_CALLER_TESTER_RUNTIME, + "abi": CONTRACT_CALLER_TESTER_ABI, +} diff --git a/web3/_utils/module_testing/emitter_contract.py b/web3/_utils/contract_sources/contract_data/emitter_contract.py similarity index 96% rename from web3/_utils/module_testing/emitter_contract.py rename to web3/_utils/contract_sources/contract_data/emitter_contract.py index e9cc4c0769..2e41aa4bc8 100644 --- a/web3/_utils/module_testing/emitter_contract.py +++ b/web3/_utils/contract_sources/contract_data/emitter_contract.py @@ -1,5 +1,11 @@ -EMITTER_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50611757806100206000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea2646970667358221220ec88b319375caff81e8c1241afc561e6d7efd520711cb59b03a0a920b2656edc64736f6c63430008110033" # noqa: E501 -EMITTER_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea2646970667358221220ec88b319375caff81e8c1241afc561e6d7efd520711cb59b03a0a920b2656edc64736f6c63430008110033" # noqa: E501 +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/EmitterContract.sol:EmitterContract +EMITTER_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50611757806100206000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea2646970667358221220c7fe1cb35e1edd22692be334329b7e6d9569a4321e3ad8a71942932ca8cf0fde64736f6c63430008110033" # noqa: E501 +EMITTER_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80639c377053116100715780639c37705314610161578063aa6fd8221461017d578063acabb9ed14610199578063b2ddc449146101b5578063e17bf956146101d1578063f82ef69e146101ed576100b4565b80630bb563d6146100b957806317c0c180146100d557806320f0256e146100f15780635da86c171461010d57806390b41d8b14610129578063966b50e014610145575b600080fd5b6100d360048036038101906100ce9190610af3565b610209565b005b6100ef60048036038101906100ea9190610b61565b610243565b005b61010b60048036038101906101069190610bc4565b61031b565b005b61012760048036038101906101229190610ce4565b610438565b005b610143600480360381019061013e9190610d24565b610475565b005b61015f600480360381019061015a9190610e97565b6105d2565b005b61017b60048036038101906101769190610f0f565b610623565b005b61019760048036038101906101929190610f76565b61073b565b005b6101b360048036038101906101ae9190610fb6565b61087f565b005b6101cf60048036038101906101ca919061108c565b6108d0565b005b6101eb60048036038101906101e6919061116d565b610922565b005b6102076004803603810190610202919061108c565b61095c565b005b7fa95e6e2a182411e7a6f9ed114a85c3761d87f9b8f453d842c71235aa64fff99f816040516102389190611235565b60405180910390a150565b6001601281111561025757610256611257565b5b81601281111561026a57610269611257565b5b036102a0577f1e86022f78f8d04f8e3dfd13a2bdb280403e6632877c0dbee5e4eeb259908a5c60405160405180910390a1610318565b600060128111156102b4576102b3611257565b5b8160128111156102c7576102c6611257565b5b036102dc5760405160405180910390a0610317565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030e906112f8565b60405180910390fd5b5b50565b6005601281111561032f5761032e611257565b5b85601281111561034257610341611257565b5b03610389577ff039d147f23fe975a4254bdf6b1502b8c79132ae1833986b7ccef2638e73fdf98484848460405161037c9493929190611327565b60405180910390a1610431565b600b601281111561039d5761039c611257565b5b8560128111156103b0576103af611257565b5b036103f55780827fa30ece802b64cd2b7e57dabf4010aabf5df26d1556977affb07b98a77ad955b586866040516103e892919061136c565b60405180910390a3610430565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906112f8565b60405180910390fd5b5b5050505050565b7f8ccce2523cca5f3851d20df50b5a59509bc4ac7d9ddba344f5e331969d09b8e78282604051610469929190611402565b60405180910390a15050565b6003601281111561048957610488611257565b5b83601281111561049c5761049b611257565b5b036104df577fdf0cb1dea99afceb3ea698d62e705b736f1345a7eee9eb07e63d1f8f556c1bc582826040516104d292919061136c565b60405180910390a16105cd565b600960128111156104f3576104f2611257565b5b83601281111561050657610505611257565b5b0361054857807f057bc32826fbe161da1c110afcdcae7c109a8b69149f727fc37a603c60ef94ca8360405161053b919061142b565b60405180910390a26105cc565b6008601281111561055c5761055b611257565b5b83601281111561056f5761056e611257565b5b03610590578082604051610583919061142b565b60405180910390a16105cb565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c2906112f8565b60405180910390fd5b5b5b505050565b816040516105e091906114fe565b60405180910390207fdbc4c1d1d2f0d84e58d36ca767ec9ba2ec2f933c055e50e5ccdd57697f7b58b08260405161061791906115ab565b60405180910390a25050565b6004601281111561063757610636611257565b5b84601281111561064a57610649611257565b5b0361068f577f4a25b279c7c585f25eda9788ac9420ebadae78ca6b206a0e6ab488fd81f55062838383604051610682939291906115cd565b60405180910390a1610735565b600a60128111156106a3576106a2611257565b5b8460128111156106b6576106b5611257565b5b036106f95780827ff16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec856040516106ec919061142b565b60405180910390a3610734565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072b906112f8565b60405180910390fd5b5b50505050565b6002601281111561074f5761074e611257565b5b82601281111561076257610761611257565b5b036107a3577f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051610796919061142b565b60405180910390a161087b565b600760128111156107b7576107b6611257565b5b8260128111156107ca576107c9611257565b5b0361080157807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a261087a565b6006601281111561081557610814611257565b5b82601281111561082857610827611257565b5b0361083e578060405160405180910390a1610879565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610870906112f8565b60405180910390fd5b5b5b5050565b8160405161088d9190611640565b60405180910390207fe77cf33df73da7bc2e253a2dae617e6f15e4e337eaa462a108903af4643d1b75826040516108c49190611235565b60405180910390a25050565b8173ffffffffffffffffffffffffffffffffffffffff167ff922c215689548d72c3d2fe4ea8dafb2a30c43312c9b43fe5d10f713181f991c826040516109169190611666565b60405180910390a25050565b7f532fd6ea96cfb78bb46e09279a26828b8b493de1a2b8b1ee1face527978a15a58160405161095191906116d6565b60405180910390a150565b7f06029e18f16caae06a69281f35b00ed3fcf47950e6c99dafa1bdd8c4b93479a0828260405161098d9291906116f8565b60405180910390a15050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610a00826109b7565b810181811067ffffffffffffffff82111715610a1f57610a1e6109c8565b5b80604052505050565b6000610a32610999565b9050610a3e82826109f7565b919050565b600067ffffffffffffffff821115610a5e57610a5d6109c8565b5b610a67826109b7565b9050602081019050919050565b82818337600083830152505050565b6000610a96610a9184610a43565b610a28565b905082815260208101848484011115610ab257610ab16109b2565b5b610abd848285610a74565b509392505050565b600082601f830112610ada57610ad96109ad565b5b8135610aea848260208601610a83565b91505092915050565b600060208284031215610b0957610b086109a3565b5b600082013567ffffffffffffffff811115610b2757610b266109a8565b5b610b3384828501610ac5565b91505092915050565b60138110610b4957600080fd5b50565b600081359050610b5b81610b3c565b92915050565b600060208284031215610b7757610b766109a3565b5b6000610b8584828501610b4c565b91505092915050565b6000819050919050565b610ba181610b8e565b8114610bac57600080fd5b50565b600081359050610bbe81610b98565b92915050565b600080600080600060a08688031215610be057610bdf6109a3565b5b6000610bee88828901610b4c565b9550506020610bff88828901610baf565b9450506040610c1088828901610baf565b9350506060610c2188828901610baf565b9250506080610c3288828901610baf565b9150509295509295909350565b600080fd5b600060208284031215610c5a57610c59610c3f565b5b610c646020610a28565b90506000610c7484828501610baf565b60008301525092915050565b600060608284031215610c9657610c95610c3f565b5b610ca06060610a28565b90506000610cb084828501610baf565b6000830152506020610cc484828501610baf565b6020830152506040610cd884828501610c44565b60408301525092915050565b60008060808385031215610cfb57610cfa6109a3565b5b6000610d0985828601610baf565b9250506020610d1a85828601610c80565b9150509250929050565b600080600060608486031215610d3d57610d3c6109a3565b5b6000610d4b86828701610b4c565b9350506020610d5c86828701610baf565b9250506040610d6d86828701610baf565b9150509250925092565b600067ffffffffffffffff821115610d9257610d916109c8565b5b602082029050602081019050919050565b600080fd5b60007fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610ddd81610da8565b8114610de857600080fd5b50565b600081359050610dfa81610dd4565b92915050565b6000610e13610e0e84610d77565b610a28565b90508083825260208201905060208402830185811115610e3657610e35610da3565b5b835b81811015610e5f5780610e4b8882610deb565b845260208401935050602081019050610e38565b5050509392505050565b600082601f830112610e7e57610e7d6109ad565b5b8135610e8e848260208601610e00565b91505092915050565b60008060408385031215610eae57610ead6109a3565b5b600083013567ffffffffffffffff811115610ecc57610ecb6109a8565b5b610ed885828601610e69565b925050602083013567ffffffffffffffff811115610ef957610ef86109a8565b5b610f0585828601610e69565b9150509250929050565b60008060008060808587031215610f2957610f286109a3565b5b6000610f3787828801610b4c565b9450506020610f4887828801610baf565b9350506040610f5987828801610baf565b9250506060610f6a87828801610baf565b91505092959194509250565b60008060408385031215610f8d57610f8c6109a3565b5b6000610f9b85828601610b4c565b9250506020610fac85828601610baf565b9150509250929050565b60008060408385031215610fcd57610fcc6109a3565b5b600083013567ffffffffffffffff811115610feb57610fea6109a8565b5b610ff785828601610ac5565b925050602083013567ffffffffffffffff811115611018576110176109a8565b5b61102485828601610ac5565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006110598261102e565b9050919050565b6110698161104e565b811461107457600080fd5b50565b60008135905061108681611060565b92915050565b600080604083850312156110a3576110a26109a3565b5b60006110b185828601611077565b92505060206110c285828601611077565b9150509250929050565b600067ffffffffffffffff8211156110e7576110e66109c8565b5b6110f0826109b7565b9050602081019050919050565b600061111061110b846110cc565b610a28565b90508281526020810184848401111561112c5761112b6109b2565b5b611137848285610a74565b509392505050565b600082601f830112611154576111536109ad565b5b81356111648482602086016110fd565b91505092915050565b600060208284031215611183576111826109a3565b5b600082013567ffffffffffffffff8111156111a1576111a06109a8565b5b6111ad8482850161113f565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156111f05780820151818401526020810190506111d5565b60008484015250505050565b6000611207826111b6565b61121181856111c1565b93506112218185602086016111d2565b61122a816109b7565b840191505092915050565b6000602082019050818103600083015261124f81846111fc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4469646e2774206d6174636820616e7920616c6c6f7761626c65206576656e7460008201527f20696e6465780000000000000000000000000000000000000000000000000000602082015250565b60006112e26026836111c1565b91506112ed82611286565b604082019050919050565b60006020820190508181036000830152611311816112d5565b9050919050565b61132181610b8e565b82525050565b600060808201905061133c6000830187611318565b6113496020830186611318565b6113566040830185611318565b6113636060830184611318565b95945050505050565b60006040820190506113816000830185611318565b61138e6020830184611318565b9392505050565b61139e81610b8e565b82525050565b6020820160008201516113ba6000850182611395565b50505050565b6060820160008201516113d66000850182611395565b5060208201516113e96020850182611395565b5060408201516113fc60408501826113a4565b50505050565b60006080820190506114176000830185611318565b61142460208301846113c0565b9392505050565b60006020820190506114406000830184611318565b92915050565b600081519050919050565b600081905092915050565b6000819050602082019050919050565b61147581610da8565b82525050565b6000611487838361146c565b60208301905092915050565b6000602082019050919050565b60006114ab82611446565b6114b58185611451565b93506114c08361145c565b8060005b838110156114f15781516114d8888261147b565b97506114e383611493565b9250506001810190506114c4565b5085935050505092915050565b600061150a82846114a0565b915081905092915050565b600082825260208201905092915050565b61152f81610da8565b82525050565b60006115418383611526565b60208301905092915050565b600061155882611446565b6115628185611515565b935061156d8361145c565b8060005b8381101561159e5781516115858882611535565b975061159083611493565b925050600181019050611571565b5085935050505092915050565b600060208201905081810360008301526115c5818461154d565b905092915050565b60006060820190506115e26000830186611318565b6115ef6020830185611318565b6115fc6040830184611318565b949350505050565b600081905092915050565b600061161a826111b6565b6116248185611604565b93506116348185602086016111d2565b80840191505092915050565b600061164c828461160f565b915081905092915050565b6116608161104e565b82525050565b600060208201905061167b6000830184611657565b92915050565b600081519050919050565b600082825260208201905092915050565b60006116a882611681565b6116b2818561168c565b93506116c28185602086016111d2565b6116cb816109b7565b840191505092915050565b600060208201905081810360008301526116f0818461169d565b905092915050565b600060408201905061170d6000830185611657565b61171a6020830184611657565b939250505056fea2646970667358221220c7fe1cb35e1edd22692be334329b7e6d9569a4321e3ad8a71942932ca8cf0fde64736f6c63430008110033" # noqa: E501 EMITTER_CONTRACT_ABI = [ { "anonymous": False, @@ -270,13 +276,13 @@ "components": [ {"internalType": "uint256", "name": "c", "type": "uint256"} ], - "internalType": "struct Emitter.NestedTestTuple", + "internalType": "struct EmitterContract.NestedTestTuple", "name": "nested", "type": "tuple", }, ], "indexed": False, - "internalType": "struct Emitter.TestTuple", + "internalType": "struct EmitterContract.TestTuple", "name": "arg1", "type": "tuple", }, @@ -364,7 +370,7 @@ { "inputs": [ { - "internalType": "enum Emitter.WhichEvent", + "internalType": "enum EmitterContract.WhichEvent", "name": "which", "type": "uint8", }, @@ -399,7 +405,7 @@ { "inputs": [ { - "internalType": "enum Emitter.WhichEvent", + "internalType": "enum EmitterContract.WhichEvent", "name": "which", "type": "uint8", } @@ -412,7 +418,7 @@ { "inputs": [ { - "internalType": "enum Emitter.WhichEvent", + "internalType": "enum EmitterContract.WhichEvent", "name": "which", "type": "uint8", }, @@ -429,7 +435,7 @@ { "inputs": [ { - "internalType": "enum Emitter.WhichEvent", + "internalType": "enum EmitterContract.WhichEvent", "name": "which", "type": "uint8", }, @@ -458,12 +464,12 @@ "components": [ {"internalType": "uint256", "name": "c", "type": "uint256"} ], - "internalType": "struct Emitter.NestedTestTuple", + "internalType": "struct EmitterContract.NestedTestTuple", "name": "nested", "type": "tuple", }, ], - "internalType": "struct Emitter.TestTuple", + "internalType": "struct EmitterContract.TestTuple", "name": "arg1", "type": "tuple", }, @@ -476,7 +482,7 @@ { "inputs": [ { - "internalType": "enum Emitter.WhichEvent", + "internalType": "enum EmitterContract.WhichEvent", "name": "which", "type": "uint8", }, @@ -490,20 +496,8 @@ "type": "function", }, ] - - -EMITTER_ENUM = { - "LogAnonymous": 0, - "LogNoArguments": 1, - "LogSingleArg": 2, - "LogDoubleArg": 3, - "LogTripleArg": 4, - "LogQuadrupleArg": 5, - "LogSingleAnonymous": 6, - "LogSingleWithIndex": 7, - "LogDoubleAnonymous": 8, - "LogDoubleWithIndex": 9, - "LogTripleWithIndex": 10, - "LogQuadrupleWithIndex": 11, - "LogStructArg": 12, +EMITTER_CONTRACT_DATA = { + "bytecode": EMITTER_CONTRACT_BYTECODE, + "bytecode_runtime": EMITTER_CONTRACT_RUNTIME, + "abi": EMITTER_CONTRACT_ABI, } diff --git a/web3/_utils/contract_sources/contract_data/event_contracts.py b/web3/_utils/contract_sources/contract_data/event_contracts.py new file mode 100644 index 0000000000..2a6ce1efe9 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/event_contracts.py @@ -0,0 +1,93 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/EventContracts.sol:EventContract +EVENT_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50610185806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80635818fad714610030575b600080fd5b61004a600480360381019061004591906100f8565b61004c565b005b7ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb158160405161007b9190610134565b60405180910390a17f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100b29190610134565b60405180910390a150565b600080fd5b6000819050919050565b6100d5816100c2565b81146100e057600080fd5b50565b6000813590506100f2816100cc565b92915050565b60006020828403121561010e5761010d6100bd565b5b600061011c848285016100e3565b91505092915050565b61012e816100c2565b82525050565b60006020820190506101496000830184610125565b9291505056fea2646970667358221220285ccfbee395caf55e50744594b87d1c7fa4057a4a32e3da56ee5e0f1e1a13e164736f6c63430008110033" # noqa: E501 +EVENT_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80635818fad714610030575b600080fd5b61004a600480360381019061004591906100f8565b61004c565b005b7ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb158160405161007b9190610134565b60405180910390a17f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100b29190610134565b60405180910390a150565b600080fd5b6000819050919050565b6100d5816100c2565b81146100e057600080fd5b50565b6000813590506100f2816100cc565b92915050565b60006020828403121561010e5761010d6100bd565b5b600061011c848285016100e3565b91505092915050565b61012e816100c2565b82525050565b60006020820190506101496000830184610125565b9291505056fea2646970667358221220285ccfbee395caf55e50744594b87d1c7fa4057a4a32e3da56ee5e0f1e1a13e164736f6c63430008110033" # noqa: E501 +EVENT_CONTRACT_ABI = [ + { + "anonymous": False, + "inputs": [ + { + "indexed": False, + "internalType": "uint256", + "name": "arg0", + "type": "uint256", + } + ], + "name": "LogSingleArg", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": False, + "internalType": "uint256", + "name": "arg0", + "type": "uint256", + } + ], + "name": "LogSingleWithIndex", + "type": "event", + }, + { + "inputs": [{"internalType": "uint256", "name": "_arg0", "type": "uint256"}], + "name": "logTwoEvents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, +] +EVENT_CONTRACT_DATA = { + "bytecode": EVENT_CONTRACT_BYTECODE, + "bytecode_runtime": EVENT_CONTRACT_RUNTIME, + "abi": EVENT_CONTRACT_ABI, +} + + +# source: web3/_utils/contract_sources/EventContracts.sol:IndexedEventContract +INDEXED_EVENT_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b5061017b806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80635818fad714610030575b600080fd5b61004a600480360381019061004591906100ee565b61004c565b005b807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a27f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100a8919061012a565b60405180910390a150565b600080fd5b6000819050919050565b6100cb816100b8565b81146100d657600080fd5b50565b6000813590506100e8816100c2565b92915050565b600060208284031215610104576101036100b3565b5b6000610112848285016100d9565b91505092915050565b610124816100b8565b82525050565b600060208201905061013f600083018461011b565b9291505056fea2646970667358221220310b5be141da1807e098de48bd777aa0b15a88c8b4fb8c54c2275366856f16d264736f6c63430008110033" # noqa: E501 +INDEXED_EVENT_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80635818fad714610030575b600080fd5b61004a600480360381019061004591906100ee565b61004c565b005b807ff70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a27f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d4816040516100a8919061012a565b60405180910390a150565b600080fd5b6000819050919050565b6100cb816100b8565b81146100d657600080fd5b50565b6000813590506100e8816100c2565b92915050565b600060208284031215610104576101036100b3565b5b6000610112848285016100d9565b91505092915050565b610124816100b8565b82525050565b600060208201905061013f600083018461011b565b9291505056fea2646970667358221220310b5be141da1807e098de48bd777aa0b15a88c8b4fb8c54c2275366856f16d264736f6c63430008110033" # noqa: E501 +INDEXED_EVENT_CONTRACT_ABI = [ + { + "anonymous": False, + "inputs": [ + { + "indexed": False, + "internalType": "uint256", + "name": "arg0", + "type": "uint256", + } + ], + "name": "LogSingleArg", + "type": "event", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": True, + "internalType": "uint256", + "name": "arg0", + "type": "uint256", + } + ], + "name": "LogSingleWithIndex", + "type": "event", + }, + { + "inputs": [{"internalType": "uint256", "name": "_arg0", "type": "uint256"}], + "name": "logTwoEvents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, +] +INDEXED_EVENT_CONTRACT_DATA = { + "bytecode": INDEXED_EVENT_CONTRACT_BYTECODE, + "bytecode_runtime": INDEXED_EVENT_CONTRACT_RUNTIME, + "abi": INDEXED_EVENT_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/extended_resolver.py b/web3/_utils/contract_sources/contract_data/extended_resolver.py new file mode 100644 index 0000000000..dd83d04b1f --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/extended_resolver.py @@ -0,0 +1,90 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/ExtendedResolver.sol:ExtendedResolver +EXTENDED_RESOLVER_BYTECODE = "0x608060405234801561001057600080fd5b50604051610d90380380610d90833981810160405281019061003291906100ed565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505061011a565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b60006100ba8261009d565b9050919050565b6100ca816100af565b81146100d557600080fd5b50565b6000815190506100e7816100c1565b92915050565b60006020828403121561010357610102610078565b5b6000610111848285016100d8565b91505092915050565b610c67806101296000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806301ffc9a7146100515780633e9ce794146100815780639061b9231461009d578063f86bc879146100cd575b600080fd5b61006b60048036038101906100669190610554565b6100fd565b604051610078919061059c565b60405180910390f35b61009b60048036038101906100969190610677565b61015e565b005b6100b760048036038101906100b2919061072f565b610245565b6040516100c49190610840565b60405180910390f35b6100e760048036038101906100e29190610862565b610465565b6040516100f4919061059c565b60405180910390f35b6000639061b92360e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806101575750610156826104a1565b5b9050919050565b806001600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df8333848460405161023894939291906108d3565b60405180910390a1505050565b60606040518060400160405280601781526020017f11657874656e6465642d7265736f6c7665720365746800000000000000000000815250805190602001208585604051610294929190610957565b60405180910390201480156102ad575060248383905010155b1561035e577ff0a378cc2afe91730d0105e67d6bb037cc5b8b6bfec5b5962d9b637ff6497e5560001b83836004906024926102ea9392919061097a565b906102f591906109cd565b14610335576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032c90610aaf565b60405180910390fd5b61beef6040516020016103489190610acf565b604051602081830303815290604052905061045d565b60008585600081811061037457610373610aea565b5b9050013560f81c60f81b60f81c60ff1690506040518060400160405280601781526020017f11657874656e6465642d7265736f6c76657203657468000000000000000000008152508051906020012086868360016103d29190610b52565b9080926103e19392919061097a565b6040516103ef929190610b86565b604051809103902014610437576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042e90610c11565b60405180910390fd5b61dead60405160200161044a9190610acf565b6040516020818303038152906040529150505b949350505050565b6001602052826000526040600020602052816000526040600020602052806000526040600020600092509250509054906101000a900460ff1681565b60006301ffc9a760e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610531816104fc565b811461053c57600080fd5b50565b60008135905061054e81610528565b92915050565b60006020828403121561056a576105696104f2565b5b60006105788482850161053f565b91505092915050565b60008115159050919050565b61059681610581565b82525050565b60006020820190506105b1600083018461058d565b92915050565b6000819050919050565b6105ca816105b7565b81146105d557600080fd5b50565b6000813590506105e7816105c1565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610618826105ed565b9050919050565b6106288161060d565b811461063357600080fd5b50565b6000813590506106458161061f565b92915050565b61065481610581565b811461065f57600080fd5b50565b6000813590506106718161064b565b92915050565b6000806000606084860312156106905761068f6104f2565b5b600061069e868287016105d8565b93505060206106af86828701610636565b92505060406106c086828701610662565b9150509250925092565b600080fd5b600080fd5b600080fd5b60008083601f8401126106ef576106ee6106ca565b5b8235905067ffffffffffffffff81111561070c5761070b6106cf565b5b602083019150836001820283011115610728576107276106d4565b5b9250929050565b60008060008060408587031215610749576107486104f2565b5b600085013567ffffffffffffffff811115610767576107666104f7565b5b610773878288016106d9565b9450945050602085013567ffffffffffffffff811115610796576107956104f7565b5b6107a2878288016106d9565b925092505092959194509250565b600081519050919050565b600082825260208201905092915050565b60005b838110156107ea5780820151818401526020810190506107cf565b60008484015250505050565b6000601f19601f8301169050919050565b6000610812826107b0565b61081c81856107bb565b935061082c8185602086016107cc565b610835816107f6565b840191505092915050565b6000602082019050818103600083015261085a8184610807565b905092915050565b60008060006060848603121561087b5761087a6104f2565b5b6000610889868287016105d8565b935050602061089a86828701610636565b92505060406108ab86828701610636565b9150509250925092565b6108be816105b7565b82525050565b6108cd8161060d565b82525050565b60006080820190506108e860008301876108b5565b6108f560208301866108c4565b61090260408301856108c4565b61090f606083018461058d565b95945050505050565b600081905092915050565b82818337600083830152505050565b600061093e8385610918565b935061094b838584610923565b82840190509392505050565b6000610964828486610932565b91508190509392505050565b600080fd5b600080fd5b6000808585111561098e5761098d610970565b5b8386111561099f5761099e610975565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006109d983836109b5565b826109e481356105b7565b92506020821015610a2457610a1f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026109c0565b831692505b505092915050565b600082825260208201905092915050565b7f706172656e7420646f6d61696e206e6f742076616c696461746564206170707260008201527f6f7072696174656c790000000000000000000000000000000000000000000000602082015250565b6000610a99602983610a2c565b9150610aa482610a3d565b604082019050919050565b60006020820190508181036000830152610ac881610a8c565b9050919050565b6000602082019050610ae460008301846108c4565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610b5d82610b19565b9150610b6883610b19565b9250828201905080821115610b8057610b7f610b23565b5b92915050565b6000610b93828486610932565b91508190509392505050565b7f737562646f6d61696e206e6f742076616c69646174656420617070726f70726960008201527f6174656c79000000000000000000000000000000000000000000000000000000602082015250565b6000610bfb602583610a2c565b9150610c0682610b9f565b604082019050919050565b60006020820190508181036000830152610c2a81610bee565b905091905056fea26469706673582212208f62d2c403baa9ee8d72c46149cb2780f23481615f9d3d5631826b50eb38588d64736f6c63430008110033" # noqa: E501 +EXTENDED_RESOLVER_RUNTIME = "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301ffc9a7146100515780633e9ce794146100815780639061b9231461009d578063f86bc879146100cd575b600080fd5b61006b60048036038101906100669190610554565b6100fd565b604051610078919061059c565b60405180910390f35b61009b60048036038101906100969190610677565b61015e565b005b6100b760048036038101906100b2919061072f565b610245565b6040516100c49190610840565b60405180910390f35b6100e760048036038101906100e29190610862565b610465565b6040516100f4919061059c565b60405180910390f35b6000639061b92360e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806101575750610156826104a1565b5b9050919050565b806001600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df8333848460405161023894939291906108d3565b60405180910390a1505050565b60606040518060400160405280601781526020017f11657874656e6465642d7265736f6c7665720365746800000000000000000000815250805190602001208585604051610294929190610957565b60405180910390201480156102ad575060248383905010155b1561035e577ff0a378cc2afe91730d0105e67d6bb037cc5b8b6bfec5b5962d9b637ff6497e5560001b83836004906024926102ea9392919061097a565b906102f591906109cd565b14610335576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032c90610aaf565b60405180910390fd5b61beef6040516020016103489190610acf565b604051602081830303815290604052905061045d565b60008585600081811061037457610373610aea565b5b9050013560f81c60f81b60f81c60ff1690506040518060400160405280601781526020017f11657874656e6465642d7265736f6c76657203657468000000000000000000008152508051906020012086868360016103d29190610b52565b9080926103e19392919061097a565b6040516103ef929190610b86565b604051809103902014610437576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042e90610c11565b60405180910390fd5b61dead60405160200161044a9190610acf565b6040516020818303038152906040529150505b949350505050565b6001602052826000526040600020602052816000526040600020602052806000526040600020600092509250509054906101000a900460ff1681565b60006301ffc9a760e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610531816104fc565b811461053c57600080fd5b50565b60008135905061054e81610528565b92915050565b60006020828403121561056a576105696104f2565b5b60006105788482850161053f565b91505092915050565b60008115159050919050565b61059681610581565b82525050565b60006020820190506105b1600083018461058d565b92915050565b6000819050919050565b6105ca816105b7565b81146105d557600080fd5b50565b6000813590506105e7816105c1565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610618826105ed565b9050919050565b6106288161060d565b811461063357600080fd5b50565b6000813590506106458161061f565b92915050565b61065481610581565b811461065f57600080fd5b50565b6000813590506106718161064b565b92915050565b6000806000606084860312156106905761068f6104f2565b5b600061069e868287016105d8565b93505060206106af86828701610636565b92505060406106c086828701610662565b9150509250925092565b600080fd5b600080fd5b600080fd5b60008083601f8401126106ef576106ee6106ca565b5b8235905067ffffffffffffffff81111561070c5761070b6106cf565b5b602083019150836001820283011115610728576107276106d4565b5b9250929050565b60008060008060408587031215610749576107486104f2565b5b600085013567ffffffffffffffff811115610767576107666104f7565b5b610773878288016106d9565b9450945050602085013567ffffffffffffffff811115610796576107956104f7565b5b6107a2878288016106d9565b925092505092959194509250565b600081519050919050565b600082825260208201905092915050565b60005b838110156107ea5780820151818401526020810190506107cf565b60008484015250505050565b6000601f19601f8301169050919050565b6000610812826107b0565b61081c81856107bb565b935061082c8185602086016107cc565b610835816107f6565b840191505092915050565b6000602082019050818103600083015261085a8184610807565b905092915050565b60008060006060848603121561087b5761087a6104f2565b5b6000610889868287016105d8565b935050602061089a86828701610636565b92505060406108ab86828701610636565b9150509250925092565b6108be816105b7565b82525050565b6108cd8161060d565b82525050565b60006080820190506108e860008301876108b5565b6108f560208301866108c4565b61090260408301856108c4565b61090f606083018461058d565b95945050505050565b600081905092915050565b82818337600083830152505050565b600061093e8385610918565b935061094b838584610923565b82840190509392505050565b6000610964828486610932565b91508190509392505050565b600080fd5b600080fd5b6000808585111561098e5761098d610970565b5b8386111561099f5761099e610975565b5b6001850283019150848603905094509492505050565b600082905092915050565b600082821b905092915050565b60006109d983836109b5565b826109e481356105b7565b92506020821015610a2457610a1f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026109c0565b831692505b505092915050565b600082825260208201905092915050565b7f706172656e7420646f6d61696e206e6f742076616c696461746564206170707260008201527f6f7072696174656c790000000000000000000000000000000000000000000000602082015250565b6000610a99602983610a2c565b9150610aa482610a3d565b604082019050919050565b60006020820190508181036000830152610ac881610a8c565b9050919050565b6000602082019050610ae460008301846108c4565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610b5d82610b19565b9150610b6883610b19565b9250828201905080821115610b8057610b7f610b23565b5b92915050565b6000610b93828486610932565b91508190509392505050565b7f737562646f6d61696e206e6f742076616c69646174656420617070726f70726960008201527f6174656c79000000000000000000000000000000000000000000000000000000602082015250565b6000610bfb602583610a2c565b9150610c0682610b9f565b604082019050919050565b60006020820190508181036000830152610c2a81610bee565b905091905056fea26469706673582212208f62d2c403baa9ee8d72c46149cb2780f23481615f9d3d5631826b50eb38588d64736f6c63430008110033" # noqa: E501 +EXTENDED_RESOLVER_ABI = [ + { + "inputs": [{"internalType": "contract ENS", "name": "_ens", "type": "address"}], + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": False, + "internalType": "bytes32", + "name": "node", + "type": "bytes32", + }, + { + "indexed": False, + "internalType": "address", + "name": "owner", + "type": "address", + }, + { + "indexed": False, + "internalType": "address", + "name": "target", + "type": "address", + }, + { + "indexed": False, + "internalType": "bool", + "name": "isAuthorised", + "type": "bool", + }, + ], + "name": "AuthorisationChanged", + "type": "event", + }, + { + "inputs": [ + {"internalType": "bytes32", "name": "", "type": "bytes32"}, + {"internalType": "address", "name": "", "type": "address"}, + {"internalType": "address", "name": "", "type": "address"}, + ], + "name": "authorisations", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes", "name": "dnsName", "type": "bytes"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, + ], + "name": "resolve", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes32", "name": "node", "type": "bytes32"}, + {"internalType": "address", "name": "target", "type": "address"}, + {"internalType": "bool", "name": "isAuthorised", "type": "bool"}, + ], + "name": "setAuthorisation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [{"internalType": "bytes4", "name": "interfaceID", "type": "bytes4"}], + "name": "supportsInterface", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "pure", + "type": "function", + }, +] +EXTENDED_RESOLVER_DATA = { + "bytecode": EXTENDED_RESOLVER_BYTECODE, + "bytecode_runtime": EXTENDED_RESOLVER_RUNTIME, + "abi": EXTENDED_RESOLVER_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/fallback_function_contract.py b/web3/_utils/contract_sources/contract_data/fallback_function_contract.py new file mode 100644 index 0000000000..ea5e7e8652 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/fallback_function_contract.py @@ -0,0 +1,24 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/FallbackFunctionContract.sol:FallbackFunctionContract # noqa: E501 +FALLBACK_FUNCTION_CONTRACT_BYTECODE = "0x60806040526000808190555060be806100196000396000f3fe6080604052348015600f57600080fd5b5060043610602b5760003560e01c80633bc5de3014603557602c565b5b60016000819055005b603b604f565b60405160469190606f565b60405180910390f35b60008054905090565b6000819050919050565b6069816058565b82525050565b6000602082019050608260008301846062565b9291505056fea2646970667358221220e68e49e1327532e8eeed55e60110d01e6d3f2ea93607400e02eb7d30766f3c3e64736f6c63430008110033" # noqa: E501 +FALLBACK_FUNCTION_CONTRACT_RUNTIME = "0x6080604052348015600f57600080fd5b5060043610602b5760003560e01c80633bc5de3014603557602c565b5b60016000819055005b603b604f565b60405160469190606f565b60405180910390f35b60008054905090565b6000819050919050565b6069816058565b82525050565b6000602082019050608260008301846062565b9291505056fea2646970667358221220e68e49e1327532e8eeed55e60110d01e6d3f2ea93607400e02eb7d30766f3c3e64736f6c63430008110033" # noqa: E501 +FALLBACK_FUNCTION_CONTRACT_ABI = [ + {"inputs": [], "stateMutability": "payable", "type": "constructor"}, + {"stateMutability": "nonpayable", "type": "fallback"}, + { + "inputs": [], + "name": "getData", + "outputs": [{"internalType": "uint256", "name": "r", "type": "uint256"}], + "stateMutability": "view", + "type": "function", + }, +] +FALLBACK_FUNCTION_CONTRACT_DATA = { + "bytecode": FALLBACK_FUNCTION_CONTRACT_BYTECODE, + "bytecode_runtime": FALLBACK_FUNCTION_CONTRACT_RUNTIME, + "abi": FALLBACK_FUNCTION_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/math_contract.py b/web3/_utils/contract_sources/contract_data/math_contract.py new file mode 100644 index 0000000000..4aba391cfe --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/math_contract.py @@ -0,0 +1,73 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/MathContract.sol:MathContract +MATH_CONTRACT_BYTECODE = "0x60806040526000805534801561001457600080fd5b5061055b806100246000396000f3fe6080604052600436106100555760003560e01c806316216f391461005a5780635b34b9661461008557806361bc221a146100a35780636abbb3b4146100ce578063a5f3c23b146100fe578063dcf537b11461012e575b600080fd5b34801561006657600080fd5b5061006f61015e565b60405161007c9190610260565b60405180910390f35b61008d610167565b60405161009a9190610294565b60405180910390f35b3480156100af57600080fd5b506100b86101be565b6040516100c59190610294565b60405180910390f35b6100e860048036038101906100e391906102e0565b6101c4565b6040516100f59190610294565b60405180910390f35b61011860048036038101906101139190610339565b61021b565b6040516101259190610260565b60405180910390f35b61014860048036038101906101439190610379565b610231565b6040516101559190610260565b60405180910390f35b6000600d905090565b6000600160005461017891906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c560016040516101ae919061044e565b60405180910390a1600054905090565b60005481565b6000816000546101d491906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5826040516102099190610294565b60405180910390a16000549050919050565b600081836102299190610469565b905092915050565b600060078261024091906104ad565b9050919050565b6000819050919050565b61025a81610247565b82525050565b60006020820190506102756000830184610251565b92915050565b6000819050919050565b61028e8161027b565b82525050565b60006020820190506102a96000830184610285565b92915050565b600080fd5b6102bd8161027b565b81146102c857600080fd5b50565b6000813590506102da816102b4565b92915050565b6000602082840312156102f6576102f56102af565b5b6000610304848285016102cb565b91505092915050565b61031681610247565b811461032157600080fd5b50565b6000813590506103338161030d565b92915050565b600080604083850312156103505761034f6102af565b5b600061035e85828601610324565b925050602061036f85828601610324565b9150509250929050565b60006020828403121561038f5761038e6102af565b5b600061039d84828501610324565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e08261027b565b91506103eb8361027b565b9250828201905080821115610403576104026103a6565b5b92915050565b6000819050919050565b6000819050919050565b600061043861043361042e84610409565b610413565b61027b565b9050919050565b6104488161041d565b82525050565b6000602082019050610463600083018461043f565b92915050565b600061047482610247565b915061047f83610247565b9250828201905082811215600083121683821260008412151617156104a7576104a66103a6565b5b92915050565b60006104b882610247565b91506104c383610247565b92508282026104d181610247565b91507f80000000000000000000000000000000000000000000000000000000000000008414600084121615610509576105086103a6565b5b828205841483151761051e5761051d6103a6565b5b509291505056fea2646970667358221220607cd99eabba12e9d39e526a2c5ee82f4af77472608174275cd751b1d4bc047164736f6c63430008110033" # noqa: E501 +MATH_CONTRACT_RUNTIME = "0x6080604052600436106100555760003560e01c806316216f391461005a5780635b34b9661461008557806361bc221a146100a35780636abbb3b4146100ce578063a5f3c23b146100fe578063dcf537b11461012e575b600080fd5b34801561006657600080fd5b5061006f61015e565b60405161007c9190610260565b60405180910390f35b61008d610167565b60405161009a9190610294565b60405180910390f35b3480156100af57600080fd5b506100b86101be565b6040516100c59190610294565b60405180910390f35b6100e860048036038101906100e391906102e0565b6101c4565b6040516100f59190610294565b60405180910390f35b61011860048036038101906101139190610339565b61021b565b6040516101259190610260565b60405180910390f35b61014860048036038101906101439190610379565b610231565b6040516101559190610260565b60405180910390f35b6000600d905090565b6000600160005461017891906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c560016040516101ae919061044e565b60405180910390a1600054905090565b60005481565b6000816000546101d491906103d5565b6000819055507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5826040516102099190610294565b60405180910390a16000549050919050565b600081836102299190610469565b905092915050565b600060078261024091906104ad565b9050919050565b6000819050919050565b61025a81610247565b82525050565b60006020820190506102756000830184610251565b92915050565b6000819050919050565b61028e8161027b565b82525050565b60006020820190506102a96000830184610285565b92915050565b600080fd5b6102bd8161027b565b81146102c857600080fd5b50565b6000813590506102da816102b4565b92915050565b6000602082840312156102f6576102f56102af565b5b6000610304848285016102cb565b91505092915050565b61031681610247565b811461032157600080fd5b50565b6000813590506103338161030d565b92915050565b600080604083850312156103505761034f6102af565b5b600061035e85828601610324565b925050602061036f85828601610324565b9150509250929050565b60006020828403121561038f5761038e6102af565b5b600061039d84828501610324565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103e08261027b565b91506103eb8361027b565b9250828201905080821115610403576104026103a6565b5b92915050565b6000819050919050565b6000819050919050565b600061043861043361042e84610409565b610413565b61027b565b9050919050565b6104488161041d565b82525050565b6000602082019050610463600083018461043f565b92915050565b600061047482610247565b915061047f83610247565b9250828201905082811215600083121683821260008412151617156104a7576104a66103a6565b5b92915050565b60006104b882610247565b91506104c383610247565b92508282026104d181610247565b91507f80000000000000000000000000000000000000000000000000000000000000008414600084121615610509576105086103a6565b5b828205841483151761051e5761051d6103a6565b5b509291505056fea2646970667358221220607cd99eabba12e9d39e526a2c5ee82f4af77472608174275cd751b1d4bc047164736f6c63430008110033" # noqa: E501 +MATH_CONTRACT_ABI = [ + { + "anonymous": False, + "inputs": [ + { + "indexed": False, + "internalType": "uint256", + "name": "value", + "type": "uint256", + } + ], + "name": "Increased", + "type": "event", + }, + { + "inputs": [ + {"internalType": "int256", "name": "a", "type": "int256"}, + {"internalType": "int256", "name": "b", "type": "int256"}, + ], + "name": "add", + "outputs": [{"internalType": "int256", "name": "result", "type": "int256"}], + "stateMutability": "payable", + "type": "function", + }, + { + "inputs": [], + "name": "counter", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [], + "name": "incrementCounter", + "outputs": [{"internalType": "uint256", "name": "result", "type": "uint256"}], + "stateMutability": "payable", + "type": "function", + }, + { + "inputs": [{"internalType": "uint256", "name": "amount", "type": "uint256"}], + "name": "incrementCounter", + "outputs": [{"internalType": "uint256", "name": "result", "type": "uint256"}], + "stateMutability": "payable", + "type": "function", + }, + { + "inputs": [{"internalType": "int256", "name": "a", "type": "int256"}], + "name": "multiply7", + "outputs": [{"internalType": "int256", "name": "result", "type": "int256"}], + "stateMutability": "payable", + "type": "function", + }, + { + "inputs": [], + "name": "return13", + "outputs": [{"internalType": "int256", "name": "result", "type": "int256"}], + "stateMutability": "nonpayable", + "type": "function", + }, +] +MATH_CONTRACT_DATA = { + "bytecode": MATH_CONTRACT_BYTECODE, + "bytecode_runtime": MATH_CONTRACT_RUNTIME, + "abi": MATH_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/offchain_lookup.py b/web3/_utils/contract_sources/contract_data/offchain_lookup.py new file mode 100644 index 0000000000..db22da5a01 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/offchain_lookup.py @@ -0,0 +1,52 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/OffchainLookup.sol:OffchainLookup +OFFCHAIN_LOOKUP_BYTECODE = "0x608060405260405180604001604052806040518060600160405280602c815260200162001129602c91398152602001604051806060016040528060258152602001620011556025913981525060009060026200005d92919062000072565b503480156200006b57600080fd5b50620004c0565b828054828255906000526020600020908101928215620000bf579160200282015b82811115620000be578251829081620000ad9190620003d9565b509160200191906001019062000093565b5b509050620000ce9190620000d2565b5090565b5b80821115620000f65760008181620000ec9190620000fa565b50600101620000d3565b5090565b5080546200010890620001c8565b6000825580601f106200011c57506200013d565b601f0160209004906000526020600020908101906200013c919062000140565b5b50565b5b808211156200015b57600081600090555060010162000141565b5090565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620001e157607f821691505b602082108103620001f757620001f662000199565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620002617fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000222565b6200026d868362000222565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620002ba620002b4620002ae8462000285565b6200028f565b62000285565b9050919050565b6000819050919050565b620002d68362000299565b620002ee620002e582620002c1565b8484546200022f565b825550505050565b600090565b62000305620002f6565b62000312818484620002cb565b505050565b5b818110156200033a576200032e600082620002fb565b60018101905062000318565b5050565b601f82111562000389576200035381620001fd565b6200035e8462000212565b810160208510156200036e578190505b620003866200037d8562000212565b83018262000317565b50505b505050565b600082821c905092915050565b6000620003ae600019846008026200038e565b1980831691505092915050565b6000620003c983836200039b565b9150826002028217905092915050565b620003e4826200015f565b67ffffffffffffffff8111156200040057620003ff6200016a565b5b6200040c8254620001c8565b620004198282856200033e565b600060209050601f8311600181146200045157600084156200043c578287015190505b620004488582620003bb565b865550620004b8565b601f1984166200046186620001fd565b60005b828110156200048b5784890151825560018201915060208501945060208101905062000464565b86831015620004ab5784890151620004a7601f8916826200039b565b8355505b6001600288020188555050505b505050505050565b610c5980620004d06000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806309a3c01b146100465780636337ed5814610064578063da96d05a14610094575b600080fd5b61004e6100c4565b60405161005b919061041b565b60405180910390f35b61007e600480360381019061007991906104b6565b610114565b60405161008b919061041b565b60405180910390f35b6100ae60048036038101906100a99190610503565b610202565b6040516100bb919061041b565b60405180910390f35b606080306000826309a3c01b60e01b846040517f556f183000000000000000000000000000000000000000000000000000000000815260040161010b9594939291906107d0565b60405180910390fd5b6060600083838101906101279190610968565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af0758160405160200161015b91906109f8565b60405160208183030381529060405280519060200120146101b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a890610a6c565b60405180910390fd5b306000858563da96d05a60e01b88886040517f556f18300000000000000000000000000000000000000000000000000000000081526004016101f99796959493929190610ab9565b60405180910390fd5b6060600085858101906102159190610968565b90507faed76f463930323372899e36460e078e5292aac45f645bbe567be6fca83ede108160405160200161024991906109f8565b604051602081830303815290604052805190602001201461029f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029690610b97565b60405180910390fd5b600084848101906102b09190610968565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af075816040516020016102e491906109f8565b604051602081830303815290604052805190602001201461033a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033190610c03565b60405180910390fd5b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092505050949350505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103c55780820151818401526020810190506103aa565b60008484015250505050565b6000601f19601f8301169050919050565b60006103ed8261038b565b6103f78185610396565b93506104078185602086016103a7565b610410816103d1565b840191505092915050565b6000602082019050818103600083015261043581846103e2565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261047657610475610451565b5b8235905067ffffffffffffffff81111561049357610492610456565b5b6020830191508360018202830111156104af576104ae61045b565b5b9250929050565b600080602083850312156104cd576104cc610447565b5b600083013567ffffffffffffffff8111156104eb576104ea61044c565b5b6104f785828601610460565b92509250509250929050565b6000806000806040858703121561051d5761051c610447565b5b600085013567ffffffffffffffff81111561053b5761053a61044c565b5b61054787828801610460565b9450945050602085013567ffffffffffffffff81111561056a5761056961044c565b5b61057687828801610460565b925092505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105af82610584565b9050919050565b6105bf816105a4565b82525050565b600081549050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061063d57607f821691505b6020821081036106505761064f6105f6565b5b50919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b6000815461068981610625565b6106938186610656565b945060018216600081146106ae57600181146106c4576106f7565b60ff1983168652811515602002860193506106f7565b6106cd85610667565b60005b838110156106ef578154818901526001820191506020810190506106d0565b808801955050505b50505092915050565b600061070c838361067c565b905092915050565b6000600182019050919050565b600061072c826105c5565b61073681856105d0565b935083602082028501610748856105e1565b8060005b85811015610783578484038952816107648582610700565b945061076f83610714565b925060208a0199505060018101905061074c565b50829750879550505050505092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6107ca81610795565b82525050565b600060a0820190506107e560008301886105b6565b81810360208301526107f78187610721565b9050818103604083015261080b81866103e2565b905061081a60608301856107c1565b818103608083015261082c81846103e2565b90509695505050505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610875826103d1565b810181811067ffffffffffffffff821117156108945761089361083d565b5b80604052505050565b60006108a761043d565b90506108b3828261086c565b919050565b600067ffffffffffffffff8211156108d3576108d261083d565b5b6108dc826103d1565b9050602081019050919050565b82818337600083830152505050565b600061090b610906846108b8565b61089d565b90508281526020810184848401111561092757610926610838565b5b6109328482856108e9565b509392505050565b600082601f83011261094f5761094e610451565b5b813561095f8482602086016108f8565b91505092915050565b60006020828403121561097e5761097d610447565b5b600082013567ffffffffffffffff81111561099c5761099b61044c565b5b6109a88482850161093a565b91505092915050565b600081519050919050565b600081905092915050565b60006109d2826109b1565b6109dc81856109bc565b93506109ec8185602086016103a7565b80840191505092915050565b6000610a0482846109c7565b915081905092915050565b600082825260208201905092915050565b7f7465737420646174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610a56601c83610a0f565b9150610a6182610a20565b602082019050919050565b60006020820190508181036000830152610a8581610a49565b9050919050565b6000610a988385610396565b9350610aa58385846108e9565b610aae836103d1565b840190509392505050565b600060a082019050610ace600083018a6105b6565b8181036020830152610ae08189610721565b90508181036040830152610af5818789610a8c565b9050610b0460608301866107c1565b8181036080830152610b17818486610a8c565b905098975050505050505050565b7f68747470207265717565737420726573756c742076616c69646174696f6e206660008201527f61696c65642e0000000000000000000000000000000000000000000000000000602082015250565b6000610b81602683610a0f565b9150610b8c82610b25565b604082019050919050565b60006020820190508181036000830152610bb081610b74565b9050919050565b7f6578747261446174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610bed601c83610a0f565b9150610bf882610bb7565b602082019050919050565b60006020820190508181036000830152610c1c81610be0565b905091905056fea2646970667358221220a6ddff0532d8c075835989ee350520340d5f2067000d63649f49fde354c983a064736f6c6343000811003368747470733a2f2f776562332e70792f676174657761792f7b73656e6465727d2f7b646174617d2e6a736f6e68747470733a2f2f776562332e70792f676174657761792f7b73656e6465727d2e6a736f6e" # noqa: E501 +OFFCHAIN_LOOKUP_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806309a3c01b146100465780636337ed5814610064578063da96d05a14610094575b600080fd5b61004e6100c4565b60405161005b919061041b565b60405180910390f35b61007e600480360381019061007991906104b6565b610114565b60405161008b919061041b565b60405180910390f35b6100ae60048036038101906100a99190610503565b610202565b6040516100bb919061041b565b60405180910390f35b606080306000826309a3c01b60e01b846040517f556f183000000000000000000000000000000000000000000000000000000000815260040161010b9594939291906107d0565b60405180910390fd5b6060600083838101906101279190610968565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af0758160405160200161015b91906109f8565b60405160208183030381529060405280519060200120146101b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a890610a6c565b60405180910390fd5b306000858563da96d05a60e01b88886040517f556f18300000000000000000000000000000000000000000000000000000000081526004016101f99796959493929190610ab9565b60405180910390fd5b6060600085858101906102159190610968565b90507faed76f463930323372899e36460e078e5292aac45f645bbe567be6fca83ede108160405160200161024991906109f8565b604051602081830303815290604052805190602001201461029f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029690610b97565b60405180910390fd5b600084848101906102b09190610968565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af075816040516020016102e491906109f8565b604051602081830303815290604052805190602001201461033a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033190610c03565b60405180910390fd5b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092505050949350505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103c55780820151818401526020810190506103aa565b60008484015250505050565b6000601f19601f8301169050919050565b60006103ed8261038b565b6103f78185610396565b93506104078185602086016103a7565b610410816103d1565b840191505092915050565b6000602082019050818103600083015261043581846103e2565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261047657610475610451565b5b8235905067ffffffffffffffff81111561049357610492610456565b5b6020830191508360018202830111156104af576104ae61045b565b5b9250929050565b600080602083850312156104cd576104cc610447565b5b600083013567ffffffffffffffff8111156104eb576104ea61044c565b5b6104f785828601610460565b92509250509250929050565b6000806000806040858703121561051d5761051c610447565b5b600085013567ffffffffffffffff81111561053b5761053a61044c565b5b61054787828801610460565b9450945050602085013567ffffffffffffffff81111561056a5761056961044c565b5b61057687828801610460565b925092505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105af82610584565b9050919050565b6105bf816105a4565b82525050565b600081549050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061063d57607f821691505b6020821081036106505761064f6105f6565b5b50919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b6000815461068981610625565b6106938186610656565b945060018216600081146106ae57600181146106c4576106f7565b60ff1983168652811515602002860193506106f7565b6106cd85610667565b60005b838110156106ef578154818901526001820191506020810190506106d0565b808801955050505b50505092915050565b600061070c838361067c565b905092915050565b6000600182019050919050565b600061072c826105c5565b61073681856105d0565b935083602082028501610748856105e1565b8060005b85811015610783578484038952816107648582610700565b945061076f83610714565b925060208a0199505060018101905061074c565b50829750879550505050505092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6107ca81610795565b82525050565b600060a0820190506107e560008301886105b6565b81810360208301526107f78187610721565b9050818103604083015261080b81866103e2565b905061081a60608301856107c1565b818103608083015261082c81846103e2565b90509695505050505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610875826103d1565b810181811067ffffffffffffffff821117156108945761089361083d565b5b80604052505050565b60006108a761043d565b90506108b3828261086c565b919050565b600067ffffffffffffffff8211156108d3576108d261083d565b5b6108dc826103d1565b9050602081019050919050565b82818337600083830152505050565b600061090b610906846108b8565b61089d565b90508281526020810184848401111561092757610926610838565b5b6109328482856108e9565b509392505050565b600082601f83011261094f5761094e610451565b5b813561095f8482602086016108f8565b91505092915050565b60006020828403121561097e5761097d610447565b5b600082013567ffffffffffffffff81111561099c5761099b61044c565b5b6109a88482850161093a565b91505092915050565b600081519050919050565b600081905092915050565b60006109d2826109b1565b6109dc81856109bc565b93506109ec8185602086016103a7565b80840191505092915050565b6000610a0482846109c7565b915081905092915050565b600082825260208201905092915050565b7f7465737420646174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610a56601c83610a0f565b9150610a6182610a20565b602082019050919050565b60006020820190508181036000830152610a8581610a49565b9050919050565b6000610a988385610396565b9350610aa58385846108e9565b610aae836103d1565b840190509392505050565b600060a082019050610ace600083018a6105b6565b8181036020830152610ae08189610721565b90508181036040830152610af5818789610a8c565b9050610b0460608301866107c1565b8181036080830152610b17818486610a8c565b905098975050505050505050565b7f68747470207265717565737420726573756c742076616c69646174696f6e206660008201527f61696c65642e0000000000000000000000000000000000000000000000000000602082015250565b6000610b81602683610a0f565b9150610b8c82610b25565b604082019050919050565b60006020820190508181036000830152610bb081610b74565b9050919050565b7f6578747261446174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610bed601c83610a0f565b9150610bf882610bb7565b602082019050919050565b60006020820190508181036000830152610c1c81610be0565b905091905056fea2646970667358221220a6ddff0532d8c075835989ee350520340d5f2067000d63649f49fde354c983a064736f6c63430008110033" # noqa: E501 +OFFCHAIN_LOOKUP_ABI = [ + { + "inputs": [ + {"internalType": "address", "name": "sender", "type": "address"}, + {"internalType": "string[]", "name": "urls", "type": "string[]"}, + {"internalType": "bytes", "name": "callData", "type": "bytes"}, + {"internalType": "bytes4", "name": "callbackFunction", "type": "bytes4"}, + {"internalType": "bytes", "name": "extraData", "type": "bytes"}, + ], + "name": "OffchainLookup", + "type": "error", + }, + { + "inputs": [], + "name": "continuousOffchainLookup", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes", "name": "specifiedDataFromTest", "type": "bytes"} + ], + "name": "testOffchainLookup", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes", "name": "result", "type": "bytes"}, + {"internalType": "bytes", "name": "extraData", "type": "bytes"}, + ], + "name": "testOffchainLookupWithProof", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "nonpayable", + "type": "function", + }, +] +OFFCHAIN_LOOKUP_DATA = { + "bytecode": OFFCHAIN_LOOKUP_BYTECODE, + "bytecode_runtime": OFFCHAIN_LOOKUP_RUNTIME, + "abi": OFFCHAIN_LOOKUP_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/offchain_resolver.py b/web3/_utils/contract_sources/contract_data/offchain_resolver.py new file mode 100644 index 0000000000..9a845a6706 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/offchain_resolver.py @@ -0,0 +1,100 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/OffchainResolver.sol:OffchainResolver +OFFCHAIN_RESOLVER_BYTECODE = "0x60806040523480156200001157600080fd5b506040516200230538038062002305833981810160405281019062000037919062000637565b81600090805190602001906200004f92919062000180565b5060005b8151811015620000e7576001806000848481518110620000785762000077620006bc565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080620000de9062000724565b91505062000053565b5060018060003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fab0b9cc3a46b568cb08d985497cde8ab7e18892d01f58db7dc7f0d2af859b2d7816040516200017091906200083f565b60405180910390a1505062000b8b565b828054828255906000526020600020908101928215620001cd579160200282015b82811115620001cc578251829081620001bb919062000aa4565b5091602001919060010190620001a1565b5b509050620001dc9190620001e0565b5090565b5b80821115620002045760008181620001fa919062000208565b50600101620001e1565b5090565b50805462000216906200089d565b6000825580601f106200022a57506200024b565b601f0160209004906000526020600020908101906200024a91906200024e565b5b50565b5b80821115620002695760008160009055506001016200024f565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620002d18262000286565b810181811067ffffffffffffffff82111715620002f357620002f262000297565b5b80604052505050565b6000620003086200026d565b9050620003168282620002c6565b919050565b600067ffffffffffffffff82111562000339576200033862000297565b5b602082029050602081019050919050565b600080fd5b600080fd5b600067ffffffffffffffff82111562000372576200037162000297565b5b6200037d8262000286565b9050602081019050919050565b60005b83811015620003aa5780820151818401526020810190506200038d565b60008484015250505050565b6000620003cd620003c78462000354565b620002fc565b905082815260208101848484011115620003ec57620003eb6200034f565b5b620003f98482856200038a565b509392505050565b600082601f83011262000419576200041862000281565b5b81516200042b848260208601620003b6565b91505092915050565b60006200044b62000445846200031b565b620002fc565b905080838252602082019050602084028301858111156200047157620004706200034a565b5b835b81811015620004bf57805167ffffffffffffffff8111156200049a576200049962000281565b5b808601620004a9898262000401565b8552602085019450505060208101905062000473565b5050509392505050565b600082601f830112620004e157620004e062000281565b5b8151620004f384826020860162000434565b91505092915050565b600067ffffffffffffffff8211156200051a576200051962000297565b5b602082029050602081019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600062000558826200052b565b9050919050565b6200056a816200054b565b81146200057657600080fd5b50565b6000815190506200058a816200055f565b92915050565b6000620005a7620005a184620004fc565b620002fc565b90508083825260208201905060208402830185811115620005cd57620005cc6200034a565b5b835b81811015620005fa5780620005e5888262000579565b845260208401935050602081019050620005cf565b5050509392505050565b600082601f8301126200061c576200061b62000281565b5b81516200062e84826020860162000590565b91505092915050565b6000806040838503121562000651576200065062000277565b5b600083015167ffffffffffffffff8111156200067257620006716200027c565b5b6200068085828601620004c9565b925050602083015167ffffffffffffffff811115620006a457620006a36200027c565b5b620006b28582860162000604565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000819050919050565b600062000731826200071a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203620007665762000765620006eb565b5b600182019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b620007a8816200054b565b82525050565b6000620007bc83836200079d565b60208301905092915050565b6000602082019050919050565b6000620007e28262000771565b620007ee81856200077c565b9350620007fb836200078d565b8060005b8381101562000832578151620008168882620007ae565b97506200082383620007c8565b925050600181019050620007ff565b5085935050505092915050565b600060208201905081810360008301526200085b8184620007d5565b905092915050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620008b657607f821691505b602082108103620008cc57620008cb6200086e565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620009367fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620008f7565b620009428683620008f7565b95508019841693508086168417925050509392505050565b6000819050919050565b6000620009856200097f62000979846200071a565b6200095a565b6200071a565b9050919050565b6000819050919050565b620009a18362000964565b620009b9620009b0826200098c565b84845462000904565b825550505050565b600090565b620009d0620009c1565b620009dd81848462000996565b505050565b5b8181101562000a0557620009f9600082620009c6565b600181019050620009e3565b5050565b601f82111562000a545762000a1e81620008d2565b62000a2984620008e7565b8101602085101562000a39578190505b62000a5162000a4885620008e7565b830182620009e2565b50505b505050565b600082821c905092915050565b600062000a796000198460080262000a59565b1980831691505092915050565b600062000a94838362000a66565b9150826002028217905092915050565b62000aaf8262000863565b67ffffffffffffffff81111562000acb5762000aca62000297565b5b62000ad782546200089d565b62000ae482828562000a09565b600060209050601f83116001811462000b1c576000841562000b07578287015190505b62000b13858262000a86565b86555062000b83565b601f19841662000b2c86620008d2565b60005b8281101562000b565784890151825560018201915060208501945060208101905062000b2f565b8683101562000b76578489015162000b72601f89168262000a66565b8355505b6001600288020188555050505b505050505050565b61176a8062000b9b6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806301ffc9a7146100675780631dcfea0914610097578063736c0d5b146100c7578063796676be146100f75780639061b92314610127578063f4d4d2f814610157575b600080fd5b610081600480360381019061007c91906109db565b610187565b60405161008e9190610a23565b60405180910390f35b6100b160048036038101906100ac9190610c22565b610201565b6040516100be9190610cda565b60405180910390f35b6100e160048036038101906100dc9190610cf5565b610219565b6040516100ee9190610a23565b60405180910390f35b610111600480360381019061010c9190610d58565b610239565b60405161011e9190610e04565b60405180910390f35b610141600480360381019061013c9190610e86565b6102e5565b60405161014e9190610f5c565b60405180910390f35b610171600480360381019061016c9190610e86565b6103b4565b60405161017e9190610f5c565b60405180910390f35b60007f9061b923000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806101fa57506101f982610462565b5b9050919050565b600061020f858585856104cc565b9050949350505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000818154811061024957600080fd5b90600052602060002001600091509050805461026490610fad565b80601f016020809104026020016040519081016040528092919081815260200182805461029090610fad565b80156102dd5780601f106102b2576101008083540402835291602001916102dd565b820191906000526020600020905b8154815290600101906020018083116102c057829003601f168201915b505050505081565b60606000639061b92360e01b86868686604051602401610308949392919061100b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090503060008263f4d4d2f860e01b846040517f556f18300000000000000000000000000000000000000000000000000000000081526004016103ab9594939291906111d4565b60405180910390fd5b60606000806103c585858989610513565b91509150600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610455576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044c906112ae565b60405180910390fd5b8092505050949350505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008484848051906020012084805190602001206040516020016104f394939291906113c4565b604051602081830303815290604052805190602001209050949350505050565b600060606000806000868681019061052b919061141d565b925092509250600061058c61058630858d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050886104cc565b836105a1565b90508084955095505050505094509492505050565b60008060006105b085856105c8565b915091506105bd81610649565b819250505092915050565b60008060418351036106095760008060006020860151925060408601519150606086015160001a90506105fd87828585610815565b94509450505050610642565b604083510361063957600080602085015191506040850151905061062e868383610921565b935093505050610642565b60006002915091505b9250929050565b6000600481111561065d5761065c6114a8565b5b8160048111156106705761066f6114a8565b5b0315610812576001600481111561068a576106896114a8565b5b81600481111561069d5761069c6114a8565b5b036106dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611523565b60405180910390fd5b600260048111156106f1576106f06114a8565b5b816004811115610704576107036114a8565b5b03610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b9061158f565b60405180910390fd5b60036004811115610758576107576114a8565b5b81600481111561076b5761076a6114a8565b5b036107ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a290611621565b60405180910390fd5b6004808111156107be576107bd6114a8565b5b8160048111156107d1576107d06114a8565b5b03610811576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610808906116b3565b60405180910390fd5b5b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610850576000600391509150610918565b601b8560ff16141580156108685750601c8560ff1614155b1561087a576000600491509150610918565b60006001878787876040516000815260200160405260405161089f94939291906116ef565b6020604051602081039080840390855afa1580156108c1573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361090f57600060019250925050610918565b80600092509250505b94509492505050565b6000806000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85169150601b8560ff1c01905061096187828885610815565b935093505050935093915050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6109b881610983565b81146109c357600080fd5b50565b6000813590506109d5816109af565b92915050565b6000602082840312156109f1576109f0610979565b5b60006109ff848285016109c6565b91505092915050565b60008115159050919050565b610a1d81610a08565b82525050565b6000602082019050610a386000830184610a14565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610a6982610a3e565b9050919050565b610a7981610a5e565b8114610a8457600080fd5b50565b600081359050610a9681610a70565b92915050565b600067ffffffffffffffff82169050919050565b610ab981610a9c565b8114610ac457600080fd5b50565b600081359050610ad681610ab0565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610b2f82610ae6565b810181811067ffffffffffffffff82111715610b4e57610b4d610af7565b5b80604052505050565b6000610b6161096f565b9050610b6d8282610b26565b919050565b600067ffffffffffffffff821115610b8d57610b8c610af7565b5b610b9682610ae6565b9050602081019050919050565b82818337600083830152505050565b6000610bc5610bc084610b72565b610b57565b905082815260208101848484011115610be157610be0610ae1565b5b610bec848285610ba3565b509392505050565b600082601f830112610c0957610c08610adc565b5b8135610c19848260208601610bb2565b91505092915050565b60008060008060808587031215610c3c57610c3b610979565b5b6000610c4a87828801610a87565b9450506020610c5b87828801610ac7565b935050604085013567ffffffffffffffff811115610c7c57610c7b61097e565b5b610c8887828801610bf4565b925050606085013567ffffffffffffffff811115610ca957610ca861097e565b5b610cb587828801610bf4565b91505092959194509250565b6000819050919050565b610cd481610cc1565b82525050565b6000602082019050610cef6000830184610ccb565b92915050565b600060208284031215610d0b57610d0a610979565b5b6000610d1984828501610a87565b91505092915050565b6000819050919050565b610d3581610d22565b8114610d4057600080fd5b50565b600081359050610d5281610d2c565b92915050565b600060208284031215610d6e57610d6d610979565b5b6000610d7c84828501610d43565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610dbf578082015181840152602081019050610da4565b60008484015250505050565b6000610dd682610d85565b610de08185610d90565b9350610df0818560208601610da1565b610df981610ae6565b840191505092915050565b60006020820190508181036000830152610e1e8184610dcb565b905092915050565b600080fd5b600080fd5b60008083601f840112610e4657610e45610adc565b5b8235905067ffffffffffffffff811115610e6357610e62610e26565b5b602083019150836001820283011115610e7f57610e7e610e2b565b5b9250929050565b60008060008060408587031215610ea057610e9f610979565b5b600085013567ffffffffffffffff811115610ebe57610ebd61097e565b5b610eca87828801610e30565b9450945050602085013567ffffffffffffffff811115610eed57610eec61097e565b5b610ef987828801610e30565b925092505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000610f2e82610f07565b610f388185610f12565b9350610f48818560208601610da1565b610f5181610ae6565b840191505092915050565b60006020820190508181036000830152610f768184610f23565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610fc557607f821691505b602082108103610fd857610fd7610f7e565b5b50919050565b6000610fea8385610f12565b9350610ff7838584610ba3565b61100083610ae6565b840190509392505050565b60006040820190508181036000830152611026818688610fde565b9050818103602083015261103b818486610fde565b905095945050505050565b61104f81610a5e565b82525050565b600081549050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b600081546110b981610fad565b6110c38186611086565b945060018216600081146110de57600181146110f457611127565b60ff198316865281151560200286019350611127565b6110fd85611097565b60005b8381101561111f57815481890152600182019150602081019050611100565b808801955050505b50505092915050565b600061113c83836110ac565b905092915050565b6000600182019050919050565b600061115c82611055565b6111668185611060565b93508360208202850161117885611071565b8060005b858110156111b3578484038952816111948582611130565b945061119f83611144565b925060208a0199505060018101905061117c565b50829750879550505050505092915050565b6111ce81610983565b82525050565b600060a0820190506111e96000830188611046565b81810360208301526111fb8187611151565b9050818103604083015261120f8186610f23565b905061121e60608301856111c5565b81810360808301526112308184610f23565b90509695505050505050565b7f5369676e617475726556657269666965723a20496e76616c6964207369676e6160008201527f7475726500000000000000000000000000000000000000000000000000000000602082015250565b6000611298602483610d90565b91506112a38261123c565b604082019050919050565b600060208201905081810360008301526112c78161128b565b9050919050565b600081905092915050565b7f1900000000000000000000000000000000000000000000000000000000000000600082015250565b600061130f6002836112ce565b915061131a826112d9565b600282019050919050565b60008160601b9050919050565b600061133d82611325565b9050919050565b600061134f82611332565b9050919050565b61136761136282610a5e565b611344565b82525050565b60008160c01b9050919050565b60006113858261136d565b9050919050565b61139d61139882610a9c565b61137a565b82525050565b6000819050919050565b6113be6113b982610cc1565b6113a3565b82525050565b60006113cf82611302565b91506113db8287611356565b6014820191506113eb828661138c565b6008820191506113fb82856113ad565b60208201915061140b82846113ad565b60208201915081905095945050505050565b60008060006060848603121561143657611435610979565b5b600084013567ffffffffffffffff8111156114545761145361097e565b5b61146086828701610bf4565b935050602061147186828701610ac7565b925050604084013567ffffffffffffffff8111156114925761149161097e565b5b61149e86828701610bf4565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b600061150d601883610d90565b9150611518826114d7565b602082019050919050565b6000602082019050818103600083015261153c81611500565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611579601f83610d90565b915061158482611543565b602082019050919050565b600060208201905081810360008301526115a88161156c565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061160b602283610d90565b9150611616826115af565b604082019050919050565b6000602082019050818103600083015261163a816115fe565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061169d602283610d90565b91506116a882611641565b604082019050919050565b600060208201905081810360008301526116cc81611690565b9050919050565b600060ff82169050919050565b6116e9816116d3565b82525050565b60006080820190506117046000830187610ccb565b61171160208301866116e0565b61171e6040830185610ccb565b61172b6060830184610ccb565b9594505050505056fea2646970667358221220926d54cf87c2ee927634d1a46e75088d8df28c8ee843b4fb4c2c16196a914f1c64736f6c63430008110033" # noqa: E501 +OFFCHAIN_RESOLVER_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100625760003560e01c806301ffc9a7146100675780631dcfea0914610097578063736c0d5b146100c7578063796676be146100f75780639061b92314610127578063f4d4d2f814610157575b600080fd5b610081600480360381019061007c91906109db565b610187565b60405161008e9190610a23565b60405180910390f35b6100b160048036038101906100ac9190610c22565b610201565b6040516100be9190610cda565b60405180910390f35b6100e160048036038101906100dc9190610cf5565b610219565b6040516100ee9190610a23565b60405180910390f35b610111600480360381019061010c9190610d58565b610239565b60405161011e9190610e04565b60405180910390f35b610141600480360381019061013c9190610e86565b6102e5565b60405161014e9190610f5c565b60405180910390f35b610171600480360381019061016c9190610e86565b6103b4565b60405161017e9190610f5c565b60405180910390f35b60007f9061b923000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806101fa57506101f982610462565b5b9050919050565b600061020f858585856104cc565b9050949350505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000818154811061024957600080fd5b90600052602060002001600091509050805461026490610fad565b80601f016020809104026020016040519081016040528092919081815260200182805461029090610fad565b80156102dd5780601f106102b2576101008083540402835291602001916102dd565b820191906000526020600020905b8154815290600101906020018083116102c057829003601f168201915b505050505081565b60606000639061b92360e01b86868686604051602401610308949392919061100b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090503060008263f4d4d2f860e01b846040517f556f18300000000000000000000000000000000000000000000000000000000081526004016103ab9594939291906111d4565b60405180910390fd5b60606000806103c585858989610513565b91509150600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610455576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044c906112ae565b60405180910390fd5b8092505050949350505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008484848051906020012084805190602001206040516020016104f394939291906113c4565b604051602081830303815290604052805190602001209050949350505050565b600060606000806000868681019061052b919061141d565b925092509250600061058c61058630858d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050886104cc565b836105a1565b90508084955095505050505094509492505050565b60008060006105b085856105c8565b915091506105bd81610649565b819250505092915050565b60008060418351036106095760008060006020860151925060408601519150606086015160001a90506105fd87828585610815565b94509450505050610642565b604083510361063957600080602085015191506040850151905061062e868383610921565b935093505050610642565b60006002915091505b9250929050565b6000600481111561065d5761065c6114a8565b5b8160048111156106705761066f6114a8565b5b0315610812576001600481111561068a576106896114a8565b5b81600481111561069d5761069c6114a8565b5b036106dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611523565b60405180910390fd5b600260048111156106f1576106f06114a8565b5b816004811115610704576107036114a8565b5b03610744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073b9061158f565b60405180910390fd5b60036004811115610758576107576114a8565b5b81600481111561076b5761076a6114a8565b5b036107ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a290611621565b60405180910390fd5b6004808111156107be576107bd6114a8565b5b8160048111156107d1576107d06114a8565b5b03610811576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610808906116b3565b60405180910390fd5b5b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115610850576000600391509150610918565b601b8560ff16141580156108685750601c8560ff1614155b1561087a576000600491509150610918565b60006001878787876040516000815260200160405260405161089f94939291906116ef565b6020604051602081039080840390855afa1580156108c1573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361090f57600060019250925050610918565b80600092509250505b94509492505050565b6000806000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85169150601b8560ff1c01905061096187828885610815565b935093505050935093915050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6109b881610983565b81146109c357600080fd5b50565b6000813590506109d5816109af565b92915050565b6000602082840312156109f1576109f0610979565b5b60006109ff848285016109c6565b91505092915050565b60008115159050919050565b610a1d81610a08565b82525050565b6000602082019050610a386000830184610a14565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610a6982610a3e565b9050919050565b610a7981610a5e565b8114610a8457600080fd5b50565b600081359050610a9681610a70565b92915050565b600067ffffffffffffffff82169050919050565b610ab981610a9c565b8114610ac457600080fd5b50565b600081359050610ad681610ab0565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610b2f82610ae6565b810181811067ffffffffffffffff82111715610b4e57610b4d610af7565b5b80604052505050565b6000610b6161096f565b9050610b6d8282610b26565b919050565b600067ffffffffffffffff821115610b8d57610b8c610af7565b5b610b9682610ae6565b9050602081019050919050565b82818337600083830152505050565b6000610bc5610bc084610b72565b610b57565b905082815260208101848484011115610be157610be0610ae1565b5b610bec848285610ba3565b509392505050565b600082601f830112610c0957610c08610adc565b5b8135610c19848260208601610bb2565b91505092915050565b60008060008060808587031215610c3c57610c3b610979565b5b6000610c4a87828801610a87565b9450506020610c5b87828801610ac7565b935050604085013567ffffffffffffffff811115610c7c57610c7b61097e565b5b610c8887828801610bf4565b925050606085013567ffffffffffffffff811115610ca957610ca861097e565b5b610cb587828801610bf4565b91505092959194509250565b6000819050919050565b610cd481610cc1565b82525050565b6000602082019050610cef6000830184610ccb565b92915050565b600060208284031215610d0b57610d0a610979565b5b6000610d1984828501610a87565b91505092915050565b6000819050919050565b610d3581610d22565b8114610d4057600080fd5b50565b600081359050610d5281610d2c565b92915050565b600060208284031215610d6e57610d6d610979565b5b6000610d7c84828501610d43565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610dbf578082015181840152602081019050610da4565b60008484015250505050565b6000610dd682610d85565b610de08185610d90565b9350610df0818560208601610da1565b610df981610ae6565b840191505092915050565b60006020820190508181036000830152610e1e8184610dcb565b905092915050565b600080fd5b600080fd5b60008083601f840112610e4657610e45610adc565b5b8235905067ffffffffffffffff811115610e6357610e62610e26565b5b602083019150836001820283011115610e7f57610e7e610e2b565b5b9250929050565b60008060008060408587031215610ea057610e9f610979565b5b600085013567ffffffffffffffff811115610ebe57610ebd61097e565b5b610eca87828801610e30565b9450945050602085013567ffffffffffffffff811115610eed57610eec61097e565b5b610ef987828801610e30565b925092505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000610f2e82610f07565b610f388185610f12565b9350610f48818560208601610da1565b610f5181610ae6565b840191505092915050565b60006020820190508181036000830152610f768184610f23565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610fc557607f821691505b602082108103610fd857610fd7610f7e565b5b50919050565b6000610fea8385610f12565b9350610ff7838584610ba3565b61100083610ae6565b840190509392505050565b60006040820190508181036000830152611026818688610fde565b9050818103602083015261103b818486610fde565b905095945050505050565b61104f81610a5e565b82525050565b600081549050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b600081546110b981610fad565b6110c38186611086565b945060018216600081146110de57600181146110f457611127565b60ff198316865281151560200286019350611127565b6110fd85611097565b60005b8381101561111f57815481890152600182019150602081019050611100565b808801955050505b50505092915050565b600061113c83836110ac565b905092915050565b6000600182019050919050565b600061115c82611055565b6111668185611060565b93508360208202850161117885611071565b8060005b858110156111b3578484038952816111948582611130565b945061119f83611144565b925060208a0199505060018101905061117c565b50829750879550505050505092915050565b6111ce81610983565b82525050565b600060a0820190506111e96000830188611046565b81810360208301526111fb8187611151565b9050818103604083015261120f8186610f23565b905061121e60608301856111c5565b81810360808301526112308184610f23565b90509695505050505050565b7f5369676e617475726556657269666965723a20496e76616c6964207369676e6160008201527f7475726500000000000000000000000000000000000000000000000000000000602082015250565b6000611298602483610d90565b91506112a38261123c565b604082019050919050565b600060208201905081810360008301526112c78161128b565b9050919050565b600081905092915050565b7f1900000000000000000000000000000000000000000000000000000000000000600082015250565b600061130f6002836112ce565b915061131a826112d9565b600282019050919050565b60008160601b9050919050565b600061133d82611325565b9050919050565b600061134f82611332565b9050919050565b61136761136282610a5e565b611344565b82525050565b60008160c01b9050919050565b60006113858261136d565b9050919050565b61139d61139882610a9c565b61137a565b82525050565b6000819050919050565b6113be6113b982610cc1565b6113a3565b82525050565b60006113cf82611302565b91506113db8287611356565b6014820191506113eb828661138c565b6008820191506113fb82856113ad565b60208201915061140b82846113ad565b60208201915081905095945050505050565b60008060006060848603121561143657611435610979565b5b600084013567ffffffffffffffff8111156114545761145361097e565b5b61146086828701610bf4565b935050602061147186828701610ac7565b925050604084013567ffffffffffffffff8111156114925761149161097e565b5b61149e86828701610bf4565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b600061150d601883610d90565b9150611518826114d7565b602082019050919050565b6000602082019050818103600083015261153c81611500565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000611579601f83610d90565b915061158482611543565b602082019050919050565b600060208201905081810360008301526115a88161156c565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061160b602283610d90565b9150611616826115af565b604082019050919050565b6000602082019050818103600083015261163a816115fe565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061169d602283610d90565b91506116a882611641565b604082019050919050565b600060208201905081810360008301526116cc81611690565b9050919050565b600060ff82169050919050565b6116e9816116d3565b82525050565b60006080820190506117046000830187610ccb565b61171160208301866116e0565b61171e6040830185610ccb565b61172b6060830184610ccb565b9594505050505056fea2646970667358221220926d54cf87c2ee927634d1a46e75088d8df28c8ee843b4fb4c2c16196a914f1c64736f6c63430008110033" # noqa: E501 +OFFCHAIN_RESOLVER_ABI = [ + { + "inputs": [ + {"internalType": "string[]", "name": "_urls", "type": "string[]"}, + {"internalType": "address[]", "name": "_signers", "type": "address[]"}, + ], + "stateMutability": "nonpayable", + "type": "constructor", + }, + { + "inputs": [ + {"internalType": "address", "name": "sender", "type": "address"}, + {"internalType": "string[]", "name": "urls", "type": "string[]"}, + {"internalType": "bytes", "name": "callData", "type": "bytes"}, + {"internalType": "bytes4", "name": "callbackFunction", "type": "bytes4"}, + {"internalType": "bytes", "name": "extraData", "type": "bytes"}, + ], + "name": "OffchainLookup", + "type": "error", + }, + { + "anonymous": False, + "inputs": [ + { + "indexed": False, + "internalType": "address[]", + "name": "signers", + "type": "address[]", + } + ], + "name": "NewSigners", + "type": "event", + }, + { + "inputs": [ + {"internalType": "address", "name": "target", "type": "address"}, + {"internalType": "uint64", "name": "expires", "type": "uint64"}, + {"internalType": "bytes", "name": "request", "type": "bytes"}, + {"internalType": "bytes", "name": "result", "type": "bytes"}, + ], + "name": "makeSignatureHash", + "outputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}], + "stateMutability": "pure", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes", "name": "name", "type": "bytes"}, + {"internalType": "bytes", "name": "data", "type": "bytes"}, + ], + "name": "resolve", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [ + {"internalType": "bytes", "name": "response", "type": "bytes"}, + {"internalType": "bytes", "name": "extraData", "type": "bytes"}, + ], + "name": "resolveWithProof", + "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "address", "name": "", "type": "address"}], + "name": "signers", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "bytes4", "name": "interfaceID", "type": "bytes4"}], + "name": "supportsInterface", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "pure", + "type": "function", + }, + { + "inputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "name": "urls", + "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "stateMutability": "view", + "type": "function", + }, +] +OFFCHAIN_RESOLVER_DATA = { + "bytecode": OFFCHAIN_RESOLVER_BYTECODE, + "bytecode_runtime": OFFCHAIN_RESOLVER_RUNTIME, + "abi": OFFCHAIN_RESOLVER_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/payable_tester.py b/web3/_utils/contract_sources/contract_data/payable_tester.py new file mode 100644 index 0000000000..807bb4c529 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/payable_tester.py @@ -0,0 +1,29 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/PayableTester.sol:PayableTesterContract +PAYABLE_TESTER_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b5060ee8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c8063c6803622146037578063e4cb8f5c146051575b600080fd5b603d6059565b60405160489190609f565b60405180910390f35b6057606a565b005b60008054906101000a900460ff1681565b60016000806101000a81548160ff021916908315150217905550565b60008115159050919050565b6099816086565b82525050565b600060208201905060b260008301846092565b9291505056fea264697066735822122000b51898fbc08d97b14a5a31d9c7fa634a58531d88a18c6a31c981fd5e52334e64736f6c63430008110033" # noqa: E501 +PAYABLE_TESTER_CONTRACT_RUNTIME = "0x6080604052348015600f57600080fd5b506004361060325760003560e01c8063c6803622146037578063e4cb8f5c146051575b600080fd5b603d6059565b60405160489190609f565b60405180910390f35b6057606a565b005b60008054906101000a900460ff1681565b60016000806101000a81548160ff021916908315150217905550565b60008115159050919050565b6099816086565b82525050565b600060208201905060b260008301846092565b9291505056fea264697066735822122000b51898fbc08d97b14a5a31d9c7fa634a58531d88a18c6a31c981fd5e52334e64736f6c63430008110033" # noqa: E501 +PAYABLE_TESTER_CONTRACT_ABI = [ + { + "inputs": [], + "name": "doNoValueCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [], + "name": "wasCalled", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function", + }, +] +PAYABLE_TESTER_CONTRACT_DATA = { + "bytecode": PAYABLE_TESTER_CONTRACT_BYTECODE, + "bytecode_runtime": PAYABLE_TESTER_CONTRACT_RUNTIME, + "abi": PAYABLE_TESTER_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/receive_function_contracts.py b/web3/_utils/contract_sources/contract_data/receive_function_contracts.py new file mode 100644 index 0000000000..340ee56f55 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/receive_function_contracts.py @@ -0,0 +1,58 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/ReceiveFunctionContracts.sol:ReceiveFunctionContract # noqa: E501 +RECEIVE_FUNCTION_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b506107bb806100206000396000f3fe60806040526004361061002d5760003560e01c80635d3a1f9d146100be578063e00fe2eb146100fb57610078565b36610078576040518060400160405280600781526020017f72656365697665000000000000000000000000000000000000000000000000008152506000908161007691906104a9565b005b6040518060400160405280600881526020017f66616c6c6261636b000000000000000000000000000000000000000000000000815250600090816100bc91906104a9565b005b3480156100ca57600080fd5b506100e560048036038101906100e091906106a6565b610126565b6040516100f29190610763565b60405180910390f35b34801561010757600080fd5b506101106101c7565b60405161011d9190610763565b60405180910390f35b6060816000908161013791906104a9565b8054610142906102c2565b80601f016020809104026020016040519081016040528092919081815260200182805461016e906102c2565b80156101bb5780601f10610190576101008083540402835291602001916101bb565b820191906000526020600020905b81548152906001019060200180831161019e57829003601f168201915b50505050509050919050565b6060600080546101d6906102c2565b80601f0160208091040260200160405190810160405280929190818152602001828054610202906102c2565b801561024f5780601f106102245761010080835404028352916020019161024f565b820191906000526020600020905b81548152906001019060200180831161023257829003601f168201915b5050505050905090565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806102da57607f821691505b6020821081036102ed576102ec610293565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026103557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610318565b61035f8683610318565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006103a66103a161039c84610377565b610381565b610377565b9050919050565b6000819050919050565b6103c08361038b565b6103d46103cc826103ad565b848454610325565b825550505050565b600090565b6103e96103dc565b6103f48184846103b7565b505050565b5b818110156104185761040d6000826103e1565b6001810190506103fa565b5050565b601f82111561045d5761042e816102f3565b61043784610308565b81016020851015610446578190505b61045a61045285610308565b8301826103f9565b50505b505050565b600082821c905092915050565b600061048060001984600802610462565b1980831691505092915050565b6000610499838361046f565b9150826002028217905092915050565b6104b282610259565b67ffffffffffffffff8111156104cb576104ca610264565b5b6104d582546102c2565b6104e082828561041c565b600060209050601f8311600181146105135760008415610501578287015190505b61050b858261048d565b865550610573565b601f198416610521866102f3565b60005b8281101561054957848901518255600182019150602085019450602081019050610524565b868310156105665784890151610562601f89168261046f565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b6105b382610599565b810181811067ffffffffffffffff821117156105d2576105d1610264565b5b80604052505050565b60006105e561057b565b90506105f182826105aa565b919050565b600067ffffffffffffffff82111561061157610610610264565b5b61061a82610599565b9050602081019050919050565b82818337600083830152505050565b6000610649610644846105f6565b6105db565b90508281526020810184848401111561066557610664610594565b5b610670848285610627565b509392505050565b600082601f83011261068d5761068c61058f565b5b813561069d848260208601610636565b91505092915050565b6000602082840312156106bc576106bb610585565b5b600082013567ffffffffffffffff8111156106da576106d961058a565b5b6106e684828501610678565b91505092915050565b600082825260208201905092915050565b60005b8381101561071e578082015181840152602081019050610703565b60008484015250505050565b600061073582610259565b61073f81856106ef565b935061074f818560208601610700565b61075881610599565b840191505092915050565b6000602082019050818103600083015261077d818461072a565b90509291505056fea264697066735822122038c1ccb29287dbfea00d3e9b9c59d5a19fdcb228f06f7e39792bfcd2351193cf64736f6c63430008110033" # noqa: E501 +RECEIVE_FUNCTION_CONTRACT_RUNTIME = "0x60806040526004361061002d5760003560e01c80635d3a1f9d146100be578063e00fe2eb146100fb57610078565b36610078576040518060400160405280600781526020017f72656365697665000000000000000000000000000000000000000000000000008152506000908161007691906104a9565b005b6040518060400160405280600881526020017f66616c6c6261636b000000000000000000000000000000000000000000000000815250600090816100bc91906104a9565b005b3480156100ca57600080fd5b506100e560048036038101906100e091906106a6565b610126565b6040516100f29190610763565b60405180910390f35b34801561010757600080fd5b506101106101c7565b60405161011d9190610763565b60405180910390f35b6060816000908161013791906104a9565b8054610142906102c2565b80601f016020809104026020016040519081016040528092919081815260200182805461016e906102c2565b80156101bb5780601f10610190576101008083540402835291602001916101bb565b820191906000526020600020905b81548152906001019060200180831161019e57829003601f168201915b50505050509050919050565b6060600080546101d6906102c2565b80601f0160208091040260200160405190810160405280929190818152602001828054610202906102c2565b801561024f5780601f106102245761010080835404028352916020019161024f565b820191906000526020600020905b81548152906001019060200180831161023257829003601f168201915b5050505050905090565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806102da57607f821691505b6020821081036102ed576102ec610293565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026103557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610318565b61035f8683610318565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006103a66103a161039c84610377565b610381565b610377565b9050919050565b6000819050919050565b6103c08361038b565b6103d46103cc826103ad565b848454610325565b825550505050565b600090565b6103e96103dc565b6103f48184846103b7565b505050565b5b818110156104185761040d6000826103e1565b6001810190506103fa565b5050565b601f82111561045d5761042e816102f3565b61043784610308565b81016020851015610446578190505b61045a61045285610308565b8301826103f9565b50505b505050565b600082821c905092915050565b600061048060001984600802610462565b1980831691505092915050565b6000610499838361046f565b9150826002028217905092915050565b6104b282610259565b67ffffffffffffffff8111156104cb576104ca610264565b5b6104d582546102c2565b6104e082828561041c565b600060209050601f8311600181146105135760008415610501578287015190505b61050b858261048d565b865550610573565b601f198416610521866102f3565b60005b8281101561054957848901518255600182019150602085019450602081019050610524565b868310156105665784890151610562601f89168261046f565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b6105b382610599565b810181811067ffffffffffffffff821117156105d2576105d1610264565b5b80604052505050565b60006105e561057b565b90506105f182826105aa565b919050565b600067ffffffffffffffff82111561061157610610610264565b5b61061a82610599565b9050602081019050919050565b82818337600083830152505050565b6000610649610644846105f6565b6105db565b90508281526020810184848401111561066557610664610594565b5b610670848285610627565b509392505050565b600082601f83011261068d5761068c61058f565b5b813561069d848260208601610636565b91505092915050565b6000602082840312156106bc576106bb610585565b5b600082013567ffffffffffffffff8111156106da576106d961058a565b5b6106e684828501610678565b91505092915050565b600082825260208201905092915050565b60005b8381101561071e578082015181840152602081019050610703565b60008484015250505050565b600061073582610259565b61073f81856106ef565b935061074f818560208601610700565b61075881610599565b840191505092915050565b6000602082019050818103600083015261077d818461072a565b90509291505056fea264697066735822122038c1ccb29287dbfea00d3e9b9c59d5a19fdcb228f06f7e39792bfcd2351193cf64736f6c63430008110033" # noqa: E501 +RECEIVE_FUNCTION_CONTRACT_ABI = [ + {"stateMutability": "payable", "type": "fallback"}, + { + "inputs": [], + "name": "getText", + "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "string", "name": "new_text", "type": "string"}], + "name": "setText", + "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "stateMutability": "nonpayable", + "type": "function", + }, + {"stateMutability": "payable", "type": "receive"}, +] +RECEIVE_FUNCTION_CONTRACT_DATA = { + "bytecode": RECEIVE_FUNCTION_CONTRACT_BYTECODE, + "bytecode_runtime": RECEIVE_FUNCTION_CONTRACT_RUNTIME, + "abi": RECEIVE_FUNCTION_CONTRACT_ABI, +} + + +# source: web3/_utils/contract_sources/ReceiveFunctionContracts.sol:NoReceiveFunctionContract # noqa: E501 +NO_RECEIVE_FUNCTION_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50610764806100206000396000f3fe608060405234801561001057600080fd5b506004361061003a5760003560e01c80635d3a1f9d14610081578063e00fe2eb146100b15761003b565b5b6040518060400160405280600881526020017f66616c6c6261636b0000000000000000000000000000000000000000000000008152506000908161007f9190610452565b005b61009b6004803603810190610096919061064f565b6100cf565b6040516100a8919061070c565b60405180910390f35b6100b9610170565b6040516100c6919061070c565b60405180910390f35b606081600090816100e09190610452565b80546100eb9061026b565b80601f01602080910402602001604051908101604052809291908181526020018280546101179061026b565b80156101645780601f1061013957610100808354040283529160200191610164565b820191906000526020600020905b81548152906001019060200180831161014757829003601f168201915b50505050509050919050565b60606000805461017f9061026b565b80601f01602080910402602001604051908101604052809291908181526020018280546101ab9061026b565b80156101f85780601f106101cd576101008083540402835291602001916101f8565b820191906000526020600020905b8154815290600101906020018083116101db57829003601f168201915b5050505050905090565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061028357607f821691505b6020821081036102965761029561023c565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026102fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826102c1565b61030886836102c1565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061034f61034a61034584610320565b61032a565b610320565b9050919050565b6000819050919050565b61036983610334565b61037d61037582610356565b8484546102ce565b825550505050565b600090565b610392610385565b61039d818484610360565b505050565b5b818110156103c1576103b660008261038a565b6001810190506103a3565b5050565b601f821115610406576103d78161029c565b6103e0846102b1565b810160208510156103ef578190505b6104036103fb856102b1565b8301826103a2565b50505b505050565b600082821c905092915050565b60006104296000198460080261040b565b1980831691505092915050565b60006104428383610418565b9150826002028217905092915050565b61045b82610202565b67ffffffffffffffff8111156104745761047361020d565b5b61047e825461026b565b6104898282856103c5565b600060209050601f8311600181146104bc57600084156104aa578287015190505b6104b48582610436565b86555061051c565b601f1984166104ca8661029c565b60005b828110156104f2578489015182556001820191506020850194506020810190506104cd565b8683101561050f578489015161050b601f891682610418565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61055c82610542565b810181811067ffffffffffffffff8211171561057b5761057a61020d565b5b80604052505050565b600061058e610524565b905061059a8282610553565b919050565b600067ffffffffffffffff8211156105ba576105b961020d565b5b6105c382610542565b9050602081019050919050565b82818337600083830152505050565b60006105f26105ed8461059f565b610584565b90508281526020810184848401111561060e5761060d61053d565b5b6106198482856105d0565b509392505050565b600082601f83011261063657610635610538565b5b81356106468482602086016105df565b91505092915050565b6000602082840312156106655761066461052e565b5b600082013567ffffffffffffffff81111561068357610682610533565b5b61068f84828501610621565b91505092915050565b600082825260208201905092915050565b60005b838110156106c75780820151818401526020810190506106ac565b60008484015250505050565b60006106de82610202565b6106e88185610698565b93506106f88185602086016106a9565b61070181610542565b840191505092915050565b6000602082019050818103600083015261072681846106d3565b90509291505056fea2646970667358221220b9f5d8e3526abab8fb79e1fec33978f4e30ed8b1c0dc91e05979b570430812b764736f6c63430008110033" # noqa: E501 +NO_RECEIVE_FUNCTION_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b506004361061003a5760003560e01c80635d3a1f9d14610081578063e00fe2eb146100b15761003b565b5b6040518060400160405280600881526020017f66616c6c6261636b0000000000000000000000000000000000000000000000008152506000908161007f9190610452565b005b61009b6004803603810190610096919061064f565b6100cf565b6040516100a8919061070c565b60405180910390f35b6100b9610170565b6040516100c6919061070c565b60405180910390f35b606081600090816100e09190610452565b80546100eb9061026b565b80601f01602080910402602001604051908101604052809291908181526020018280546101179061026b565b80156101645780601f1061013957610100808354040283529160200191610164565b820191906000526020600020905b81548152906001019060200180831161014757829003601f168201915b50505050509050919050565b60606000805461017f9061026b565b80601f01602080910402602001604051908101604052809291908181526020018280546101ab9061026b565b80156101f85780601f106101cd576101008083540402835291602001916101f8565b820191906000526020600020905b8154815290600101906020018083116101db57829003601f168201915b5050505050905090565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061028357607f821691505b6020821081036102965761029561023c565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026102fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826102c1565b61030886836102c1565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061034f61034a61034584610320565b61032a565b610320565b9050919050565b6000819050919050565b61036983610334565b61037d61037582610356565b8484546102ce565b825550505050565b600090565b610392610385565b61039d818484610360565b505050565b5b818110156103c1576103b660008261038a565b6001810190506103a3565b5050565b601f821115610406576103d78161029c565b6103e0846102b1565b810160208510156103ef578190505b6104036103fb856102b1565b8301826103a2565b50505b505050565b600082821c905092915050565b60006104296000198460080261040b565b1980831691505092915050565b60006104428383610418565b9150826002028217905092915050565b61045b82610202565b67ffffffffffffffff8111156104745761047361020d565b5b61047e825461026b565b6104898282856103c5565b600060209050601f8311600181146104bc57600084156104aa578287015190505b6104b48582610436565b86555061051c565b601f1984166104ca8661029c565b60005b828110156104f2578489015182556001820191506020850194506020810190506104cd565b8683101561050f578489015161050b601f891682610418565b8355505b6001600288020188555050505b505050505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61055c82610542565b810181811067ffffffffffffffff8211171561057b5761057a61020d565b5b80604052505050565b600061058e610524565b905061059a8282610553565b919050565b600067ffffffffffffffff8211156105ba576105b961020d565b5b6105c382610542565b9050602081019050919050565b82818337600083830152505050565b60006105f26105ed8461059f565b610584565b90508281526020810184848401111561060e5761060d61053d565b5b6106198482856105d0565b509392505050565b600082601f83011261063657610635610538565b5b81356106468482602086016105df565b91505092915050565b6000602082840312156106655761066461052e565b5b600082013567ffffffffffffffff81111561068357610682610533565b5b61068f84828501610621565b91505092915050565b600082825260208201905092915050565b60005b838110156106c75780820151818401526020810190506106ac565b60008484015250505050565b60006106de82610202565b6106e88185610698565b93506106f88185602086016106a9565b61070181610542565b840191505092915050565b6000602082019050818103600083015261072681846106d3565b90509291505056fea2646970667358221220b9f5d8e3526abab8fb79e1fec33978f4e30ed8b1c0dc91e05979b570430812b764736f6c63430008110033" # noqa: E501 +NO_RECEIVE_FUNCTION_CONTRACT_ABI = [ + {"stateMutability": "nonpayable", "type": "fallback"}, + { + "inputs": [], + "name": "getText", + "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "stateMutability": "view", + "type": "function", + }, + { + "inputs": [{"internalType": "string", "name": "new_text", "type": "string"}], + "name": "setText", + "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "stateMutability": "nonpayable", + "type": "function", + }, +] +NO_RECEIVE_FUNCTION_CONTRACT_DATA = { + "bytecode": NO_RECEIVE_FUNCTION_CONTRACT_BYTECODE, + "bytecode_runtime": NO_RECEIVE_FUNCTION_CONTRACT_RUNTIME, + "abi": NO_RECEIVE_FUNCTION_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/reflector_contracts.py b/web3/_utils/contract_sources/contract_data/reflector_contracts.py new file mode 100644 index 0000000000..bff6f93597 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/reflector_contracts.py @@ -0,0 +1,29 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/ReflectorContracts.sol:AddressReflectorContract +ADDRESS_REFLECTOR_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50610430806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea2646970667358221220056b3254d1a97ff397098f071b13bec0adf8cba16d3a86a3750a624ad36dd82d64736f6c63430008110033" # noqa: E501 +ADDRESS_REFLECTOR_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630b816c161461003b578063c04d11fc1461006b575b600080fd5b61005560048036038101906100509190610121565b61009b565b604051610062919061015d565b60405180910390f35b610085600480360381019061008091906102d1565b6100a5565b60405161009291906103d8565b60405180910390f35b6000819050919050565b6060819050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100ee826100c3565b9050919050565b6100fe816100e3565b811461010957600080fd5b50565b60008135905061011b816100f5565b92915050565b600060208284031215610137576101366100b9565b5b60006101458482850161010c565b91505092915050565b610157816100e3565b82525050565b6000602082019050610172600083018461014e565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6101c68261017d565b810181811067ffffffffffffffff821117156101e5576101e461018e565b5b80604052505050565b60006101f86100af565b905061020482826101bd565b919050565b600067ffffffffffffffff8211156102245761022361018e565b5b602082029050602081019050919050565b600080fd5b600061024d61024884610209565b6101ee565b905080838252602082019050602084028301858111156102705761026f610235565b5b835b818110156102995780610285888261010c565b845260208401935050602081019050610272565b5050509392505050565b600082601f8301126102b8576102b7610178565b5b81356102c884826020860161023a565b91505092915050565b6000602082840312156102e7576102e66100b9565b5b600082013567ffffffffffffffff811115610305576103046100be565b5b610311848285016102a3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61034f816100e3565b82525050565b60006103618383610346565b60208301905092915050565b6000602082019050919050565b60006103858261031a565b61038f8185610325565b935061039a83610336565b8060005b838110156103cb5781516103b28882610355565b97506103bd8361036d565b92505060018101905061039e565b5085935050505092915050565b600060208201905081810360008301526103f2818461037a565b90509291505056fea2646970667358221220056b3254d1a97ff397098f071b13bec0adf8cba16d3a86a3750a624ad36dd82d64736f6c63430008110033" # noqa: E501 +ADDRESS_REFLECTOR_CONTRACT_ABI = [ + { + "inputs": [{"internalType": "address", "name": "arg", "type": "address"}], + "name": "reflect", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "pure", + "type": "function", + }, + { + "inputs": [{"internalType": "address[]", "name": "arg", "type": "address[]"}], + "name": "reflect", + "outputs": [{"internalType": "address[]", "name": "", "type": "address[]"}], + "stateMutability": "pure", + "type": "function", + }, +] +ADDRESS_REFLECTOR_CONTRACT_DATA = { + "bytecode": ADDRESS_REFLECTOR_CONTRACT_BYTECODE, + "bytecode_runtime": ADDRESS_REFLECTOR_CONTRACT_RUNTIME, + "abi": ADDRESS_REFLECTOR_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/revert_contract.py b/web3/_utils/contract_sources/contract_data/revert_contract.py new file mode 100644 index 0000000000..ff750a1790 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/revert_contract.py @@ -0,0 +1,36 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/RevertContract.sol:RevertContract +REVERT_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b506101aa806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063185c38a414610046578063c06a97cb14610050578063d67e4b841461005a575b600080fd5b61004e610078565b005b6100586100b3565b005b6100626100b8565b60405161006f91906100dc565b60405180910390f35b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100aa90610154565b60405180910390fd5b600080fd5b60006001905090565b60008115159050919050565b6100d6816100c1565b82525050565b60006020820190506100f160008301846100cd565b92915050565b600082825260208201905092915050565b7f46756e6374696f6e20686173206265656e2072657665727465642e0000000000600082015250565b600061013e601b836100f7565b915061014982610108565b602082019050919050565b6000602082019050818103600083015261016d81610131565b905091905056fea26469706673582212201d78337cb1f5b9893fb5f0475796452dd157799030c248939f27cd3b98ec46ce64736f6c63430008110033" # noqa: E501 +REVERT_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063185c38a414610046578063c06a97cb14610050578063d67e4b841461005a575b600080fd5b61004e610078565b005b6100586100b3565b005b6100626100b8565b60405161006f91906100dc565b60405180910390f35b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100aa90610154565b60405180910390fd5b600080fd5b60006001905090565b60008115159050919050565b6100d6816100c1565b82525050565b60006020820190506100f160008301846100cd565b92915050565b600082825260208201905092915050565b7f46756e6374696f6e20686173206265656e2072657665727465642e0000000000600082015250565b600061013e601b836100f7565b915061014982610108565b602082019050919050565b6000602082019050818103600083015261016d81610131565b905091905056fea26469706673582212201d78337cb1f5b9893fb5f0475796452dd157799030c248939f27cd3b98ec46ce64736f6c63430008110033" # noqa: E501 +REVERT_CONTRACT_ABI = [ + { + "inputs": [], + "name": "normalFunction", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "pure", + "type": "function", + }, + { + "inputs": [], + "name": "revertWithMessage", + "outputs": [], + "stateMutability": "pure", + "type": "function", + }, + { + "inputs": [], + "name": "revertWithoutMessage", + "outputs": [], + "stateMutability": "pure", + "type": "function", + }, +] +REVERT_CONTRACT_DATA = { + "bytecode": REVERT_CONTRACT_BYTECODE, + "bytecode_runtime": REVERT_CONTRACT_RUNTIME, + "abi": REVERT_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/simple_resolver.py b/web3/_utils/contract_sources/contract_data/simple_resolver.py new file mode 100644 index 0000000000..3b59cc55ce --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/simple_resolver.py @@ -0,0 +1,29 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/SimpleResolver.sol:SimpleResolver +SIMPLE_RESOLVER_BYTECODE = "0x608060405234801561001057600080fd5b5061028c806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780633b3b57de1461006b575b600080fd5b61005560048036038101906100509190610134565b61009b565b604051610062919061017c565b60405180910390f35b610085600480360381019061008091906101cd565b6100cd565b604051610092919061023b565b60405180910390f35b6000633b3b57de60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000309050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610111816100dc565b811461011c57600080fd5b50565b60008135905061012e81610108565b92915050565b60006020828403121561014a576101496100d7565b5b60006101588482850161011f565b91505092915050565b60008115159050919050565b61017681610161565b82525050565b6000602082019050610191600083018461016d565b92915050565b6000819050919050565b6101aa81610197565b81146101b557600080fd5b50565b6000813590506101c7816101a1565b92915050565b6000602082840312156101e3576101e26100d7565b5b60006101f1848285016101b8565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610225826101fa565b9050919050565b6102358161021a565b82525050565b6000602082019050610250600083018461022c565b9291505056fea2646970667358221220ee3cec68b65444c456e61bd90c00df515cf26610d83bf930b4daa7444a5a033964736f6c63430008110033" # noqa: E501 +SIMPLE_RESOLVER_RUNTIME = "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780633b3b57de1461006b575b600080fd5b61005560048036038101906100509190610134565b61009b565b604051610062919061017c565b60405180910390f35b610085600480360381019061008091906101cd565b6100cd565b604051610092919061023b565b60405180910390f35b6000633b3b57de60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000309050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610111816100dc565b811461011c57600080fd5b50565b60008135905061012e81610108565b92915050565b60006020828403121561014a576101496100d7565b5b60006101588482850161011f565b91505092915050565b60008115159050919050565b61017681610161565b82525050565b6000602082019050610191600083018461016d565b92915050565b6000819050919050565b6101aa81610197565b81146101b557600080fd5b50565b6000813590506101c7816101a1565b92915050565b6000602082840312156101e3576101e26100d7565b5b60006101f1848285016101b8565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610225826101fa565b9050919050565b6102358161021a565b82525050565b6000602082019050610250600083018461022c565b9291505056fea2646970667358221220ee3cec68b65444c456e61bd90c00df515cf26610d83bf930b4daa7444a5a033964736f6c63430008110033" # noqa: E501 +SIMPLE_RESOLVER_ABI = [ + { + "inputs": [{"internalType": "bytes32", "name": "nodeID", "type": "bytes32"}], + "name": "addr", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [{"internalType": "bytes4", "name": "interfaceID", "type": "bytes4"}], + "name": "supportsInterface", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "nonpayable", + "type": "function", + }, +] +SIMPLE_RESOLVER_DATA = { + "bytecode": SIMPLE_RESOLVER_BYTECODE, + "bytecode_runtime": SIMPLE_RESOLVER_RUNTIME, + "abi": SIMPLE_RESOLVER_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/string_contract.py b/web3/_utils/contract_sources/contract_data/string_contract.py new file mode 100644 index 0000000000..fe6a112a87 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/string_contract.py @@ -0,0 +1,42 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/StringContract.sol:StringContract +STRING_CONTRACT_BYTECODE = "0x60806040523480156200001157600080fd5b5060405162000d1a38038062000d1a8339818101604052810190620000379190620001e3565b80600090816200004891906200047f565b505062000566565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620000b9826200006e565b810181811067ffffffffffffffff82111715620000db57620000da6200007f565b5b80604052505050565b6000620000f062000050565b9050620000fe8282620000ae565b919050565b600067ffffffffffffffff8211156200012157620001206200007f565b5b6200012c826200006e565b9050602081019050919050565b60005b83811015620001595780820151818401526020810190506200013c565b60008484015250505050565b60006200017c620001768462000103565b620000e4565b9050828152602081018484840111156200019b576200019a62000069565b5b620001a884828562000139565b509392505050565b600082601f830112620001c857620001c762000064565b5b8151620001da84826020860162000165565b91505092915050565b600060208284031215620001fc57620001fb6200005a565b5b600082015167ffffffffffffffff8111156200021d576200021c6200005f565b5b6200022b84828501620001b0565b91505092915050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200028757607f821691505b6020821081036200029d576200029c6200023f565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620003077fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002c8565b620003138683620002c8565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003606200035a62000354846200032b565b62000335565b6200032b565b9050919050565b6000819050919050565b6200037c836200033f565b620003946200038b8262000367565b848454620002d5565b825550505050565b600090565b620003ab6200039c565b620003b881848462000371565b505050565b5b81811015620003e057620003d4600082620003a1565b600181019050620003be565b5050565b601f8211156200042f57620003f981620002a3565b6200040484620002b8565b8101602085101562000414578190505b6200042c6200042385620002b8565b830182620003bd565b50505b505050565b600082821c905092915050565b6000620004546000198460080262000434565b1980831691505092915050565b60006200046f838362000441565b9150826002028217905092915050565b6200048a8262000234565b67ffffffffffffffff811115620004a657620004a56200007f565b5b620004b282546200026e565b620004bf828285620003e4565b600060209050601f831160018114620004f75760008415620004e2578287015190505b620004ee858262000461565b8655506200055e565b601f1984166200050786620002a3565b60005b8281101562000531578489015182556001820191506020850194506020810190506200050a565b868310156200055157848901516200054d601f89168262000441565b8355505b6001600288020188555050505b505050505050565b6107a480620005766000396000f3fe6080604052600436106100385760003560e01c8063209652551461009d5780633fa4f245146100bb57806393a09352146100e657610039565b5b34801561004557600080fd5b50600036606082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a561010f565b6040516100b291906102d2565b60405180910390f35b3480156100c757600080fd5b506100d06101a1565b6040516100dd91906102d2565b60405180910390f35b3480156100f257600080fd5b5061010d6004803603810190610108919061043d565b61022f565b005b60606000805461011e906104b5565b80601f016020809104026020016040519081016040528092919081815260200182805461014a906104b5565b80156101975780601f1061016c57610100808354040283529160200191610197565b820191906000526020600020905b81548152906001019060200180831161017a57829003601f168201915b5050505050905090565b600080546101ae906104b5565b80601f01602080910402602001604051908101604052809291908181526020018280546101da906104b5565b80156102275780601f106101fc57610100808354040283529160200191610227565b820191906000526020600020905b81548152906001019060200180831161020a57829003601f168201915b505050505081565b806000908161023e919061069c565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561027c578082015181840152602081019050610261565b60008484015250505050565b6000601f19601f8301169050919050565b60006102a482610242565b6102ae818561024d565b93506102be81856020860161025e565b6102c781610288565b840191505092915050565b600060208201905081810360008301526102ec8184610299565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61034a82610288565b810181811067ffffffffffffffff8211171561036957610368610312565b5b80604052505050565b600061037c6102f4565b90506103888282610341565b919050565b600067ffffffffffffffff8211156103a8576103a7610312565b5b6103b182610288565b9050602081019050919050565b82818337600083830152505050565b60006103e06103db8461038d565b610372565b9050828152602081018484840111156103fc576103fb61030d565b5b6104078482856103be565b509392505050565b600082601f83011261042457610423610308565b5b81356104348482602086016103cd565b91505092915050565b600060208284031215610453576104526102fe565b5b600082013567ffffffffffffffff81111561047157610470610303565b5b61047d8482850161040f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806104cd57607f821691505b6020821081036104e0576104df610486565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026105487fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261050b565b610552868361050b565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061059961059461058f8461056a565b610574565b61056a565b9050919050565b6000819050919050565b6105b38361057e565b6105c76105bf826105a0565b848454610518565b825550505050565b600090565b6105dc6105cf565b6105e78184846105aa565b505050565b5b8181101561060b576106006000826105d4565b6001810190506105ed565b5050565b601f82111561065057610621816104e6565b61062a846104fb565b81016020851015610639578190505b61064d610645856104fb565b8301826105ec565b50505b505050565b600082821c905092915050565b600061067360001984600802610655565b1980831691505092915050565b600061068c8383610662565b9150826002028217905092915050565b6106a582610242565b67ffffffffffffffff8111156106be576106bd610312565b5b6106c882546104b5565b6106d382828561060f565b600060209050601f83116001811461070657600084156106f4578287015190505b6106fe8582610680565b865550610766565b601f198416610714866104e6565b60005b8281101561073c57848901518255600182019150602085019450602081019050610717565b868310156107595784890151610755601f891682610662565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220aafbcf0e5a2ec94028472c741edd4684c7624a15507c1b3aadf20145fdc73db464736f6c63430008110033" # noqa: E501 +STRING_CONTRACT_RUNTIME = "0x6080604052600436106100385760003560e01c8063209652551461009d5780633fa4f245146100bb57806393a09352146100e657610039565b5b34801561004557600080fd5b50600036606082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a561010f565b6040516100b291906102d2565b60405180910390f35b3480156100c757600080fd5b506100d06101a1565b6040516100dd91906102d2565b60405180910390f35b3480156100f257600080fd5b5061010d6004803603810190610108919061043d565b61022f565b005b60606000805461011e906104b5565b80601f016020809104026020016040519081016040528092919081815260200182805461014a906104b5565b80156101975780601f1061016c57610100808354040283529160200191610197565b820191906000526020600020905b81548152906001019060200180831161017a57829003601f168201915b5050505050905090565b600080546101ae906104b5565b80601f01602080910402602001604051908101604052809291908181526020018280546101da906104b5565b80156102275780601f106101fc57610100808354040283529160200191610227565b820191906000526020600020905b81548152906001019060200180831161020a57829003601f168201915b505050505081565b806000908161023e919061069c565b5050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561027c578082015181840152602081019050610261565b60008484015250505050565b6000601f19601f8301169050919050565b60006102a482610242565b6102ae818561024d565b93506102be81856020860161025e565b6102c781610288565b840191505092915050565b600060208201905081810360008301526102ec8184610299565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61034a82610288565b810181811067ffffffffffffffff8211171561036957610368610312565b5b80604052505050565b600061037c6102f4565b90506103888282610341565b919050565b600067ffffffffffffffff8211156103a8576103a7610312565b5b6103b182610288565b9050602081019050919050565b82818337600083830152505050565b60006103e06103db8461038d565b610372565b9050828152602081018484840111156103fc576103fb61030d565b5b6104078482856103be565b509392505050565b600082601f83011261042457610423610308565b5b81356104348482602086016103cd565b91505092915050565b600060208284031215610453576104526102fe565b5b600082013567ffffffffffffffff81111561047157610470610303565b5b61047d8482850161040f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806104cd57607f821691505b6020821081036104e0576104df610486565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026105487fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261050b565b610552868361050b565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061059961059461058f8461056a565b610574565b61056a565b9050919050565b6000819050919050565b6105b38361057e565b6105c76105bf826105a0565b848454610518565b825550505050565b600090565b6105dc6105cf565b6105e78184846105aa565b505050565b5b8181101561060b576106006000826105d4565b6001810190506105ed565b5050565b601f82111561065057610621816104e6565b61062a846104fb565b81016020851015610639578190505b61064d610645856104fb565b8301826105ec565b50505b505050565b600082821c905092915050565b600061067360001984600802610655565b1980831691505092915050565b600061068c8383610662565b9150826002028217905092915050565b6106a582610242565b67ffffffffffffffff8111156106be576106bd610312565b5b6106c882546104b5565b6106d382828561060f565b600060209050601f83116001811461070657600084156106f4578287015190505b6106fe8582610680565b865550610766565b601f198416610714866104e6565b60005b8281101561073c57848901518255600182019150602085019450602081019050610717565b868310156107595784890151610755601f891682610662565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220aafbcf0e5a2ec94028472c741edd4684c7624a15507c1b3aadf20145fdc73db464736f6c63430008110033" # noqa: E501 +STRING_CONTRACT_ABI = [ + { + "inputs": [{"internalType": "string", "name": "_value", "type": "string"}], + "stateMutability": "nonpayable", + "type": "constructor", + }, + {"stateMutability": "nonpayable", "type": "fallback"}, + { + "inputs": [], + "name": "getValue", + "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "stateMutability": "payable", + "type": "function", + }, + { + "inputs": [{"internalType": "string", "name": "_value", "type": "string"}], + "name": "setValue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + }, + { + "inputs": [], + "name": "value", + "outputs": [{"internalType": "string", "name": "", "type": "string"}], + "stateMutability": "view", + "type": "function", + }, +] +STRING_CONTRACT_DATA = { + "bytecode": STRING_CONTRACT_BYTECODE, + "bytecode_runtime": STRING_CONTRACT_RUNTIME, + "abi": STRING_CONTRACT_ABI, +} diff --git a/web3/_utils/contract_sources/contract_data/tuple_contracts.py b/web3/_utils/contract_sources/contract_data/tuple_contracts.py new file mode 100644 index 0000000000..4c2d99ac39 --- /dev/null +++ b/web3/_utils/contract_sources/contract_data/tuple_contracts.py @@ -0,0 +1,153 @@ +""" +Generated by `compile_contracts.py` script. +Compiled with Solidity v0.8.17. +""" + +# source: web3/_utils/contract_sources/TupleContracts.sol:TupleContract +TUPLE_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b50610abb806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80638e1ae3c714610030575b600080fd5b61004a6004803603810190610045919061067b565b610060565b6040516100579190610a63565b60405180910390f35b610068610070565b819050919050565b60405180606001604052806000815260200160608152602001606081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6100f3826100aa565b810181811067ffffffffffffffff82111715610112576101116100bb565b5b80604052505050565b6000610125610091565b905061013182826100ea565b919050565b600080fd5b6000819050919050565b61014e8161013b565b811461015957600080fd5b50565b60008135905061016b81610145565b92915050565b600080fd5b600067ffffffffffffffff821115610191576101906100bb565b5b602082029050602081019050919050565b600080fd5b60006101ba6101b584610176565b61011b565b905080838252602082019050602084028301858111156101dd576101dc6101a2565b5b835b8181101561020657806101f2888261015c565b8452602084019350506020810190506101df565b5050509392505050565b600082601f83011261022557610224610171565b5b81356102358482602086016101a7565b91505092915050565b600067ffffffffffffffff821115610259576102586100bb565b5b602082029050602081019050919050565b6000819050919050565b61027d8161026a565b811461028857600080fd5b50565b60008135905061029a81610274565b92915050565b600067ffffffffffffffff8211156102bb576102ba6100bb565b5b602082029050919050565b60008115159050919050565b6102db816102c6565b81146102e657600080fd5b50565b6000813590506102f8816102d2565b92915050565b600061031161030c846102a0565b61011b565b9050806020840283018581111561032b5761032a6101a2565b5b835b81811015610354578061034088826102e9565b84526020840193505060208101905061032d565b5050509392505050565b600082601f83011261037357610372610171565b5b60026103808482856102fe565b91505092915050565b600067ffffffffffffffff8211156103a4576103a36100bb565b5b602082029050602081019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103e0826103b5565b9050919050565b6103f0816103d5565b81146103fb57600080fd5b50565b60008135905061040d816103e7565b92915050565b600061042661042184610389565b61011b565b90508083825260208201905060208402830185811115610449576104486101a2565b5b835b81811015610472578061045e88826103fe565b84526020840193505060208101905061044b565b5050509392505050565b600082601f83011261049157610490610171565b5b81356104a1848260208601610413565b91505092915050565b6000608082840312156104c0576104bf6100a5565b5b6104ca606061011b565b905060006104da8482850161028b565b60008301525060206104ee8482850161035e565b602083015250606082013567ffffffffffffffff81111561051257610511610136565b5b61051e8482850161047c565b60408301525092915050565b600061053d6105388461023e565b61011b565b905080838252602082019050602084028301858111156105605761055f6101a2565b5b835b818110156105a757803567ffffffffffffffff81111561058557610584610171565b5b80860161059289826104aa565b85526020850194505050602081019050610562565b5050509392505050565b600082601f8301126105c6576105c5610171565b5b81356105d684826020860161052a565b91505092915050565b6000606082840312156105f5576105f46100a5565b5b6105ff606061011b565b9050600061060f8482850161015c565b600083015250602082013567ffffffffffffffff81111561063357610632610136565b5b61063f84828501610210565b602083015250604082013567ffffffffffffffff81111561066357610662610136565b5b61066f848285016105b1565b60408301525092915050565b6000602082840312156106915761069061009b565b5b600082013567ffffffffffffffff8111156106af576106ae6100a0565b5b6106bb848285016105df565b91505092915050565b6106cd8161013b565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600061070b83836106c4565b60208301905092915050565b6000602082019050919050565b600061072f826106d3565b61073981856106de565b9350610744836106ef565b8060005b8381101561077557815161075c88826106ff565b975061076783610717565b925050600181019050610748565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6107b78161026a565b82525050565b600060029050919050565b600081905092915050565b6000819050919050565b6107e6816102c6565b82525050565b60006107f883836107dd565b60208301905092915050565b6000602082019050919050565b61081a816107bd565b61082481846107c8565b925061082f826107d3565b8060005b8381101561086057815161084787826107ec565b965061085283610804565b925050600181019050610833565b505050505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61089d816103d5565b82525050565b60006108af8383610894565b60208301905092915050565b6000602082019050919050565b60006108d382610868565b6108dd8185610873565b93506108e883610884565b8060005b8381101561091957815161090088826108a3565b975061090b836108bb565b9250506001810190506108ec565b5085935050505092915050565b600060808301600083015161093e60008601826107ae565b5060208301516109516020860182610811565b506040830151848203606086015261096982826108c8565b9150508091505092915050565b60006109828383610926565b905092915050565b6000602082019050919050565b60006109a282610782565b6109ac818561078d565b9350836020820285016109be8561079e565b8060005b858110156109fa57848403895281516109db8582610976565b94506109e68361098a565b925060208a019950506001810190506109c2565b50829750879550505050505092915050565b6000606083016000830151610a2460008601826106c4565b5060208301518482036020860152610a3c8282610724565b91505060408301518482036040860152610a568282610997565b9150508091505092915050565b60006020820190508181036000830152610a7d8184610a0c565b90509291505056fea26469706673582212207fc0320c27056d217ded8d2ecf14abee55713bc9098553460cc0d30f6cd93ccd64736f6c63430008110033" # noqa: E501 +TUPLE_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80638e1ae3c714610030575b600080fd5b61004a6004803603810190610045919061067b565b610060565b6040516100579190610a63565b60405180910390f35b610068610070565b819050919050565b60405180606001604052806000815260200160608152602001606081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6100f3826100aa565b810181811067ffffffffffffffff82111715610112576101116100bb565b5b80604052505050565b6000610125610091565b905061013182826100ea565b919050565b600080fd5b6000819050919050565b61014e8161013b565b811461015957600080fd5b50565b60008135905061016b81610145565b92915050565b600080fd5b600067ffffffffffffffff821115610191576101906100bb565b5b602082029050602081019050919050565b600080fd5b60006101ba6101b584610176565b61011b565b905080838252602082019050602084028301858111156101dd576101dc6101a2565b5b835b8181101561020657806101f2888261015c565b8452602084019350506020810190506101df565b5050509392505050565b600082601f83011261022557610224610171565b5b81356102358482602086016101a7565b91505092915050565b600067ffffffffffffffff821115610259576102586100bb565b5b602082029050602081019050919050565b6000819050919050565b61027d8161026a565b811461028857600080fd5b50565b60008135905061029a81610274565b92915050565b600067ffffffffffffffff8211156102bb576102ba6100bb565b5b602082029050919050565b60008115159050919050565b6102db816102c6565b81146102e657600080fd5b50565b6000813590506102f8816102d2565b92915050565b600061031161030c846102a0565b61011b565b9050806020840283018581111561032b5761032a6101a2565b5b835b81811015610354578061034088826102e9565b84526020840193505060208101905061032d565b5050509392505050565b600082601f83011261037357610372610171565b5b60026103808482856102fe565b91505092915050565b600067ffffffffffffffff8211156103a4576103a36100bb565b5b602082029050602081019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103e0826103b5565b9050919050565b6103f0816103d5565b81146103fb57600080fd5b50565b60008135905061040d816103e7565b92915050565b600061042661042184610389565b61011b565b90508083825260208201905060208402830185811115610449576104486101a2565b5b835b81811015610472578061045e88826103fe565b84526020840193505060208101905061044b565b5050509392505050565b600082601f83011261049157610490610171565b5b81356104a1848260208601610413565b91505092915050565b6000608082840312156104c0576104bf6100a5565b5b6104ca606061011b565b905060006104da8482850161028b565b60008301525060206104ee8482850161035e565b602083015250606082013567ffffffffffffffff81111561051257610511610136565b5b61051e8482850161047c565b60408301525092915050565b600061053d6105388461023e565b61011b565b905080838252602082019050602084028301858111156105605761055f6101a2565b5b835b818110156105a757803567ffffffffffffffff81111561058557610584610171565b5b80860161059289826104aa565b85526020850194505050602081019050610562565b5050509392505050565b600082601f8301126105c6576105c5610171565b5b81356105d684826020860161052a565b91505092915050565b6000606082840312156105f5576105f46100a5565b5b6105ff606061011b565b9050600061060f8482850161015c565b600083015250602082013567ffffffffffffffff81111561063357610632610136565b5b61063f84828501610210565b602083015250604082013567ffffffffffffffff81111561066357610662610136565b5b61066f848285016105b1565b60408301525092915050565b6000602082840312156106915761069061009b565b5b600082013567ffffffffffffffff8111156106af576106ae6100a0565b5b6106bb848285016105df565b91505092915050565b6106cd8161013b565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600061070b83836106c4565b60208301905092915050565b6000602082019050919050565b600061072f826106d3565b61073981856106de565b9350610744836106ef565b8060005b8381101561077557815161075c88826106ff565b975061076783610717565b925050600181019050610748565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6107b78161026a565b82525050565b600060029050919050565b600081905092915050565b6000819050919050565b6107e6816102c6565b82525050565b60006107f883836107dd565b60208301905092915050565b6000602082019050919050565b61081a816107bd565b61082481846107c8565b925061082f826107d3565b8060005b8381101561086057815161084787826107ec565b965061085283610804565b925050600181019050610833565b505050505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61089d816103d5565b82525050565b60006108af8383610894565b60208301905092915050565b6000602082019050919050565b60006108d382610868565b6108dd8185610873565b93506108e883610884565b8060005b8381101561091957815161090088826108a3565b975061090b836108bb565b9250506001810190506108ec565b5085935050505092915050565b600060808301600083015161093e60008601826107ae565b5060208301516109516020860182610811565b506040830151848203606086015261096982826108c8565b9150508091505092915050565b60006109828383610926565b905092915050565b6000602082019050919050565b60006109a282610782565b6109ac818561078d565b9350836020820285016109be8561079e565b8060005b858110156109fa57848403895281516109db8582610976565b94506109e68361098a565b925060208a019950506001810190506109c2565b50829750879550505050505092915050565b6000606083016000830151610a2460008601826106c4565b5060208301518482036020860152610a3c8282610724565b91505060408301518482036040860152610a568282610997565b9150508091505092915050565b60006020820190508181036000830152610a7d8184610a0c565b90509291505056fea26469706673582212207fc0320c27056d217ded8d2ecf14abee55713bc9098553460cc0d30f6cd93ccd64736f6c63430008110033" # noqa: E501 +TUPLE_CONTRACT_ABI = [ + { + "inputs": [ + { + "components": [ + {"internalType": "uint256", "name": "a", "type": "uint256"}, + {"internalType": "uint256[]", "name": "b", "type": "uint256[]"}, + { + "components": [ + {"internalType": "int256", "name": "x", "type": "int256"}, + {"internalType": "bool[2]", "name": "y", "type": "bool[2]"}, + { + "internalType": "address[]", + "name": "z", + "type": "address[]", + }, + ], + "internalType": "struct TupleContract.T[]", + "name": "c", + "type": "tuple[]", + }, + ], + "internalType": "struct TupleContract.S", + "name": "s", + "type": "tuple", + } + ], + "name": "method", + "outputs": [ + { + "components": [ + {"internalType": "uint256", "name": "a", "type": "uint256"}, + {"internalType": "uint256[]", "name": "b", "type": "uint256[]"}, + { + "components": [ + {"internalType": "int256", "name": "x", "type": "int256"}, + {"internalType": "bool[2]", "name": "y", "type": "bool[2]"}, + { + "internalType": "address[]", + "name": "z", + "type": "address[]", + }, + ], + "internalType": "struct TupleContract.T[]", + "name": "c", + "type": "tuple[]", + }, + ], + "internalType": "struct TupleContract.S", + "name": "", + "type": "tuple", + } + ], + "stateMutability": "pure", + "type": "function", + } +] +TUPLE_CONTRACT_DATA = { + "bytecode": TUPLE_CONTRACT_BYTECODE, + "bytecode_runtime": TUPLE_CONTRACT_RUNTIME, + "abi": TUPLE_CONTRACT_ABI, +} + + +# source: web3/_utils/contract_sources/TupleContracts.sol:NestedTupleContract +NESTED_TUPLE_CONTRACT_BYTECODE = "0x608060405234801561001057600080fd5b506106b5806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80632655aef114610030575b600080fd5b61004a60048036038101906100459190610411565b610060565b604051610057919061065d565b60405180910390f35b610068610070565b819050919050565b6040518060200160405280606081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6100e58261009c565b810181811067ffffffffffffffff82111715610104576101036100ad565b5b80604052505050565b6000610117610083565b905061012382826100dc565b919050565b600080fd5b600080fd5b600067ffffffffffffffff82111561014d5761014c6100ad565b5b602082029050602081019050919050565b600080fd5b600067ffffffffffffffff82111561017e5761017d6100ad565b5b602082029050602081019050919050565b6000819050919050565b6101a28161018f565b81146101ad57600080fd5b50565b6000813590506101bf81610199565b92915050565b6000604082840312156101db576101da610097565b5b6101e5604061010d565b905060006101f5848285016101b0565b6000830152506020610209848285016101b0565b60208301525092915050565b600061022861022384610163565b61010d565b9050808382526020820190506040840283018581111561024b5761024a61015e565b5b835b81811015610274578061026088826101c5565b84526020840193505060408101905061024d565b5050509392505050565b600082601f8301126102935761029261012d565b5b81356102a3848260208601610215565b91505092915050565b6000602082840312156102c2576102c1610097565b5b6102cc602061010d565b9050600082013567ffffffffffffffff8111156102ec576102eb610128565b5b6102f88482850161027e565b60008301525092915050565b600061031761031284610132565b61010d565b9050808382526020820190506020840283018581111561033a5761033961015e565b5b835b8181101561038157803567ffffffffffffffff81111561035f5761035e61012d565b5b80860161036c89826102ac565b8552602085019450505060208101905061033c565b5050509392505050565b600082601f8301126103a05761039f61012d565b5b81356103b0848260208601610304565b91505092915050565b6000602082840312156103cf576103ce610097565b5b6103d9602061010d565b9050600082013567ffffffffffffffff8111156103f9576103f8610128565b5b6104058482850161038b565b60008301525092915050565b6000602082840312156104275761042661008d565b5b600082013567ffffffffffffffff81111561044557610444610092565b5b610451848285016103b9565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6104bb8161018f565b82525050565b6040820160008201516104d760008501826104b2565b5060208201516104ea60208501826104b2565b50505050565b60006104fc83836104c1565b60408301905092915050565b6000602082019050919050565b600061052082610486565b61052a8185610491565b9350610535836104a2565b8060005b8381101561056657815161054d88826104f0565b975061055883610508565b925050600181019050610539565b5085935050505092915050565b600060208301600083015184820360008601526105908282610515565b9150508091505092915050565b60006105a98383610573565b905092915050565b6000602082019050919050565b60006105c98261045a565b6105d38185610465565b9350836020820285016105e585610476565b8060005b858110156106215784840389528151610602858261059d565b945061060d836105b1565b925060208a019950506001810190506105e9565b50829750879550505050505092915050565b6000602083016000830151848203600086015261065082826105be565b9150508091505092915050565b600060208201905081810360008301526106778184610633565b90509291505056fea26469706673582212208ea70f899bda98545e145e7a333a0ae15bd8ae26961c9b8ec53f480310e88a7764736f6c63430008110033" # noqa: E501 +NESTED_TUPLE_CONTRACT_RUNTIME = "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80632655aef114610030575b600080fd5b61004a60048036038101906100459190610411565b610060565b604051610057919061065d565b60405180910390f35b610068610070565b819050919050565b6040518060200160405280606081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6100e58261009c565b810181811067ffffffffffffffff82111715610104576101036100ad565b5b80604052505050565b6000610117610083565b905061012382826100dc565b919050565b600080fd5b600080fd5b600067ffffffffffffffff82111561014d5761014c6100ad565b5b602082029050602081019050919050565b600080fd5b600067ffffffffffffffff82111561017e5761017d6100ad565b5b602082029050602081019050919050565b6000819050919050565b6101a28161018f565b81146101ad57600080fd5b50565b6000813590506101bf81610199565b92915050565b6000604082840312156101db576101da610097565b5b6101e5604061010d565b905060006101f5848285016101b0565b6000830152506020610209848285016101b0565b60208301525092915050565b600061022861022384610163565b61010d565b9050808382526020820190506040840283018581111561024b5761024a61015e565b5b835b81811015610274578061026088826101c5565b84526020840193505060408101905061024d565b5050509392505050565b600082601f8301126102935761029261012d565b5b81356102a3848260208601610215565b91505092915050565b6000602082840312156102c2576102c1610097565b5b6102cc602061010d565b9050600082013567ffffffffffffffff8111156102ec576102eb610128565b5b6102f88482850161027e565b60008301525092915050565b600061031761031284610132565b61010d565b9050808382526020820190506020840283018581111561033a5761033961015e565b5b835b8181101561038157803567ffffffffffffffff81111561035f5761035e61012d565b5b80860161036c89826102ac565b8552602085019450505060208101905061033c565b5050509392505050565b600082601f8301126103a05761039f61012d565b5b81356103b0848260208601610304565b91505092915050565b6000602082840312156103cf576103ce610097565b5b6103d9602061010d565b9050600082013567ffffffffffffffff8111156103f9576103f8610128565b5b6104058482850161038b565b60008301525092915050565b6000602082840312156104275761042661008d565b5b600082013567ffffffffffffffff81111561044557610444610092565b5b610451848285016103b9565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6104bb8161018f565b82525050565b6040820160008201516104d760008501826104b2565b5060208201516104ea60208501826104b2565b50505050565b60006104fc83836104c1565b60408301905092915050565b6000602082019050919050565b600061052082610486565b61052a8185610491565b9350610535836104a2565b8060005b8381101561056657815161054d88826104f0565b975061055883610508565b925050600181019050610539565b5085935050505092915050565b600060208301600083015184820360008601526105908282610515565b9150508091505092915050565b60006105a98383610573565b905092915050565b6000602082019050919050565b60006105c98261045a565b6105d38185610465565b9350836020820285016105e585610476565b8060005b858110156106215784840389528151610602858261059d565b945061060d836105b1565b925060208a019950506001810190506105e9565b50829750879550505050505092915050565b6000602083016000830151848203600086015261065082826105be565b9150508091505092915050565b600060208201905081810360008301526106778184610633565b90509291505056fea26469706673582212208ea70f899bda98545e145e7a333a0ae15bd8ae26961c9b8ec53f480310e88a7764736f6c63430008110033" # noqa: E501 +NESTED_TUPLE_CONTRACT_ABI = [ + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "int256", + "name": "x", + "type": "int256", + }, + { + "internalType": "int256", + "name": "y", + "type": "int256", + }, + ], + "internalType": "struct NestedTupleContract.U[]", + "name": "u", + "type": "tuple[]", + } + ], + "internalType": "struct NestedTupleContract.T[]", + "name": "t", + "type": "tuple[]", + } + ], + "internalType": "struct NestedTupleContract.S", + "name": "s", + "type": "tuple", + } + ], + "name": "method", + "outputs": [ + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "int256", + "name": "x", + "type": "int256", + }, + { + "internalType": "int256", + "name": "y", + "type": "int256", + }, + ], + "internalType": "struct NestedTupleContract.U[]", + "name": "u", + "type": "tuple[]", + } + ], + "internalType": "struct NestedTupleContract.T[]", + "name": "t", + "type": "tuple[]", + } + ], + "internalType": "struct NestedTupleContract.S", + "name": "", + "type": "tuple", + } + ], + "stateMutability": "pure", + "type": "function", + } +] +NESTED_TUPLE_CONTRACT_DATA = { + "bytecode": NESTED_TUPLE_CONTRACT_BYTECODE, + "bytecode_runtime": NESTED_TUPLE_CONTRACT_RUNTIME, + "abi": NESTED_TUPLE_CONTRACT_ABI, +} diff --git a/web3/_utils/contracts.py b/web3/_utils/contracts.py index 96922af080..63313c8212 100644 --- a/web3/_utils/contracts.py +++ b/web3/_utils/contracts.py @@ -366,7 +366,12 @@ def validate_payable(transaction: TxParams, abi: ABIFunction) -> None: """ if "value" in transaction: if to_integer_if_hex(transaction["value"]) != 0: - if "payable" in abi and not abi["payable"]: + if ( + "payable" in abi + and not abi["payable"] + or "stateMutability" in abi + and abi["stateMutability"] == "nonpayable" + ): raise Web3ValidationError( "Sending non-zero ether to a contract function " "with payable=False. Please ensure that " diff --git a/web3/_utils/module_testing/eth_module.py b/web3/_utils/module_testing/eth_module.py index 34d97acb19..7f9a12b896 100644 --- a/web3/_utils/module_testing/eth_module.py +++ b/web3/_utils/module_testing/eth_module.py @@ -712,7 +712,9 @@ async def test_eth_get_code( @pytest.mark.asyncio async def test_eth_get_code_invalid_address( - self, async_w3: "Web3", math_contract + self, + async_w3: "Web3", + math_contract: "Contract", ) -> None: with pytest.raises(InvalidAddress): await async_w3.eth.get_code( # type: ignore @@ -739,7 +741,7 @@ async def test_eth_get_transaction_count( assert transaction_count >= 0 @pytest.mark.asyncio - async def test_eth_call(self, async_w3: "Web3", math_contract) -> None: + async def test_eth_call(self, async_w3: "Web3", math_contract: "Contract") -> None: coinbase = await async_w3.eth.coinbase # type: ignore txn_params = math_contract._prepare_transaction( fn_name="add", @@ -776,7 +778,7 @@ async def test_eth_call_with_override( @pytest.mark.asyncio async def test_eth_call_with_0_result( - self, async_w3: "Web3", math_contract + self, async_w3: "Web3", math_contract: "Contract" ) -> None: coinbase = await async_w3.eth.coinbase # type: ignore txn_params = math_contract._prepare_transaction( @@ -1779,7 +1781,9 @@ def test_eth_get_code_ens_address( assert isinstance(code, HexBytes) assert len(code) > 0 - def test_eth_get_code_invalid_address(self, w3: "Web3", math_contract) -> None: + def test_eth_get_code_invalid_address( + self, w3: "Web3", math_contract: "Contract" + ) -> None: with pytest.raises(InvalidAddress): w3.eth.get_code( ChecksumAddress(HexAddress(HexStr(math_contract.address.lower()))) @@ -2661,7 +2665,7 @@ def test_eth_send_raw_transaction( txn_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction) assert txn_hash == signed_tx.hash - def test_eth_call(self, w3: "Web3", math_contract) -> None: + def test_eth_call(self, w3: "Web3", math_contract: "Contract") -> None: coinbase = w3.eth.coinbase txn_params = math_contract._prepare_transaction( fn_name="add", @@ -2695,7 +2699,9 @@ def test_eth_call_with_override( (result,) = w3.codec.decode(["bool"], call_result) assert result is False - def test_eth_call_with_0_result(self, w3: "Web3", math_contract) -> None: + def test_eth_call_with_0_result( + self, w3: "Web3", math_contract: "Contract" + ) -> None: coinbase = w3.eth.coinbase txn_params = math_contract._prepare_transaction( fn_name="add", @@ -3390,13 +3396,13 @@ def test_eth_get_logs_with_logs_none_topic_args(self, w3: "Web3") -> None: assert len(result) == 0 def test_eth_call_old_contract_state( - self, w3: "Web3", math_contract, unlocked_account: ChecksumAddress + self, w3: "Web3", math_contract: "Contract", unlocked_account: ChecksumAddress ) -> None: start_block = w3.eth.get_block("latest") block_num = start_block["number"] block_hash = start_block["hash"] - math_contract.functions.increment().transact({"from": unlocked_account}) + math_contract.functions.incrementCounter().transact({"from": unlocked_account}) # This isn't an incredibly convincing test since we can't mine, and # the default resolved block is latest, So if block_identifier was ignored diff --git a/web3/_utils/module_testing/event_contract.py b/web3/_utils/module_testing/event_contract.py deleted file mode 100644 index 2561574939..0000000000 --- a/web3/_utils/module_testing/event_contract.py +++ /dev/null @@ -1,46 +0,0 @@ -EVENT_CONTRACT_CODE = ( - "6080604052348015600f57600080fd5b5061010b8061001f6000396000f30060806040526004361" - "0603f576000357c0100000000000000000000000000000000000000000000000000000000900463" - "ffffffff1680635818fad7146044575b600080fd5b348015604f57600080fd5b50606c600480360" - "38101908080359060200190929190505050606e565b005b7ff70fe689e290d8ce2b2a388ac28db3" - "6fbb0e16a6d89c6804c461f65a1b40bb15816040518082815260200191505060405180910390a17" - "f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051808281" - "5260200191505060405180910390a1505600a165627a7a72305820ff79430a04cf654d7b46edc52" - "9ccaa5d7f77607f54bb58210be0c48455292c810029" -) - - -EVENT_CONTRACT_RUNTIME = ( - "608060405260043610603f576000357c01000000000000000000000000000000000000000000000" - "00000000000900463ffffffff1680635818fad7146044575b600080fd5b348015604f57600080fd" - "5b50606c60048036038101908080359060200190929190505050606e565b005b7ff70fe689e290d" - "8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb158160405180828152602001915050" - "60405180910390a17f56d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce90" - "5d4816040518082815260200191505060405180910390a1505600a165627a7a72305820ff79430a" - "04cf654d7b46edc529ccaa5d7f77607f54bb58210be0c48455292c810029" -) - - -EVENT_CONTRACT_ABI = [ - { - "constant": False, - "inputs": [{"name": "arg0", "type": "uint256"}], - "name": "logTwoEvents", - "outputs": [], - "payable": False, - "stateMutability": "nonpayable", - "type": "function", - }, - { - "anonymous": False, - "inputs": [{"indexed": False, "name": "arg0", "type": "uint256"}], - "name": "LogSingleWithIndex", - "type": "event", - }, - { - "anonymous": False, - "inputs": [{"indexed": False, "name": "arg0", "type": "uint256"}], - "name": "LogSingleArg", - "type": "event", - }, -] diff --git a/web3/_utils/module_testing/fallback_contract.py b/web3/_utils/module_testing/fallback_contract.py deleted file mode 100644 index 7c2213488c..0000000000 --- a/web3/_utils/module_testing/fallback_contract.py +++ /dev/null @@ -1,14 +0,0 @@ -CONTRACT_FALLBACK_FUNCTION_SOURCE = """ -contract A { - uint data; - function A() public payable { data = 0; } - function getData() returns (uint r) { return data; } - function() { data = 1; } -} -""" - -CONTRACT_FALLBACK_FUNCTION_CODE = "60606040526000808190555060ae806100196000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bc5de30146053575b3415604957600080fd5b6001600081905550005b3415605d57600080fd5b60636079565b6040518082815260200191505060405180910390f35b600080549050905600a165627a7a72305820045439389e4742569ec078687e6a0c81997709778a0097adbe07ccfd9f7b1a330029" # noqa: E501 - -CONTRACT_FALLBACK_FUNCTION_RUNTIME = "606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bc5de30146053575b3415604957600080fd5b6001600081905550005b3415605d57600080fd5b60636079565b6040518082815260200191505060405180910390f35b600080549050905600a165627a7a72305820045439389e4742569ec078687e6a0c81997709778a0097adbe07ccfd9f7b1a330029" # noqa: E501 - -CONTRACT_FALLBACK_FUNCTION_ABI = '[{"constant": false, "inputs": [], "name": "getData", "outputs": [{"name": "r", "type": "uint256"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"inputs": [], "payable": true, "stateMutability": "payable", "type": "constructor"}, {"payable": false, "stateMutability": "nonpayable", "type": "fallback"}]' # noqa: E501 diff --git a/web3/_utils/module_testing/indexed_event_contract.py b/web3/_utils/module_testing/indexed_event_contract.py deleted file mode 100644 index 1f090b6474..0000000000 --- a/web3/_utils/module_testing/indexed_event_contract.py +++ /dev/null @@ -1,46 +0,0 @@ -IND_EVENT_CONTRACT_CODE = ( - "6080604052348015600f57600080fd5b506101018061001f6000396000f30060806040526004361" - "0603f576000357c0100000000000000000000000000000000000000000000000000000000900463" - "ffffffff1680635818fad7146044575b600080fd5b348015604f57600080fd5b50606c600480360" - "38101908080359060200190929190505050606e565b005b807ff70fe689e290d8ce2b2a388ac28d" - "b36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a27f56d2ef3c5228bf5d885" - "73621e325a4672ab50e033749a601e4f4a5e1dce905d48160405180828152602001915050604051" - "80910390a1505600a165627a7a72305820afa2dc55cd3a55a914793a583c3284fc5f8dc8ebec94e" - "6ec7fe1ad6d604daf350029" -) - - -IND_EVENT_CONTRACT_RUNTIME = ( - "608060405260043610603f576000357c01000000000000000000000000000000000000000000000" - "00000000000900463ffffffff1680635818fad7146044575b600080fd5b348015604f57600080fd" - "5b50606c60048036038101908080359060200190929190505050606e565b005b807ff70fe689e29" - "0d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb1560405160405180910390a27f56" - "d2ef3c5228bf5d88573621e325a4672ab50e033749a601e4f4a5e1dce905d481604051808281526" - "0200191505060405180910390a1505600a165627a7a72305820afa2dc55cd3a55a914793a583c32" - "84fc5f8dc8ebec94e6ec7fe1ad6d604daf350029" -) - - -IND_EVENT_CONTRACT_ABI = [ - { - "constant": False, - "inputs": [{"name": "arg0", "type": "uint256"}], - "name": "logTwoEvents", - "outputs": [], - "payable": False, - "stateMutability": "nonpayable", - "type": "function", - }, - { - "anonymous": False, - "inputs": [{"indexed": True, "name": "arg0", "type": "uint256"}], - "name": "LogSingleWithIndex", - "type": "event", - }, - { - "anonymous": False, - "inputs": [{"indexed": False, "name": "arg0", "type": "uint256"}], - "name": "LogSingleArg", - "type": "event", - }, -] diff --git a/web3/_utils/module_testing/math_contract.py b/web3/_utils/module_testing/math_contract.py deleted file mode 100644 index 0f3c428f61..0000000000 --- a/web3/_utils/module_testing/math_contract.py +++ /dev/null @@ -1,192 +0,0 @@ -MATH_BYTECODE = ( - "606060405261022e806100126000396000f360606040523615610074576000357c01000000000000" - "000000000000000000000000000000000000000000009004806316216f391461007657806361bc22" - "1a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d5780" - "63dcf537b11461014057610074565b005b610083600480505061016c565b60405180828152602001" - "91505060405180910390f35b6100a6600480505061017f565b604051808281526020019150506040" - "5180910390f35b6100d26004808035906020019091905050610188565b6040518082815260200191" - "505060405180910390f35b61010760048080359060200190919080359060200190919050506101ea" - "565b6040518082815260200191505060405180910390f35b61012a6004805050610201565b604051" - "8082815260200191505060405180910390f35b610156600480803590602001909190505061021756" - "5b6040518082815260200191505060405180910390f35b6000600d9050805080905061017c565b90" - "565b60006000505481565b6000816000600082828250540192505081905550600060005054905080" - "507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5816040518082" - "815260200191505060405180910390a18090506101e5565b919050565b6000818301905080508090" - "506101fb565b92915050565b600061020d6001610188565b9050610214565b90565b600060078202" - "90508050809050610229565b91905056" -) - - -MATH_ABI = [ - { - "constant": False, - "inputs": [], - "name": "return13", - "outputs": [ - {"name": "result", "type": "int256"}, - ], - "type": "function", - }, - { - "constant": True, - "inputs": [], - "name": "counter", - "outputs": [ - {"name": "", "type": "uint256"}, - ], - "type": "function", - }, - { - "constant": False, - "inputs": [ - {"name": "amt", "type": "uint256"}, - ], - "name": "increment", - "outputs": [ - {"name": "result", "type": "uint256"}, - ], - "type": "function", - }, - { - "constant": False, - "inputs": [ - {"name": "a", "type": "int256"}, - {"name": "b", "type": "int256"}, - ], - "name": "add", - "outputs": [ - {"name": "result", "type": "int256"}, - ], - "type": "function", - }, - { - "constant": False, - "inputs": [], - "name": "increment", - "outputs": [ - {"name": "", "type": "uint256"}, - ], - "type": "function", - }, - { - "constant": False, - "inputs": [ - {"name": "a", "type": "int256"}, - ], - "name": "multiply7", - "outputs": [ - {"name": "result", "type": "int256"}, - ], - "type": "function", - }, - { - "anonymous": False, - "inputs": [ - {"indexed": False, "name": "value", "type": "uint256"}, - ], - "name": "Increased", - "type": "event", - }, -] - -# The de-compiled math contract, for reference: -""" -contract Contract { - function main() { - memory[0x40:0x60] = 0x60; - - if (!msg.data.length) { stop(); } - - var var0 = - msg.data[0x00:0x20] / 0x0100000000000000000000000000000000000000000000000000000000; # noqa: E501 - - if (var0 == 0x16216f39) { - // Dispatch table entry for return13() - var var1 = 0x0083; - var1 = return13(); - var temp0 = memory[0x40:0x60]; - memory[temp0:temp0 + 0x20] = var1; - var temp1 = memory[0x40:0x60]; - return memory[temp1:temp1 + (temp0 + 0x20) - temp1]; - } else if (var0 == 0x61bc221a) { - // Dispatch table entry for counter() - var1 = 0x00a6; - var var2 = counter(); - var temp2 = memory[0x40:0x60]; - memory[temp2:temp2 + 0x20] = var2; - var temp3 = memory[0x40:0x60]; - return memory[temp3:temp3 + (temp2 + 0x20) - temp3]; - } else if (var0 == 0x7cf5dab0) { - // Dispatch table entry for increment(uint256) - var1 = 0x00d2; - var2 = msg.data[0x04:0x24]; - var1 = increment(var2); - var temp4 = memory[0x40:0x60]; - memory[temp4:temp4 + 0x20] = var1; - var temp5 = memory[0x40:0x60]; - return memory[temp5:temp5 + (temp4 + 0x20) - temp5]; - } else if (var0 == 0xa5f3c23b) { - // Dispatch table entry for add(int256,int256) - var1 = 0x0107; - var2 = msg.data[0x04:0x24]; - var var3 = msg.data[0x24:0x44]; - var1 = add(var2, var3); - var temp6 = memory[0x40:0x60]; - memory[temp6:temp6 + 0x20] = var1; - var temp7 = memory[0x40:0x60]; - return memory[temp7:temp7 + (temp6 + 0x20) - temp7]; - } else if (var0 == 0xd09de08a) { - // Dispatch table entry for increment() - var1 = 0x012a; - var1 = increment(); - var temp8 = memory[0x40:0x60]; - memory[temp8:temp8 + 0x20] = var1; - var temp9 = memory[0x40:0x60]; - return memory[temp9:temp9 + (temp8 + 0x20) - temp9]; - } else if (var0 == 0xdcf537b1) { - // Dispatch table entry for multiply7(int256) - var1 = 0x0156; - var2 = msg.data[0x04:0x24]; - var1 = multiply7(var2); - var temp10 = memory[0x40:0x60]; - memory[temp10:temp10 + 0x20] = var1; - var temp11 = memory[0x40:0x60]; - return memory[temp11:temp11 + (temp10 + 0x20) - temp11]; - } else { stop(); } - } - - function return13() returns (var r0) { - var var0 = 0x0d; - return var0; - } - - function counter() returns (var r0) { return storage[0x00]; } - - function increment(var arg0) returns (var r0) { - storage[0x00] = storage[0x00] + arg0; - var temp0 = memory[0x40:0x60]; - memory[temp0:temp0 + 0x20] = storage[0x00]; - var temp1 = memory[0x40:0x60]; - log(memory[temp1:temp1 + (temp0 + 0x20) - temp1], - [0x3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5]); - var var0 = storage[0x00]; - return var0;} - - function add(var arg0, var arg1) returns (var r0) { - var var0 = arg0 + arg1; - return var0; - } - - function increment() returns (var r0) { - var var0 = 0x00; - var var1 = 0x020d; - var var2 = 0x01; - return increment(var2); - } - - function multiply7(var arg0) returns (var r0) { - var var0 = arg0 * 0x07; - return var0; - } -} -""" diff --git a/web3/_utils/module_testing/no_receive_contract.py b/web3/_utils/module_testing/no_receive_contract.py deleted file mode 100644 index 2afeb62353..0000000000 --- a/web3/_utils/module_testing/no_receive_contract.py +++ /dev/null @@ -1,69 +0,0 @@ -CONTRACT_NO_RECEIVE_SOURCE_CODE = """ -pragma solidity ^0.6.0; - - -contract Receive { - string text; - - fallback() external { - text = 'fallback'; - } - - function getText() public view returns (string memory) { - return text; - } - - function setText(string memory new_text) public returns (string memory) { - return text = new_text; - } -} - -""" - - -CONTRACT_NO_RECEIVE_FUNCTION_ABI = """ -[ - { - "stateMutability": "nonpayable", - "type": "fallback" - }, - { - "inputs": [], - "name": "getText", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "new_text", - "type": "string" - } - ], - "name": "setText", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } -] -""" - - -CONTRACT_NO_RECEIVE_FUNCTION_CODE = "608060405234801561001057600080fd5b50610396806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80635d3a1f9d14610068578063e00fe2eb14610183575b6040805180820190915260088082526766616c6c6261636b60c01b6020909201918252610065916000916102c8565b50005b61010e6004803603602081101561007e57600080fd5b81019060208101813564010000000081111561009957600080fd5b8201836020820111156100ab57600080fd5b803590602001918460018302840111640100000000831117156100cd57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061018b945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610148578181015183820152602001610130565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010e610231565b80516060906101a19060009060208501906102c8565b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102255780601f106101fa57610100808354040283529160200191610225565b820191906000526020600020905b81548152906001019060200180831161020857829003601f168201915b50505050509050919050565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156102bd5780601f10610292576101008083540402835291602001916102bd565b820191906000526020600020905b8154815290600101906020018083116102a057829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061030957805160ff1916838001178555610336565b82800160010185558215610336579182015b8281111561033657825182559160200191906001019061031b565b50610342929150610346565b5090565b6102c591905b80821115610342576000815560010161034c56fea26469706673582212208c33db8b08eb0abda95d96bba0df24cf6356f47eb17c4f556a3427dc161852db64736f6c63430006010033" # noqa: E501 - - -CONTRACT_NO_RECEIVE_FUNCTION_RUNTIME = "608060405234801561001057600080fd5b50600436106100365760003560e01c80635d3a1f9d14610068578063e00fe2eb14610183575b6040805180820190915260088082526766616c6c6261636b60c01b6020909201918252610065916000916102c8565b50005b61010e6004803603602081101561007e57600080fd5b81019060208101813564010000000081111561009957600080fd5b8201836020820111156100ab57600080fd5b803590602001918460018302840111640100000000831117156100cd57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061018b945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610148578181015183820152602001610130565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010e610231565b80516060906101a19060009060208501906102c8565b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102255780601f106101fa57610100808354040283529160200191610225565b820191906000526020600020905b81548152906001019060200180831161020857829003601f168201915b50505050509050919050565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156102bd5780601f10610292576101008083540402835291602001916102bd565b820191906000526020600020905b8154815290600101906020018083116102a057829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061030957805160ff1916838001178555610336565b82800160010185558215610336579182015b8281111561033657825182559160200191906001019061031b565b50610342929150610346565b5090565b6102c591905b80821115610342576000815560010161034c56fea26469706673582212208c33db8b08eb0abda95d96bba0df24cf6356f47eb17c4f556a3427dc161852db64736f6c63430006010033" # noqa: E501 diff --git a/web3/_utils/module_testing/offchain_lookup_contract.py b/web3/_utils/module_testing/offchain_lookup_contract.py deleted file mode 100644 index 7f7e1f35e7..0000000000 --- a/web3/_utils/module_testing/offchain_lookup_contract.py +++ /dev/null @@ -1,106 +0,0 @@ -import json - -# contract source at .contract_sources/OffchainLookup.sol -OFFCHAIN_LOOKUP_BYTECODE = "608060405260405180604001604052806040518060600160405280602c815260200162000ec9602c9139815260200160405180606001604052806025815260200162000ef56025913981525060009060026200005d92919062000072565b503480156200006b57600080fd5b506200025b565b828054828255906000526020600020908101928215620000c6579160200282015b82811115620000c5578251829080519060200190620000b4929190620000d9565b509160200191906001019062000093565b5b509050620000d591906200016a565b5090565b828054620000e79062000226565b90600052602060002090601f0160209004810192826200010b576000855562000157565b82601f106200012657805160ff191683800117855562000157565b8280016001018555821562000157579182015b828111156200015657825182559160200191906001019062000139565b5b50905062000166919062000192565b5090565b5b808211156200018e5760008181620001849190620001b1565b506001016200016b565b5090565b5b80821115620001ad57600081600090555060010162000193565b5090565b508054620001bf9062000226565b6000825580601f10620001d35750620001f4565b601f016020900490600052602060002090810190620001f3919062000192565b5b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200023f57607f821691505b602082108103620002555762000254620001f7565b5b50919050565b610c5e806200026b6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806309a3c01b146100465780636337ed5814610064578063da96d05a14610094575b600080fd5b61004e6100c4565b60405161005b9190610424565b60405180910390f35b61007e600480360381019061007991906104bf565b610114565b60405161008b9190610424565b60405180910390f35b6100ae60048036038101906100a9919061050c565b610202565b6040516100bb9190610424565b60405180910390f35b606080306000826309a3c01b60e01b846040517f556f183000000000000000000000000000000000000000000000000000000000815260040161010b9594939291906107d5565b60405180910390fd5b606060008383810190610127919061096d565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af0758160405160200161015b91906109fd565b60405160208183030381529060405280519060200120146101b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a890610a71565b60405180910390fd5b306000858563da96d05a60e01b88886040517f556f18300000000000000000000000000000000000000000000000000000000081526004016101f99796959493929190610abe565b60405180910390fd5b606060008585810190610215919061096d565b90507faed76f463930323372899e36460e078e5292aac45f645bbe567be6fca83ede108160405160200161024991906109fd565b604051602081830303815290604052805190602001201461029f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029690610b9c565b60405180910390fd5b600084848101906102b0919061096d565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af075816040516020016102e491906109fd565b604051602081830303815290604052805190602001201461033a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033190610c08565b60405180910390fd5b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092505050949350505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103c55780820151818401526020810190506103aa565b838111156103d4576000848401525b50505050565b6000601f19601f8301169050919050565b60006103f68261038b565b6104008185610396565b93506104108185602086016103a7565b610419816103da565b840191505092915050565b6000602082019050818103600083015261043e81846103eb565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261047f5761047e61045a565b5b8235905067ffffffffffffffff81111561049c5761049b61045f565b5b6020830191508360018202830111156104b8576104b7610464565b5b9250929050565b600080602083850312156104d6576104d5610450565b5b600083013567ffffffffffffffff8111156104f4576104f3610455565b5b61050085828601610469565b92509250509250929050565b6000806000806040858703121561052657610525610450565b5b600085013567ffffffffffffffff81111561054457610543610455565b5b61055087828801610469565b9450945050602085013567ffffffffffffffff81111561057357610572610455565b5b61057f87828801610469565b925092505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105b88261058d565b9050919050565b6105c8816105ad565b82525050565b600081549050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061064657607f821691505b602082108103610659576106586105ff565b5b50919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b600081546106928161062e565b61069c818661065f565b945060018216600081146106b757600181146106c9576106fc565b60ff19831686526020860193506106fc565b6106d285610670565b60005b838110156106f4578154818901526001820191506020810190506106d5565b808801955050505b50505092915050565b60006107118383610685565b905092915050565b6000600182019050919050565b6000610731826105ce565b61073b81856105d9565b93508360208202850161074d856105ea565b8060005b85811015610788578484038952816107698582610705565b945061077483610719565b925060208a01995050600181019050610751565b50829750879550505050505092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6107cf8161079a565b82525050565b600060a0820190506107ea60008301886105bf565b81810360208301526107fc8187610726565b9050818103604083015261081081866103eb565b905061081f60608301856107c6565b818103608083015261083181846103eb565b90509695505050505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61087a826103da565b810181811067ffffffffffffffff8211171561089957610898610842565b5b80604052505050565b60006108ac610446565b90506108b88282610871565b919050565b600067ffffffffffffffff8211156108d8576108d7610842565b5b6108e1826103da565b9050602081019050919050565b82818337600083830152505050565b600061091061090b846108bd565b6108a2565b90508281526020810184848401111561092c5761092b61083d565b5b6109378482856108ee565b509392505050565b600082601f8301126109545761095361045a565b5b81356109648482602086016108fd565b91505092915050565b60006020828403121561098357610982610450565b5b600082013567ffffffffffffffff8111156109a1576109a0610455565b5b6109ad8482850161093f565b91505092915050565b600081519050919050565b600081905092915050565b60006109d7826109b6565b6109e181856109c1565b93506109f18185602086016103a7565b80840191505092915050565b6000610a0982846109cc565b915081905092915050565b600082825260208201905092915050565b7f7465737420646174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610a5b601c83610a14565b9150610a6682610a25565b602082019050919050565b60006020820190508181036000830152610a8a81610a4e565b9050919050565b6000610a9d8385610396565b9350610aaa8385846108ee565b610ab3836103da565b840190509392505050565b600060a082019050610ad3600083018a6105bf565b8181036020830152610ae58189610726565b90508181036040830152610afa818789610a91565b9050610b0960608301866107c6565b8181036080830152610b1c818486610a91565b905098975050505050505050565b7f68747470207265717565737420726573756c742076616c69646174696f6e206660008201527f61696c65642e0000000000000000000000000000000000000000000000000000602082015250565b6000610b86602683610a14565b9150610b9182610b2a565b604082019050919050565b60006020820190508181036000830152610bb581610b79565b9050919050565b7f6578747261446174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610bf2601c83610a14565b9150610bfd82610bbc565b602082019050919050565b60006020820190508181036000830152610c2181610be5565b905091905056fea2646970667358221220528c32029f8724a4e2b6a2a469880824c952eae5971f18628559629192c102b164736f6c634300080d003368747470733a2f2f776562332e70792f676174657761792f7b73656e6465727d2f7b646174617d2e6a736f6e68747470733a2f2f776562332e70792f676174657761792f7b73656e6465727d2e6a736f6e" # noqa: E501 -OFFCHAIN_LOOKUP_BYTECODE_RUNTIME = "608060405234801561001057600080fd5b50600436106100415760003560e01c806309a3c01b146100465780636337ed5814610064578063da96d05a14610094575b600080fd5b61004e6100c4565b60405161005b9190610424565b60405180910390f35b61007e600480360381019061007991906104bf565b610114565b60405161008b9190610424565b60405180910390f35b6100ae60048036038101906100a9919061050c565b610202565b6040516100bb9190610424565b60405180910390f35b606080306000826309a3c01b60e01b846040517f556f183000000000000000000000000000000000000000000000000000000000815260040161010b9594939291906107d5565b60405180910390fd5b606060008383810190610127919061096d565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af0758160405160200161015b91906109fd565b60405160208183030381529060405280519060200120146101b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a890610a71565b60405180910390fd5b306000858563da96d05a60e01b88886040517f556f18300000000000000000000000000000000000000000000000000000000081526004016101f99796959493929190610abe565b60405180910390fd5b606060008585810190610215919061096d565b90507faed76f463930323372899e36460e078e5292aac45f645bbe567be6fca83ede108160405160200161024991906109fd565b604051602081830303815290604052805190602001201461029f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029690610b9c565b60405180910390fd5b600084848101906102b0919061096d565b90507fd9bdd1345ca2a00d0c1413137c1b2b1d0a35e5b0e11508f3b3eff856286af075816040516020016102e491906109fd565b604051602081830303815290604052805190602001201461033a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033190610c08565b60405180910390fd5b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092505050949350505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103c55780820151818401526020810190506103aa565b838111156103d4576000848401525b50505050565b6000601f19601f8301169050919050565b60006103f68261038b565b6104008185610396565b93506104108185602086016103a7565b610419816103da565b840191505092915050565b6000602082019050818103600083015261043e81846103eb565b905092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261047f5761047e61045a565b5b8235905067ffffffffffffffff81111561049c5761049b61045f565b5b6020830191508360018202830111156104b8576104b7610464565b5b9250929050565b600080602083850312156104d6576104d5610450565b5b600083013567ffffffffffffffff8111156104f4576104f3610455565b5b61050085828601610469565b92509250509250929050565b6000806000806040858703121561052657610525610450565b5b600085013567ffffffffffffffff81111561054457610543610455565b5b61055087828801610469565b9450945050602085013567ffffffffffffffff81111561057357610572610455565b5b61057f87828801610469565b925092505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105b88261058d565b9050919050565b6105c8816105ad565b82525050565b600081549050919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061064657607f821691505b602082108103610659576106586105ff565b5b50919050565b600082825260208201905092915050565b60008190508160005260206000209050919050565b600081546106928161062e565b61069c818661065f565b945060018216600081146106b757600181146106c9576106fc565b60ff19831686526020860193506106fc565b6106d285610670565b60005b838110156106f4578154818901526001820191506020810190506106d5565b808801955050505b50505092915050565b60006107118383610685565b905092915050565b6000600182019050919050565b6000610731826105ce565b61073b81856105d9565b93508360208202850161074d856105ea565b8060005b85811015610788578484038952816107698582610705565b945061077483610719565b925060208a01995050600181019050610751565b50829750879550505050505092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6107cf8161079a565b82525050565b600060a0820190506107ea60008301886105bf565b81810360208301526107fc8187610726565b9050818103604083015261081081866103eb565b905061081f60608301856107c6565b818103608083015261083181846103eb565b90509695505050505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61087a826103da565b810181811067ffffffffffffffff8211171561089957610898610842565b5b80604052505050565b60006108ac610446565b90506108b88282610871565b919050565b600067ffffffffffffffff8211156108d8576108d7610842565b5b6108e1826103da565b9050602081019050919050565b82818337600083830152505050565b600061091061090b846108bd565b6108a2565b90508281526020810184848401111561092c5761092b61083d565b5b6109378482856108ee565b509392505050565b600082601f8301126109545761095361045a565b5b81356109648482602086016108fd565b91505092915050565b60006020828403121561098357610982610450565b5b600082013567ffffffffffffffff8111156109a1576109a0610455565b5b6109ad8482850161093f565b91505092915050565b600081519050919050565b600081905092915050565b60006109d7826109b6565b6109e181856109c1565b93506109f18185602086016103a7565b80840191505092915050565b6000610a0982846109cc565b915081905092915050565b600082825260208201905092915050565b7f7465737420646174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610a5b601c83610a14565b9150610a6682610a25565b602082019050919050565b60006020820190508181036000830152610a8a81610a4e565b9050919050565b6000610a9d8385610396565b9350610aaa8385846108ee565b610ab3836103da565b840190509392505050565b600060a082019050610ad3600083018a6105bf565b8181036020830152610ae58189610726565b90508181036040830152610afa818789610a91565b9050610b0960608301866107c6565b8181036080830152610b1c818486610a91565b905098975050505050505050565b7f68747470207265717565737420726573756c742076616c69646174696f6e206660008201527f61696c65642e0000000000000000000000000000000000000000000000000000602082015250565b6000610b86602683610a14565b9150610b9182610b2a565b604082019050919050565b60006020820190508181036000830152610bb581610b79565b9050919050565b7f6578747261446174612076616c69646174696f6e206661696c65642e00000000600082015250565b6000610bf2601c83610a14565b9150610bfd82610bbc565b602082019050919050565b60006020820190508181036000830152610c2181610be5565b905091905056fea2646970667358221220528c32029f8724a4e2b6a2a469880824c952eae5971f18628559629192c102b164736f6c634300080d0033" # noqa: E501 -OFFCHAIN_LOOKUP_ABI = json.loads( - """[ - { - "inputs": [ - { - "internalType": "address", - "name": "sender", "type": "address" - }, - { - "internalType": "string[]", - "name": "urls", - "type": "string[]" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes"}, - { - "internalType": "bytes4", - "name": "callbackFunction", - "type":"bytes4" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "name": "OffchainLookup", - "type": "error" - }, - { - "inputs": [], - "name": "continuousOffchainLookup", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type":"bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "testOffchainLookupData", - "outputs": [ - { - "internalType": "bytes", - "name": "", "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "specifiedDataFromTest", - "type": "bytes" - } - ], - "name": "testOffchainLookup", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "result", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "name": "testOffchainLookupWithProof", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } -]""" -) diff --git a/web3/_utils/module_testing/receive_contract.py b/web3/_utils/module_testing/receive_contract.py deleted file mode 100644 index fbc264b335..0000000000 --- a/web3/_utils/module_testing/receive_contract.py +++ /dev/null @@ -1,76 +0,0 @@ -CONTRACT_RECEIVE_FUNCTION_SOURCE = """ -pragma solidity ^0.6.0; - - -contract Receive { - string text; - - fallback() external payable { - text = 'fallback'; - } - - receive() external payable { - text = 'receive'; - } - - function getText() public view returns (string memory) { - return text; - } - - function setText(string memory new_text) public returns (string memory) { - return text = new_text; - } -} -""" - - -CONTRACT_RECEIVE_FUNCTION_ABI = """ -[ - { - "stateMutability": "payable", - "type": "fallback" - }, - { - "inputs": [], - "name": "getText", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "new_text", - "type": "string" - } - ], - "name": "setText", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] -""" - - -CONTRACT_RECEIVE_FUNCTION_CODE = "608060405234801561001057600080fd5b506103da806100206000396000f3fe60806040526004361061002d5760003560e01c80635d3a1f9d14610092578063e00fe2eb146101ba57610063565b3661006357604080518082019091526007808252667265636569766560c81b60209092019182526100609160009161030c565b50005b6040805180820190915260088082526766616c6c6261636b60c01b60209092019182526100609160009161030c565b34801561009e57600080fd5b50610145600480360360208110156100b557600080fd5b8101906020810181356401000000008111156100d057600080fd5b8201836020820111156100e257600080fd5b8035906020019184600183028401116401000000008311171561010457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506101cf945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017f578181015183820152602001610167565b50505050905090810190601f1680156101ac5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c657600080fd5b50610145610275565b80516060906101e590600090602085019061030c565b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102695780601f1061023e57610100808354040283529160200191610269565b820191906000526020600020905b81548152906001019060200180831161024c57829003601f168201915b50505050509050919050565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103015780601f106102d657610100808354040283529160200191610301565b820191906000526020600020905b8154815290600101906020018083116102e457829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061034d57805160ff191683800117855561037a565b8280016001018555821561037a579182015b8281111561037a57825182559160200191906001019061035f565b5061038692915061038a565b5090565b61030991905b80821115610386576000815560010161039056fea2646970667358221220b93632f6dd6614e84675a1453e32b49de37a5d658a6e73173705c5a7dffc0bdd64736f6c63430006010033" # noqa: E501 - - -CONTRACT_RECEIVE_FUNCTION_RUNTIME = "60806040526004361061002d5760003560e01c80635d3a1f9d14610092578063e00fe2eb146101ba57610063565b3661006357604080518082019091526007808252667265636569766560c81b60209092019182526100609160009161030c565b50005b6040805180820190915260088082526766616c6c6261636b60c01b60209092019182526100609160009161030c565b34801561009e57600080fd5b50610145600480360360208110156100b557600080fd5b8101906020810181356401000000008111156100d057600080fd5b8201836020820111156100e257600080fd5b8035906020019184600183028401116401000000008311171561010457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506101cf945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017f578181015183820152602001610167565b50505050905090810190601f1680156101ac5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c657600080fd5b50610145610275565b80516060906101e590600090602085019061030c565b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102695780601f1061023e57610100808354040283529160200191610269565b820191906000526020600020905b81548152906001019060200180831161024c57829003601f168201915b50505050509050919050565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103015780601f106102d657610100808354040283529160200191610301565b820191906000526020600020905b8154815290600101906020018083116102e457829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061034d57805160ff191683800117855561037a565b8280016001018555821561037a579182015b8281111561037a57825182559160200191906001019061035f565b5061038692915061038a565b5090565b61030991905b80821115610386576000815560010161039056fea2646970667358221220b93632f6dd6614e84675a1453e32b49de37a5d658a6e73173705c5a7dffc0bdd64736f6c63430006010033" # noqa: E501 diff --git a/web3/_utils/module_testing/revert_contract.py b/web3/_utils/module_testing/revert_contract.py deleted file mode 100644 index 3295d6375d..0000000000 --- a/web3/_utils/module_testing/revert_contract.py +++ /dev/null @@ -1,61 +0,0 @@ -import json - -REVERT_CONTRACT_SOURCE = """ -pragma solidity ^0.6.1; - -contract RevertContract { - function normalFunction() public pure returns (bool) { - return true; - } - - function revertWithMessage() public pure { - revert('Function has been reverted.'); - } - - function revertWithoutMessage() public pure { - revert(); - } -} -""" - - -REVERT_CONTRACT_BYTECODE = "608060405234801561001057600080fd5b50610123806100206000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c8063185c38a4146041578063c06a97cb146049578063d67e4b84146051575b600080fd5b60476071565b005b604f60df565b005b605760e4565b604051808215151515815260200191505060405180910390f35b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f46756e6374696f6e20686173206265656e2072657665727465642e000000000081525060200191505060405180910390fd5b600080fd5b6000600190509056fea264697066735822122062c811906544562ea796d11199e2d956938f2a76c2aa3053dc7ab2470d854c0a64736f6c63430006060033" # noqa: E501 - - -REVERT_CONTRACT_RUNTIME_CODE = "6080604052348015600f57600080fd5b5060043610603c5760003560e01c8063185c38a4146041578063c06a97cb146049578063d67e4b84146051575b600080fd5b60476071565b005b604f60df565b005b605760e4565b604051808215151515815260200191505060405180910390f35b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f46756e6374696f6e20686173206265656e2072657665727465642e000000000081525060200191505060405180910390fd5b600080fd5b6000600190509056fea264697066735822122062c811906544562ea796d11199e2d956938f2a76c2aa3053dc7ab2470d854c0a64736f6c63430006060033" # noqa: E501 - - -_REVERT_CONTRACT_ABI = json.loads( - """[ - { - "inputs": [], - "name": "normalFunction", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "revertWithMessage", - "outputs": [], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "revertWithoutMessage", - "outputs": [], - "payable": false, - "stateMutability": "pure", - "type": "function" - } -]""" -) From 95042055974f229d371b644497a96f376c6b3aed Mon Sep 17 00:00:00 2001 From: fselmo Date: Fri, 27 Jan 2023 12:30:05 -0700 Subject: [PATCH 3/5] Update documentation and add compiling script docs - Clean up contract compiler script --- docs/contributing.rst | 103 +++++++--- newsfragments/2797.internal.rst | 2 + .../contract_sources/compile_contracts.py | 185 ++++++++++++------ 3 files changed, 201 insertions(+), 89 deletions(-) create mode 100644 newsfragments/2797.internal.rst diff --git a/docs/contributing.rst b/docs/contributing.rst index c3c2235c99..583f5bb90d 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -195,18 +195,16 @@ Within the ``pytest`` scope, :file:`conftest.py` files are used for common code shared between modules that exist within the same directory as that particular :file:`conftest.py` file. -Unit Testing -^^^^^^^^^^^^ +Unit Testing and eth-tester Tests +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Unit tests are meant to test the logic of smaller chunks (or units) of the -codebase without having to be wired up to a client. Most of the time this -means testing selected methods on their own. They are meant to test the logic -of your code and make sure that you get expected outputs out of selected inputs. +Our unit tests are grouped together with tests against the ``eth-tester`` library, +using the ``py-evm`` library as a backend, via the ``EthereumTesterProvider``. -Our unit tests live under appropriately named child directories within the -``/tests`` directory. The core of the unit tests live under ``/tests/core``. -Do your best to follow the existing structure when choosing where to add -your unit test. +These tests live under appropriately named child directories within the +``/tests`` directory. The core of these tests live under ``/tests/core``. +Do your best to follow the existing structure when adding a test and make sure +that its location makes sense. Integration Testing ^^^^^^^^^^^^^^^^^^^ @@ -217,25 +215,80 @@ confused with pytest fixtures). These zip file fixtures, which also live in the ``/tests/integration`` directory, are configured to run the specific client we are testing against along with a genesis configuration that gives our tests some pre-determined useful objects (like unlocked, pre-loaded accounts) to be able to -interact with the client and run our tests. +interact with the client when we run our tests. -Though the setup lives in ``/tests/integration``, our integration module tests are -written across different files within ``/web3/_utils/module_testing``. The tests -are written there but run configurations exist across the different files within -``/tests/integration/``. The parent ``/integration`` directory houses some common -configuration shared across all client tests, whereas the ``/go_ethereum`` directory -houses common code to be shared among respective client tests. +The parent ``/integration`` directory houses some common configuration shared across +all client tests, whereas the ``/go_ethereum`` directory houses common code to be +shared across geth-specific provider tests. Though the setup run configurations exist +across the different files within ``/tests/integration``, our integration module tests +are written across different files within ``/web3/_utils/module_testing``. * :file:`common.py` files within the client directories contain code that is shared across all provider tests (http, ipc, and ws). This is mostly used to override tests that span across all providers. -* :file:`conftest.py` files within each of these directories contain mostly code that can - be *used* by all test files that exist within the same directory as the :file:`conftest.py` - file. This is mostly used to house pytest fixtures to be shared among our tests. Refer to - the `pytest documentation on fixtures`_ for more information. -* :file:`test_{client}_{provider}.py` (e.g. :file:`test_goethereum_http.py`) files are where - client-and-provider-specific test configurations exist. This is mostly used to override tests - specific to the provider type for the respective client. +* :file:`conftest.py` files within each of these directories contain mostly code that + can be *used* by all test files that exist within the same directory or subdirectories + of the :file:`conftest.py` file. This is mostly used to house pytest fixtures to be + shared among our tests. Refer to the `pytest documentation on fixtures`_ for more + information. +* ``test_{client}_{provider}.py`` files (e.g. :file:`test_goethereum_http.py`) are where + client-and-provider-specific test configurations exist. This is mostly used to + override tests specific to the provider type for the respective client. + + +Working With Test Contracts +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Contracts used for testing exist under ``web3/_utils/contract_sources``. These contracts +get compiled via the ``compile_contracts.py`` script in the same directory. To use +this script, simply pass the Solidity version to be used to compile the contracts as an +argument at the command line. + +Arguments for the script are: + -v or --version Solidity version to be used to compile the contracts. If + blank, the script uses the latest hard-coded version + specified within the script. + + -f or --filename If left blank, all .sol files will be compiled and the + respective contract data will be generated. Pass in a + specific ``.sol`` filename here to compile just one file. + + +To run the script, you will need the ``py-solc-x`` library for compiling the files +as well as ``black`` for linting. You can install those independently or install the +full ``[dev]`` package extra as shown below. + +.. code:: sh + + $ pip install "web3[dev]" + +The following example compiles all the contracts and generates their respective +contract data that is used across our test files for the test suites. This data gets +generated within the ``contract_data`` subdirectory within the ``contract_sources`` +folder. + +.. code-block:: bash + + $ cd ../web3.py/web3/_utils/contract_sources + $ python compile_contracts.py -v 0.8.17 + Compiling OffchainLookup + ... + ... + reformatted ... + +To compile and generate contract data for only one ``.sol`` file, specify using the +filename with the ``-f`` (or ``--filename``) argument flag. + +.. code-block:: bash + + $ cd ../web3.py/web3/_utils/contract_sources + $ python compile_contracts.py -v 0.8.17 -f OffchainLookup.sol + Compiling OffchainLookup.sol + reformatted ... + +If there is any contract data that not generated via the script but is is important to +pass on to the test suites, the ``_custom_data.py`` can be used to store that +information. Manual Testing @@ -246,7 +299,7 @@ you can install it from your development directory: .. code:: sh - $ pip install -e ../path/to/web3py + $ pip install -e ../path/to/web3py Documentation diff --git a/newsfragments/2797.internal.rst b/newsfragments/2797.internal.rst new file mode 100644 index 0000000000..49f7ef9223 --- /dev/null +++ b/newsfragments/2797.internal.rst @@ -0,0 +1,2 @@ +Re-compile all test contracts with latest Solidity version. Refactor test fixtures. Adds a script that compiles all test contracts to the same directory with selected Solidity version. + diff --git a/web3/_utils/contract_sources/compile_contracts.py b/web3/_utils/contract_sources/compile_contracts.py index ce72097d33..cd27a7ec4c 100644 --- a/web3/_utils/contract_sources/compile_contracts.py +++ b/web3/_utils/contract_sources/compile_contracts.py @@ -1,29 +1,85 @@ +""" +Arguments for the script are: + -v or --version Solidity version to be used to compile the contracts. If + blank, the script uses the latest hard-coded version + specified within the script. + + -f or --filename If left blank, all .sol files will be compiled and the + respective contract data will be generated. Pass in a + specific ``.sol`` filename here to compile just one file. + + +To run the script, you will need the ``py-solc-x`` library for compiling the files +as well as ``black`` for linting. You can install those independently or install the +full ``[dev]`` package extra as shown below. + +.. code:: sh + + $ pip install "web3[dev]" + +The following example compiles all the contracts and generates their respective +contract data that is used across our test files for the test suites. This data gets +generated within the ``contract_data`` subdirectory within the ``contract_sources`` +folder. + +.. code-block:: bash + + $ cd ../web3.py/web3/_utils/contract_sources + $ python compile_contracts.py -v 0.8.17 + Compiling OffchainLookup + ... + ... + reformatted ... + +To compile and generate contract data for only one ``.sol`` file, specify using the +filename with the ``-f`` (or ``--filename``) argument flag. + +.. code-block:: bash + + $ cd ../web3.py/web3/_utils/contract_sources + $ python compile_contracts.py -v 0.8.17 -f OffchainLookup.sol + Compiling OffchainLookup.sol + reformatted ... +""" + + +import argparse import os import re -import sys from typing import ( Any, ) import solcx -SOLIDITY_VERSION_REGEX = re.compile(r"\d*\.\d+") # 0.0.0 pattern -CONFIGURED_SOLIDITY_VERSION = "0.8.17" - -user_provided_version = sys.argv[-1] - -solidity_version = ( - user_provided_version - if SOLIDITY_VERSION_REGEX.match(user_provided_version) - else CONFIGURED_SOLIDITY_VERSION +arg_parser = argparse.ArgumentParser() +arg_parser.add_argument( + "-v", "--version", help="Solidity version for compiling contracts." +) +arg_parser.add_argument( + "-f", + "--filename", + help="(optional) The filename if only one file is to be compiled - " + "otherwise all .sol files will be compiled at once.", ) +user_args = arg_parser.parse_args() +CONFIGURED_SOLIDITY_VERSION = "0.8.17" +# establish Solidity version from user-provided arg or use hard-coded version +user_sol_version = user_args.version +solidity_version = user_sol_version if user_sol_version else CONFIGURED_SOLIDITY_VERSION solcx.install_solc(solidity_version) solcx.set_solc_version(solidity_version) -def compile_dot_sol_files(dot_sol_filename: str) -> dict[str, Any]: +# compile just the .sol file specified or all .sol files +all_dot_sol_files = [f for f in os.listdir(os.getcwd()) if f.endswith(".sol")] +user_filename = user_args.filename +files_to_compile = [user_filename] if user_filename else all_dot_sol_files + + +def _compile_dot_sol_files(dot_sol_filename: str) -> dict[str, Any]: compiled = solcx.compile_files( [f"./{dot_sol_filename}"], output_values=["abi", "bin", "bin-runtime"], @@ -31,7 +87,7 @@ def compile_dot_sol_files(dot_sol_filename: str) -> dict[str, Any]: return compiled -def get_compiled_contract_data( +def _get_compiled_contract_data( sol_file_output: dict[str, dict[str, str]], dot_sol_filename: str, contract_name: str = None, @@ -54,8 +110,9 @@ def get_compiled_contract_data( contracts_in_file = {} -for filename in os.listdir(os.getcwd()): - if ".sol" in filename: + +def compile_files(file_list: list[str]) -> None: + for filename in file_list: with open(os.path.join(os.getcwd(), filename), "r") as f: dot_sol_file = f.readlines() @@ -70,54 +127,54 @@ def get_compiled_contract_data( contracts_in_file[filename] = contract_names - -for dot_sol_filename in contracts_in_file.keys(): - filename_no_extension = dot_sol_filename.replace(".sol", "") - split_and_lowercase = [ - i.lower() for i in re.split(r"([A-Z][a-z]*)", filename_no_extension) if i - ] - python_filename = f"{'_'.join(split_and_lowercase)}.py" - python_file_path = os.path.join(os.getcwd(), "contract_data", python_filename) - - try: - # clean up existing files - os.remove(python_file_path) - except FileNotFoundError: - pass - - print(f"compiling {dot_sol_filename}") - compiled_dot_sol_data = compile_dot_sol_files(dot_sol_filename) - - with open(python_file_path, "w") as f: - f.write(f'"""\nGenerated by `{os.path.basename(__file__)}` script.\n') - f.write(f'Compiled with Solidity v{solidity_version}.\n"""\n\n') - - for c in contracts_in_file[dot_sol_filename]: - c_name_split_and_uppercase = [ - i.upper() for i in re.split(r"([A-Z0-9][a-z0-9]*)", c) if i - ] - contract_upper = "_".join(c_name_split_and_uppercase) - - c_data = get_compiled_contract_data( - compiled_dot_sol_data, dot_sol_filename, c - ) - - contract_source = ( - f"# source: web3/_utils/contract_sources/{dot_sol_filename}:{c}" - ) - if len(contract_source) > 88: - contract_source += " # noqa: E501" - - f.write(f"{contract_source}\n") - f.write(f'{contract_upper}_BYTECODE = "{c_data["bin"]}" # noqa: E501\n') - f.write( - f'{contract_upper}_RUNTIME = "{c_data["bin-runtime"]}" # noqa: E501\n' - ) - f.write(f"{contract_upper}_ABI = {c_data['abi']}\n") - f.write(contract_upper + "_DATA = {\n") - f.write(f' "bytecode": {contract_upper}_BYTECODE,\n') - f.write(f' "bytecode_runtime": {contract_upper}_RUNTIME,\n') - f.write(f' "abi": {contract_upper}_ABI,\n') - f.write("}\n\n\n") - + for dot_sol_filename in contracts_in_file.keys(): + filename_no_extension = dot_sol_filename.replace(".sol", "") + split_and_lowercase = [ + i.lower() for i in re.split(r"([A-Z][a-z]*)", filename_no_extension) if i + ] + python_filename = f"{'_'.join(split_and_lowercase)}.py" + python_file_path = os.path.join(os.getcwd(), "contract_data", python_filename) + try: + # clean up existing files + os.remove(python_file_path) + except FileNotFoundError: + pass + print(f"compiling {dot_sol_filename}") + compiled_dot_sol_data = _compile_dot_sol_files(dot_sol_filename) + with open(python_file_path, "w") as f: + f.write(f'"""\nGenerated by `{os.path.basename(__file__)}` script.\n') + f.write(f'Compiled with Solidity v{solidity_version}.\n"""\n\n') + + for c in contracts_in_file[dot_sol_filename]: + c_name_split_and_uppercase = [ + i.upper() for i in re.split(r"([A-Z0-9][a-z0-9]*)", c) if i + ] + contract_upper = "_".join(c_name_split_and_uppercase) + + c_data = _get_compiled_contract_data( + compiled_dot_sol_data, dot_sol_filename, c + ) + + contract_source = ( + f"# source: web3/_utils/contract_sources/{dot_sol_filename}:{c}" + ) + if len(contract_source) > 88: + contract_source += " # noqa: E501" + + f.write(f"{contract_source}\n") + f.write( + f'{contract_upper}_BYTECODE = "{c_data["bin"]}" # noqa: E501\n' + ) + f.write( + f'{contract_upper}_RUNTIME = "{c_data["bin-runtime"]}" # noqa: E501\n' + ) + f.write(f"{contract_upper}_ABI = {c_data['abi']}\n") + f.write(contract_upper + "_DATA = {\n") + f.write(f' "bytecode": {contract_upper}_BYTECODE,\n') + f.write(f' "bytecode_runtime": {contract_upper}_RUNTIME,\n') + f.write(f' "abi": {contract_upper}_ABI,\n') + f.write("}\n\n\n") + + +compile_files(files_to_compile) os.system(f"black {os.getcwd()}") From 932c7d60f0818df070e9ae735e65bf27a084c24a Mon Sep 17 00:00:00 2001 From: fselmo Date: Fri, 27 Jan 2023 15:06:23 -0700 Subject: [PATCH 4/5] Fix up grammar in docs --- docs/contributing.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index 583f5bb90d..71438543e3 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -219,9 +219,9 @@ interact with the client when we run our tests. The parent ``/integration`` directory houses some common configuration shared across all client tests, whereas the ``/go_ethereum`` directory houses common code to be -shared across geth-specific provider tests. Though the setup run configurations exist -across the different files within ``/tests/integration``, our integration module tests -are written across different files within ``/web3/_utils/module_testing``. +shared across geth-specific provider tests. Though the setup and run configurations +exist across the different files within ``/tests/integration``, our integration module +tests are written across different files within ``/web3/_utils/module_testing``. * :file:`common.py` files within the client directories contain code that is shared across all provider tests (http, ipc, and ws). This is mostly used to override tests that span @@ -255,8 +255,8 @@ Arguments for the script are: To run the script, you will need the ``py-solc-x`` library for compiling the files -as well as ``black`` for linting. You can install those independently or install the -full ``[dev]`` package extra as shown below. +as well as ``black`` for code formatting. You can install those independently or +install the full ``[dev]`` package extra as shown below. .. code:: sh @@ -286,8 +286,8 @@ filename with the ``-f`` (or ``--filename``) argument flag. Compiling OffchainLookup.sol reformatted ... -If there is any contract data that not generated via the script but is is important to -pass on to the test suites, the ``_custom_data.py`` can be used to store that +If there is any contract data that is not generated via the script but is is important +to pass on to the test suites, the ``_custom_data.py`` can be used to store that information. From e22444279fbdf83da32fbda9d96ff8a646a4e32e Mon Sep 17 00:00:00 2001 From: fselmo Date: Mon, 30 Jan 2023 14:19:53 -0700 Subject: [PATCH 5/5] Address comments on PR #2797 --- tests/core/contracts/conftest.py | 156 ++++++++--------- .../test_contract_ambiguous_functions.py | 6 +- .../test_contract_build_transaction.py | 10 +- .../contracts/test_contract_call_interface.py | 94 +++++----- .../test_contract_class_construction.py | 14 +- .../contracts/test_contract_constructor.py | 162 +++++++++--------- .../test_contract_constructor_encoding.py | 28 +-- .../contracts/test_contract_deployment.py | 52 +++--- tests/core/contracts/test_contract_init.py | 26 ++- .../test_contract_transact_interface.py | 2 - .../contracts/test_extracting_event_data.py | 10 +- .../test_extracting_event_data_old.py | 10 +- tests/core/contracts/test_offchain_lookup.py | 10 +- tests/core/contracts/utils.py | 12 +- tests/core/filtering/conftest.py | 12 +- .../filtering/test_contract_data_filters.py | 10 +- .../test_contract_on_event_filtering.py | 40 ++--- .../test_contract_past_event_filtering.py | 16 +- .../filtering/test_contract_topic_filters.py | 8 +- .../test_filters_against_many_blocks.py | 14 +- tests/core/filtering/utils.py | 18 +- tests/ens/conftest.py | 2 +- 22 files changed, 348 insertions(+), 364 deletions(-) diff --git a/tests/core/contracts/conftest.py b/tests/core/contracts/conftest.py index f1c4fbe8c8..fd297e4c1d 100644 --- a/tests/core/contracts/conftest.py +++ b/tests/core/contracts/conftest.py @@ -68,42 +68,42 @@ def math_contract_abi(): @pytest.fixture -def math_contract_instance(w3): +def math_contract_factory(w3): return w3.eth.contract(**MATH_CONTRACT_DATA) @pytest.fixture -def math_contract(w3, math_contract_instance, address_conversion_func): - return deploy(w3, math_contract_instance, address_conversion_func) +def math_contract(w3, math_contract_factory, address_conversion_func): + return deploy(w3, math_contract_factory, address_conversion_func) @pytest.fixture -def simple_constructor_contract_instance(w3): +def simple_constructor_contract_factory(w3): return w3.eth.contract(**SIMPLE_CONSTRUCTOR_CONTRACT_DATA) @pytest.fixture -def contract_with_constructor_args_instance(w3): +def contract_with_constructor_args_factory(w3): return w3.eth.contract(**CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA) @pytest.fixture -def non_strict_contract_with_constructor_args_instance(w3_non_strict_abi): +def non_strict_contract_with_constructor_args_factory(w3_non_strict_abi): return w3_non_strict_abi.eth.contract(**CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA) @pytest.fixture -def contract_with_constructor_address_instance(w3): +def contract_with_constructor_address_factory(w3): return w3.eth.contract(**CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA) @pytest.fixture def contract_with_constructor_address( - w3, contract_with_constructor_address_instance, address_conversion_func + w3, contract_with_constructor_address_factory, address_conversion_func ): return deploy( w3, - contract_with_constructor_address_instance, + contract_with_constructor_address_factory, address_conversion_func, args=["0xd3CdA913deB6f67967B99D67aCDFa1712C293601"], ) @@ -111,10 +111,10 @@ def contract_with_constructor_address( @pytest.fixture def address_reflector_contract(w3, address_conversion_func): - address_reflector_contract_instance = w3.eth.contract( + address_reflector_contract_factory = w3.eth.contract( **ADDRESS_REFLECTOR_CONTRACT_DATA ) - return deploy(w3, address_reflector_contract_instance, address_conversion_func) + return deploy(w3, address_reflector_contract_factory, address_conversion_func) @pytest.fixture(scope="session") @@ -123,14 +123,14 @@ def string_contract_data(): @pytest.fixture -def string_contract_instance(w3, string_contract_data): +def string_contract_factory(w3, string_contract_data): return w3.eth.contract(**STRING_CONTRACT_DATA) @pytest.fixture -def string_contract(w3, string_contract_instance, address_conversion_func): +def string_contract(w3, string_contract_factory, address_conversion_func): return deploy( - w3, string_contract_instance, address_conversion_func, args=["Caqalai"] + w3, string_contract_factory, address_conversion_func, args=["Caqalai"] ) @@ -138,12 +138,12 @@ def string_contract(w3, string_contract_instance, address_conversion_func): def non_strict_string_contract( w3_non_strict_abi, string_contract_data, address_conversion_func ): - _non_strict_string_contract_instance = w3_non_strict_abi.eth.contract( + _non_strict_string_contract_factory = w3_non_strict_abi.eth.contract( **string_contract_data ) return deploy( w3_non_strict_abi, - _non_strict_string_contract_instance, + _non_strict_string_contract_factory, address_conversion_func, args=["Caqalai"], ) @@ -157,21 +157,21 @@ def non_strict_emitter( wait_for_block, address_conversion_func, ): - non_strict_emitter_contract_instance = w3_non_strict_abi.eth.contract( + non_strict_emitter_contract_factory = w3_non_strict_abi.eth.contract( **emitter_contract_data ) w3 = w3_non_strict_abi wait_for_block(w3) - deploy_txn_hash = non_strict_emitter_contract_instance.constructor().transact( + deploy_txn_hash = non_strict_emitter_contract_factory.constructor().transact( {"gas": 10000000} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == non_strict_emitter_contract_instance.bytecode_runtime - emitter_contract = non_strict_emitter_contract_instance(address=contract_address) + assert bytecode == non_strict_emitter_contract_factory.bytecode_runtime + emitter_contract = non_strict_emitter_contract_factory(address=contract_address) assert emitter_contract.address == contract_address return emitter_contract @@ -185,16 +185,16 @@ def event_contract( ): wait_for_block(w3) - event_contract_instance = w3.eth.contract(**EVENT_CONTRACT_DATA) - deploy_txn_hash = event_contract_instance.constructor().transact( + event_contract_factory = w3.eth.contract(**EVENT_CONTRACT_DATA) + deploy_txn_hash = event_contract_factory.constructor().transact( {"from": w3.eth.coinbase, "gas": 1000000} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == event_contract_instance.bytecode_runtime - event_contract = event_contract_instance(address=contract_address) + assert bytecode == event_contract_factory.bytecode_runtime + event_contract = event_contract_factory(address=contract_address) assert event_contract.address == contract_address return event_contract @@ -205,16 +205,16 @@ def indexed_event_contract( ): wait_for_block(w3) - indexed_event_contract_instance = w3.eth.contract(**INDEXED_EVENT_CONTRACT_DATA) - deploy_txn_hash = indexed_event_contract_instance.constructor().transact( + indexed_event_contract_factory = w3.eth.contract(**INDEXED_EVENT_CONTRACT_DATA) + deploy_txn_hash = indexed_event_contract_factory.constructor().transact( {"from": w3.eth.coinbase, "gas": 1000000} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == indexed_event_contract_instance.bytecode_runtime - indexed_event_contract = indexed_event_contract_instance(address=contract_address) + assert bytecode == indexed_event_contract_factory.bytecode_runtime + indexed_event_contract = indexed_event_contract_factory(address=contract_address) assert indexed_event_contract.address == contract_address return indexed_event_contract @@ -229,10 +229,10 @@ def indexed_event_contract( @pytest.fixture def arrays_contract(w3, address_conversion_func): - arrays_contract_instance = w3.eth.contract(**ARRAYS_CONTRACT_DATA) + arrays_contract_factory = w3.eth.contract(**ARRAYS_CONTRACT_DATA) return deploy( w3, - arrays_contract_instance, + arrays_contract_factory, address_conversion_func, args=[BYTES32_ARRAY, BYTES1_ARRAY], ) @@ -240,12 +240,12 @@ def arrays_contract(w3, address_conversion_func): @pytest.fixture def non_strict_arrays_contract(w3_non_strict_abi, address_conversion_func): - non_strict_arrays_contract_instance = w3_non_strict_abi.eth.contract( + non_strict_arrays_contract_factory = w3_non_strict_abi.eth.contract( **ARRAYS_CONTRACT_DATA ) return deploy( w3_non_strict_abi, - non_strict_arrays_contract_instance, + non_strict_arrays_contract_factory, address_conversion_func, args=[BYTES32_ARRAY, BYTES1_ARRAY], ) @@ -253,8 +253,8 @@ def non_strict_arrays_contract(w3_non_strict_abi, address_conversion_func): @pytest.fixture def payable_tester_contract(w3, address_conversion_func): - payable_tester_contract_instance = w3.eth.contract(**PAYABLE_TESTER_CONTRACT_DATA) - return deploy(w3, payable_tester_contract_instance, address_conversion_func) + payable_tester_contract_factory = w3.eth.contract(**PAYABLE_TESTER_CONTRACT_DATA) + return deploy(w3, payable_tester_contract_factory, address_conversion_func) # no matter the function selector, this will return back the 32 bytes of data supplied @@ -296,48 +296,48 @@ def payable_tester_contract(w3, address_conversion_func): @pytest.fixture def fixed_reflector_contract(w3, address_conversion_func): - fixed_reflector_contract_instance = w3.eth.contract( + fixed_reflector_contract_factory = w3.eth.contract( abi=FIXED_REFLECTOR_CONTRACT_ABI, bytecode=FIXED_REFLECTOR_CONTRACT_BYTECODE ) - return deploy(w3, fixed_reflector_contract_instance, address_conversion_func) + return deploy(w3, fixed_reflector_contract_factory, address_conversion_func) @pytest.fixture def fallback_function_contract(w3, address_conversion_func): - fallback_function_contract_instance = w3.eth.contract( + fallback_function_contract_factory = w3.eth.contract( **FALLBACK_FUNCTION_CONTRACT_DATA ) - return deploy(w3, fallback_function_contract_instance, address_conversion_func) + return deploy(w3, fallback_function_contract_factory, address_conversion_func) @pytest.fixture def receive_function_contract(w3, address_conversion_func): - receive_function_contract_instance = w3.eth.contract( + receive_function_contract_factory = w3.eth.contract( **RECEIVE_FUNCTION_CONTRACT_DATA ) - return deploy(w3, receive_function_contract_instance, address_conversion_func) + return deploy(w3, receive_function_contract_factory, address_conversion_func) @pytest.fixture def no_receive_function_contract(w3, address_conversion_func): - no_receive_function_contract_instance = w3.eth.contract( + no_receive_function_contract_factory = w3.eth.contract( **NO_RECEIVE_FUNCTION_CONTRACT_DATA ) - return deploy(w3, no_receive_function_contract_instance, address_conversion_func) + return deploy(w3, no_receive_function_contract_factory, address_conversion_func) @pytest.fixture def contract_caller_tester_contract(w3, address_conversion_func): - contract_caller_tester_contract_instance = w3.eth.contract( + contract_caller_tester_contract_factory = w3.eth.contract( **CONTRACT_CALLER_TESTER_DATA ) - return deploy(w3, contract_caller_tester_contract_instance, address_conversion_func) + return deploy(w3, contract_caller_tester_contract_factory, address_conversion_func) @pytest.fixture def revert_contract(w3, address_conversion_func): - revert_contract_instance = w3.eth.contract(**REVERT_CONTRACT_DATA) - return deploy(w3, revert_contract_instance, address_conversion_func) + revert_contract_factory = w3.eth.contract(**REVERT_CONTRACT_DATA) + return deploy(w3, revert_contract_factory, address_conversion_func) @pytest.fixture @@ -389,38 +389,38 @@ def estimate_gas(request): @pytest.fixture -def async_math_contract_instance(async_w3): +def async_math_contract_factory(async_w3): return async_w3.eth.contract(**MATH_CONTRACT_DATA) @pytest_asyncio.fixture async def async_math_contract( - async_w3, async_math_contract_instance, address_conversion_func + async_w3, async_math_contract_factory, address_conversion_func ): return await async_deploy( - async_w3, async_math_contract_instance, address_conversion_func + async_w3, async_math_contract_factory, address_conversion_func ) @pytest.fixture -def async_simple_constructor_contract_instance(async_w3): +def async_simple_constructor_contract_factory(async_w3): return async_w3.eth.contract(**SIMPLE_CONSTRUCTOR_CONTRACT_DATA) @pytest.fixture -def async_constructor_with_args_contract_instance(async_w3): +def async_constructor_with_args_contract_factory(async_w3): return async_w3.eth.contract(**CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA) @pytest.fixture -def async_non_strict_constructor_with_args_contract_instance(async_w3_non_strict_abi): +def async_non_strict_constructor_with_args_contract_factory(async_w3_non_strict_abi): return async_w3_non_strict_abi.eth.contract( **CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_DATA ) @pytest.fixture -def async_constructor_with_address_arg_contract_instance(async_w3): +def async_constructor_with_address_arg_contract_factory(async_w3): return async_w3.eth.contract(**CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA) @@ -429,12 +429,12 @@ async def async_constructor_with_address_argument_contract( async_w3, address_conversion_func, ): - async_constructor_with_address_arg_instance = async_w3.eth.contract( + async_constructor_with_address_arg_factory = async_w3.eth.contract( **CONSTRUCTOR_WITH_ADDRESS_ARGUMENT_CONTRACT_DATA ) return await async_deploy( async_w3, - async_constructor_with_address_arg_instance, + async_constructor_with_address_arg_factory, address_conversion_func, args=["0xd3CdA913deB6f67967B99D67aCDFa1712C293601"], ) @@ -442,26 +442,26 @@ async def async_constructor_with_address_argument_contract( @pytest_asyncio.fixture async def async_address_reflector_contract(async_w3, address_conversion_func): - async_address_reflector_contract_instance = async_w3.eth.contract( + async_address_reflector_contract_factory = async_w3.eth.contract( **ADDRESS_REFLECTOR_CONTRACT_DATA, ) return await async_deploy( - async_w3, async_address_reflector_contract_instance, address_conversion_func + async_w3, async_address_reflector_contract_factory, address_conversion_func ) @pytest.fixture -def async_string_contract_instance(async_w3): +def async_string_contract_factory(async_w3): return async_w3.eth.contract(**STRING_CONTRACT_DATA) @pytest_asyncio.fixture async def async_string_contract( - async_w3, async_string_contract_instance, address_conversion_func + async_w3, async_string_contract_factory, address_conversion_func ): return await async_deploy( async_w3, - async_string_contract_instance, + async_string_contract_factory, address_conversion_func, args=["Caqalai"], ) @@ -469,10 +469,10 @@ async def async_string_contract( @pytest_asyncio.fixture async def async_arrays_contract(async_w3, address_conversion_func): - async_arrays_contract_instance = async_w3.eth.contract(**ARRAYS_CONTRACT_DATA) + async_arrays_contract_factory = async_w3.eth.contract(**ARRAYS_CONTRACT_DATA) return await async_deploy( async_w3, - async_arrays_contract_instance, + async_arrays_contract_factory, address_conversion_func, args=[BYTES32_ARRAY, BYTES1_ARRAY], ) @@ -482,12 +482,12 @@ async def async_arrays_contract(async_w3, address_conversion_func): async def async_non_strict_arrays_contract( async_w3_non_strict_abi, address_conversion_func ): - async_non_strict_arrays_contract_instance = async_w3_non_strict_abi.eth.contract( + async_non_strict_arrays_contract_factory = async_w3_non_strict_abi.eth.contract( **ARRAYS_CONTRACT_DATA, ) return await async_deploy( async_w3_non_strict_abi, - async_non_strict_arrays_contract_instance, + async_non_strict_arrays_contract_factory, address_conversion_func, args=[BYTES32_ARRAY, BYTES1_ARRAY], ) @@ -495,71 +495,71 @@ async def async_non_strict_arrays_contract( @pytest_asyncio.fixture async def async_payable_tester_contract(async_w3, address_conversion_func): - async_payable_tester_contract_instance = async_w3.eth.contract( + async_payable_tester_contract_factory = async_w3.eth.contract( **PAYABLE_TESTER_CONTRACT_DATA ) return await async_deploy( - async_w3, async_payable_tester_contract_instance, address_conversion_func + async_w3, async_payable_tester_contract_factory, address_conversion_func ) @pytest_asyncio.fixture async def async_fixed_reflector_contract(async_w3, address_conversion_func): - async_fixed_reflector_contract_instance = async_w3.eth.contract( + async_fixed_reflector_contract_factory = async_w3.eth.contract( abi=FIXED_REFLECTOR_CONTRACT_ABI, bytecode=FIXED_REFLECTOR_CONTRACT_BYTECODE ) return await async_deploy( - async_w3, async_fixed_reflector_contract_instance, address_conversion_func + async_w3, async_fixed_reflector_contract_factory, address_conversion_func ) @pytest_asyncio.fixture async def async_fallback_function_contract(async_w3, address_conversion_func): - async_fallback_function_contract_instance = async_w3.eth.contract( + async_fallback_function_contract_factory = async_w3.eth.contract( **FALLBACK_FUNCTION_CONTRACT_DATA ) return await async_deploy( - async_w3, async_fallback_function_contract_instance, address_conversion_func + async_w3, async_fallback_function_contract_factory, address_conversion_func ) @pytest_asyncio.fixture async def async_no_receive_function_contract(async_w3, address_conversion_func): - async_no_receive_function_contract_instance = async_w3.eth.contract( + async_no_receive_function_contract_factory = async_w3.eth.contract( **NO_RECEIVE_FUNCTION_CONTRACT_DATA ) return await async_deploy( - async_w3, async_no_receive_function_contract_instance, address_conversion_func + async_w3, async_no_receive_function_contract_factory, address_conversion_func ) @pytest_asyncio.fixture async def async_receive_function_contract(async_w3, address_conversion_func): - async_receive_function_contract_instance = async_w3.eth.contract( + async_receive_function_contract_factory = async_w3.eth.contract( **RECEIVE_FUNCTION_CONTRACT_DATA ) return await async_deploy( - async_w3, async_receive_function_contract_instance, address_conversion_func + async_w3, async_receive_function_contract_factory, address_conversion_func ) @pytest_asyncio.fixture async def async_contract_caller_tester_contract(async_w3, address_conversion_func): - async_contract_caller_tester_contract_instance = async_w3.eth.contract( + async_contract_caller_tester_contract_factory = async_w3.eth.contract( **CONTRACT_CALLER_TESTER_DATA ) return await async_deploy( async_w3, - async_contract_caller_tester_contract_instance, + async_contract_caller_tester_contract_factory, address_conversion_func, ) @pytest_asyncio.fixture async def async_revert_contract(async_w3, address_conversion_func): - async_revert_contract_instance = async_w3.eth.contract(**REVERT_CONTRACT_DATA) + async_revert_contract_factory = async_w3.eth.contract(**REVERT_CONTRACT_DATA) return await async_deploy( - async_w3, async_revert_contract_instance, address_conversion_func + async_w3, async_revert_contract_factory, address_conversion_func ) diff --git a/tests/core/contracts/test_contract_ambiguous_functions.py b/tests/core/contracts/test_contract_ambiguous_functions.py index 14b5bf1feb..037d892a8c 100644 --- a/tests/core/contracts/test_contract_ambiguous_functions.py +++ b/tests/core/contracts/test_contract_ambiguous_functions.py @@ -46,12 +46,12 @@ @pytest.fixture -def string_contract(w3, string_contract_instance, address_conversion_func): - deploy_txn = string_contract_instance.constructor("Caqalai").transact() +def string_contract(w3, string_contract_factory, address_conversion_func): + deploy_txn = string_contract_factory.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None contract_address = address_conversion_func(deploy_receipt["contractAddress"]) - contract = string_contract_instance(address=contract_address) + contract = string_contract_factory(address=contract_address) assert contract.address == contract_address assert len(w3.eth.get_code(contract.address)) > 0 return contract diff --git a/tests/core/contracts/test_contract_build_transaction.py b/tests/core/contracts/test_contract_build_transaction.py index ad86a20b8b..754f5999d6 100644 --- a/tests/core/contracts/test_contract_build_transaction.py +++ b/tests/core/contracts/test_contract_build_transaction.py @@ -67,10 +67,10 @@ def test_build_transaction_with_contract_fallback_function( def test_build_transaction_with_contract_class_method( - w3, math_contract_instance, math_contract, build_transaction + w3, math_contract_factory, math_contract, build_transaction ): txn = build_transaction( - contract=math_contract_instance, + contract=math_contract_factory, contract_function="incrementCounter", tx_params={"to": math_contract.address}, ) @@ -326,12 +326,12 @@ async def test_async_build_transaction_with_contract_fallback_function( @pytest.mark.asyncio async def test_async_build_transaction_with_contract_class_method( async_w3, - async_math_contract_instance, + async_math_contract_factory, async_math_contract, async_build_transaction, ): txn = await async_build_transaction( - contract=async_math_contract_instance, + contract=async_math_contract_factory, contract_function="incrementCounter", tx_params={"to": async_math_contract.address}, ) @@ -403,7 +403,7 @@ async def test_async_build_transaction_with_contract_to_address_supplied_errors( contract=async_math_contract, contract_function="incrementCounter", tx_params={"to": "0xb2930B35844a230f00E51431aCAe96Fe543a0347"}, - ) # noqa: E501 + ) @pytest.mark.asyncio diff --git a/tests/core/contracts/test_contract_call_interface.py b/tests/core/contracts/test_contract_call_interface.py index ef2f785f09..4236d0766d 100644 --- a/tests/core/contracts/test_contract_call_interface.py +++ b/tests/core/contracts/test_contract_call_interface.py @@ -50,21 +50,21 @@ @pytest.fixture def tuple_contract(w3, address_conversion_func): - tuple_contract_instance = w3.eth.contract(**TUPLE_CONTRACT_DATA) - return deploy(w3, tuple_contract_instance, address_conversion_func) + tuple_contract_factory = w3.eth.contract(**TUPLE_CONTRACT_DATA) + return deploy(w3, tuple_contract_factory, address_conversion_func) @pytest.fixture def nested_tuple_contract(w3, address_conversion_func): - nested_tuple_contract_instance = w3.eth.contract(**NESTED_TUPLE_CONTRACT_DATA) - return deploy(w3, nested_tuple_contract_instance, address_conversion_func) + nested_tuple_contract_factory = w3.eth.contract(**NESTED_TUPLE_CONTRACT_DATA) + return deploy(w3, nested_tuple_contract_factory, address_conversion_func) @pytest.fixture(params=[b"\x04\x06", "0x0406"]) def bytes_contract(w3, request, address_conversion_func): - bytes_contract_instance = w3.eth.contract(**BYTES_CONTRACT_DATA) + bytes_contract_factory = w3.eth.contract(**BYTES_CONTRACT_DATA) return deploy( - w3, bytes_contract_instance, address_conversion_func, args=[request.param] + w3, bytes_contract_factory, address_conversion_func, args=[request.param] ) @@ -74,12 +74,12 @@ def non_strict_bytes_contract( request, address_conversion_func, ): - non_strict_bytes_contract_instance = w3_non_strict_abi.eth.contract( + non_strict_bytes_contract_factory = w3_non_strict_abi.eth.contract( **BYTES_CONTRACT_DATA ) return deploy( w3_non_strict_abi, - non_strict_bytes_contract_instance, + non_strict_bytes_contract_factory, address_conversion_func, args=[request.param], ) @@ -91,7 +91,7 @@ def call_transaction(): @pytest.fixture -def bytes32_contract_instance(w3): +def bytes32_contract_factory(w3): return w3.eth.contract(**BYTES32_CONTRACT_DATA) @@ -101,48 +101,48 @@ def bytes32_contract_instance(w3): HexBytes("0406040604060406040604060406040604060406040604060406040604060406"), ] ) -def bytes32_contract(w3, bytes32_contract_instance, request, address_conversion_func): +def bytes32_contract(w3, bytes32_contract_factory, request, address_conversion_func): return deploy( - w3, bytes32_contract_instance, address_conversion_func, args=[request.param] + w3, bytes32_contract_factory, address_conversion_func, args=[request.param] ) @pytest.fixture -def undeployed_math_contract(math_contract_instance, address_conversion_func): +def undeployed_math_contract(math_contract_factory, address_conversion_func): empty_address = address_conversion_func( "0x000000000000000000000000000000000000dEaD" ) - _undeployed_math_contract = math_contract_instance(address=empty_address) + _undeployed_math_contract = math_contract_factory(address=empty_address) return _undeployed_math_contract @pytest.fixture def mismatched_math_contract( - w3, string_contract_instance, math_contract_instance, address_conversion_func + w3, string_contract_factory, math_contract_factory, address_conversion_func ): - deploy_txn = string_contract_instance.constructor("Caqalai").transact() + deploy_txn = string_contract_factory.constructor("Caqalai").transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = address_conversion_func(deploy_receipt["contractAddress"]) - _mismatched_math_contract = math_contract_instance(address=address) + _mismatched_math_contract = math_contract_factory(address=address) return _mismatched_math_contract def test_deploy_raises_due_to_strict_byte_checking_by_default( - w3, bytes32_contract_instance, address_conversion_func + w3, bytes32_contract_factory, address_conversion_func ): with pytest.raises(TypeError): deploy( w3, - bytes32_contract_instance, + bytes32_contract_factory, address_conversion_func, args=["0406040604060406040604060406040604060406040604060406040604060406"], ) -def test_invalid_address_in_deploy_arg(contract_with_constructor_address_instance): +def test_invalid_address_in_deploy_arg(contract_with_constructor_address_factory): with pytest.raises(InvalidAddress): - contract_with_constructor_address_instance.constructor( + contract_with_constructor_address_factory.constructor( "0xd3cda913deb6f67967b99d67acdfa1712c293601", ).transact() @@ -304,14 +304,14 @@ def test_call_read_address_variable(contract_with_constructor_address, call): assert result == "0xd3CdA913deB6f67967B99D67aCDFa1712C293601" -def test_init_with_ens_name_arg(w3, contract_with_constructor_address_instance, call): +def test_init_with_ens_name_arg(w3, contract_with_constructor_address_factory, call): with contract_ens_addresses( - contract_with_constructor_address_instance, + contract_with_constructor_address_factory, [("arg-name.eth", "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413")], ): address_contract = deploy( w3, - contract_with_constructor_address_instance, + contract_with_constructor_address_factory, args=[ "arg-name.eth", ], @@ -1015,24 +1015,24 @@ def test_changing_default_block_identifier(w3, math_contract): @pytest_asyncio.fixture async def async_tuple_contract(async_w3, address_conversion_func): - async_tuple_contract_instance = async_w3.eth.contract(**TUPLE_CONTRACT_DATA) + async_tuple_contract_factory = async_w3.eth.contract(**TUPLE_CONTRACT_DATA) return await async_deploy( - async_w3, async_tuple_contract_instance, address_conversion_func + async_w3, async_tuple_contract_factory, address_conversion_func ) @pytest_asyncio.fixture async def async_nested_tuple_contract(async_w3, address_conversion_func): - async_nested_tuple_contract_instance = async_w3.eth.contract( + async_nested_tuple_contract_factory = async_w3.eth.contract( **NESTED_TUPLE_CONTRACT_DATA ) return await async_deploy( - async_w3, async_nested_tuple_contract_instance, address_conversion_func + async_w3, async_nested_tuple_contract_factory, address_conversion_func ) @pytest.fixture -def async_bytes_contract_instance(async_w3): +def async_bytes_contract_factory(async_w3): return async_w3.eth.contract(**BYTES_CONTRACT_DATA) @@ -1040,12 +1040,12 @@ def async_bytes_contract_instance(async_w3): async def async_bytes_contract( async_w3, request, - async_bytes_contract_instance, + async_bytes_contract_factory, address_conversion_func, ): return await async_deploy( async_w3, - async_bytes_contract_instance, + async_bytes_contract_factory, address_conversion_func, args=[request.param], ) @@ -1058,10 +1058,10 @@ async def async_bytes_contract( ], ) async def async_bytes32_contract(async_w3, request, address_conversion_func): - async_bytes32_contract_instance = async_w3.eth.contract(**BYTES32_CONTRACT_DATA) + async_bytes32_contract_factory = async_w3.eth.contract(**BYTES32_CONTRACT_DATA) return await async_deploy( async_w3, - async_bytes32_contract_instance, + async_bytes32_contract_factory, address_conversion_func, args=[request.param], ) @@ -1069,34 +1069,34 @@ async def async_bytes32_contract(async_w3, request, address_conversion_func): @pytest_asyncio.fixture async def async_undeployed_math_contract( - async_math_contract_instance, address_conversion_func + async_math_contract_factory, address_conversion_func ): empty_address = address_conversion_func( "0x000000000000000000000000000000000000dEaD" ) - _undeployed_math_contract = async_math_contract_instance(address=empty_address) + _undeployed_math_contract = async_math_contract_factory(address=empty_address) return _undeployed_math_contract @pytest_asyncio.fixture async def async_mismatched_math_contract( async_w3, - async_string_contract_instance, - async_math_contract_instance, + async_string_contract_factory, + async_math_contract_factory, address_conversion_func, ): - deploy_txn = await async_string_contract_instance.constructor("Caqalai").transact() + deploy_txn = await async_string_contract_factory.constructor("Caqalai").transact() deploy_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = address_conversion_func(deploy_receipt["contractAddress"]) - _mismatched_math_contract = async_math_contract_instance(address=address) + _mismatched_math_contract = async_math_contract_factory(address=address) return _mismatched_math_contract @pytest.fixture @pytest.mark.asyncio async def test_async_deploy_raises_due_to_strict_byte_checking_by_default( - async_w3, async_bytes_contract_instance, address_conversion_func + async_w3, async_bytes_contract_factory, address_conversion_func ): with pytest.raises( TypeError, @@ -1105,7 +1105,7 @@ async def test_async_deploy_raises_due_to_strict_byte_checking_by_default( ): await async_deploy( async_w3, - async_bytes_contract_instance, + async_bytes_contract_factory, address_conversion_func, args=["0406"], ) @@ -1118,12 +1118,12 @@ async def test_async_deploy_with_non_strict_abi_check( address_conversion_func, args, ): - async_non_strict_bytes_contract_instance = async_w3_non_strict_abi.eth.contract( + async_non_strict_bytes_contract_factory = async_w3_non_strict_abi.eth.contract( **BYTES_CONTRACT_DATA ) deployed_contract = await async_deploy( async_w3_non_strict_abi, - async_non_strict_bytes_contract_instance, + async_non_strict_bytes_contract_factory, address_conversion_func, args=[args], ) @@ -1133,10 +1133,10 @@ async def test_async_deploy_with_non_strict_abi_check( @pytest.mark.asyncio async def test_async_invalid_address_in_deploy_arg( - async_constructor_with_address_arg_contract_instance, + async_constructor_with_address_arg_contract_factory, ): with pytest.raises(InvalidAddress): - await async_constructor_with_address_arg_contract_instance.constructor( + await async_constructor_with_address_arg_contract_factory.constructor( "0xd3cda913deb6f67967b99d67acdfa1712c293601", ).transact() @@ -1308,15 +1308,15 @@ async def test_async_call_read_address_variable( @pytest.mark.xfail @pytest.mark.asyncio async def test_async_init_with_ens_name_arg( - async_w3, async_constructor_with_address_arg_contract_instance, async_call + async_w3, async_constructor_with_address_arg_contract_factory, async_call ): with contract_ens_addresses( - async_constructor_with_address_arg_contract_instance, + async_constructor_with_address_arg_contract_factory, [("arg-name.eth", "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413")], ): address_contract = await async_deploy( async_w3, - async_constructor_with_address_arg_contract_instance, + async_constructor_with_address_arg_contract_factory, args=[ "arg-name.eth", ], diff --git a/tests/core/contracts/test_contract_class_construction.py b/tests/core/contracts/test_contract_class_construction.py index 78d3cc0fe0..b0d0c296c1 100644 --- a/tests/core/contracts/test_contract_class_construction.py +++ b/tests/core/contracts/test_contract_class_construction.py @@ -16,15 +16,15 @@ def test_class_construction_sets_class_vars( w3, math_contract_abi, math_contract_bytecode, math_contract_runtime ): - math_contract_instance = w3.eth.contract( + math_contract_factory = w3.eth.contract( abi=math_contract_abi, bytecode=math_contract_bytecode, bytecode_runtime=math_contract_runtime, ) - assert math_contract_instance.w3 == w3 - assert math_contract_instance.bytecode == decode_hex(math_contract_bytecode) - assert math_contract_instance.bytecode_runtime == decode_hex(math_contract_runtime) + assert math_contract_factory.w3 == w3 + assert math_contract_factory.bytecode == decode_hex(math_contract_bytecode) + assert math_contract_factory.bytecode_runtime == decode_hex(math_contract_runtime) def test_error_to_instantiate_base_class(): @@ -35,10 +35,10 @@ def test_error_to_instantiate_base_class(): def test_abi_as_json_string(w3, math_contract_abi, some_address): abi_str = json.dumps(math_contract_abi) - math_contract_instance = w3.eth.contract(abi=abi_str) - assert math_contract_instance.abi == math_contract_abi + math_contract_factory = w3.eth.contract(abi=abi_str) + assert math_contract_factory.abi == math_contract_abi - math = math_contract_instance(some_address) + math = math_contract_factory(some_address) assert math.abi == math_contract_abi diff --git a/tests/core/contracts/test_contract_constructor.py b/tests/core/contracts/test_contract_constructor.py index cf4f2a48dc..7c66703926 100644 --- a/tests/core/contracts/test_contract_constructor.py +++ b/tests/core/contracts/test_contract_constructor.py @@ -19,28 +19,28 @@ def test_contract_constructor_abi_encoding_with_no_constructor_fn( - math_contract_instance, math_contract_bytecode + math_contract_factory, math_contract_bytecode ): - deploy_data = math_contract_instance.constructor()._encode_data_in_transaction() + deploy_data = math_contract_factory.constructor()._encode_data_in_transaction() assert deploy_data == math_contract_bytecode -def test_contract_constructor_gas_estimate_no_constructor(w3, math_contract_instance): - gas_estimate = math_contract_instance.constructor().estimate_gas() +def test_contract_constructor_gas_estimate_no_constructor(w3, math_contract_factory): + gas_estimate = math_contract_factory.constructor().estimate_gas() - deploy_txn = math_contract_instance.constructor().transact() + deploy_txn = math_contract_factory.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") assert abs(gas_estimate - gas_used) < 21000 -def test_contract_constructor_gas_estimate_with_block_id(w3, math_contract_instance): +def test_contract_constructor_gas_estimate_with_block_id(w3, math_contract_factory): block_identifier = None - gas_estimate = math_contract_instance.constructor().estimate_gas( + gas_estimate = math_contract_factory.constructor().estimate_gas( block_identifier=block_identifier ) - deploy_txn = math_contract_instance.constructor().transact() + deploy_txn = math_contract_factory.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -48,11 +48,11 @@ def test_contract_constructor_gas_estimate_with_block_id(w3, math_contract_insta def test_contract_constructor_gas_estimate_without_arguments( - w3, simple_constructor_contract_instance + w3, simple_constructor_contract_factory ): - gas_estimate = simple_constructor_contract_instance.constructor().estimate_gas() + gas_estimate = simple_constructor_contract_factory.constructor().estimate_gas() - deploy_txn = simple_constructor_contract_instance.constructor().transact() + deploy_txn = simple_constructor_contract_factory.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -70,15 +70,15 @@ def test_contract_constructor_gas_estimate_without_arguments( ) def test_contract_constructor_gas_estimate_with_arguments_non_strict( w3_non_strict_abi, - non_strict_contract_with_constructor_args_instance, + non_strict_contract_with_constructor_args_factory, constructor_args, constructor_kwargs, ): - gas_estimate = non_strict_contract_with_constructor_args_instance.constructor( + gas_estimate = non_strict_contract_with_constructor_args_factory.constructor( *constructor_args, **constructor_kwargs ).estimate_gas() - deploy_txn = non_strict_contract_with_constructor_args_instance.constructor( + deploy_txn = non_strict_contract_with_constructor_args_factory.constructor( *constructor_args, **constructor_kwargs ).transact() txn_receipt = w3_non_strict_abi.eth.wait_for_transaction_receipt(deploy_txn) @@ -88,13 +88,13 @@ def test_contract_constructor_gas_estimate_with_arguments_non_strict( def test_contract_constructor_gas_estimate_with_address_argument( - w3, contract_with_constructor_address_instance, address_conversion_func + w3, contract_with_constructor_address_factory, address_conversion_func ): - gas_estimate = contract_with_constructor_address_instance.constructor( + gas_estimate = contract_with_constructor_address_factory.constructor( address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") ).estimate_gas() - deploy_txn = contract_with_constructor_address_instance.constructor( + deploy_txn = contract_with_constructor_address_factory.constructor( address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") ).transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -104,9 +104,9 @@ def test_contract_constructor_gas_estimate_with_address_argument( def test_contract_constructor_transact_no_constructor( - w3, math_contract_instance, math_contract_runtime, address_conversion_func + w3, math_contract_factory, math_contract_runtime, address_conversion_func ): - deploy_txn = math_contract_instance.constructor().transact() + deploy_txn = math_contract_factory.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -120,10 +120,10 @@ def test_contract_constructor_transact_no_constructor( def test_contract_constructor_transact_without_arguments( w3, - simple_constructor_contract_instance, + simple_constructor_contract_factory, address_conversion_func, ): - deploy_txn = simple_constructor_contract_instance.constructor().transact() + deploy_txn = simple_constructor_contract_factory.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -146,14 +146,14 @@ def test_contract_constructor_transact_without_arguments( ) def test_contract_constructor_transact_with_arguments_non_strict( w3_non_strict_abi, - non_strict_contract_with_constructor_args_instance, + non_strict_contract_with_constructor_args_factory, constructor_args, constructor_kwargs, expected_a, expected_b, address_conversion_func, ): - deploy_txn = non_strict_contract_with_constructor_args_instance.constructor( + deploy_txn = non_strict_contract_with_constructor_args_factory.constructor( *constructor_args, **constructor_kwargs ).transact() @@ -167,13 +167,13 @@ def test_contract_constructor_transact_with_arguments_non_strict( assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) assert ( expected_a - == non_strict_contract_with_constructor_args_instance(address=contract_address) + == non_strict_contract_with_constructor_args_factory(address=contract_address) .functions.data_a() .call() ) assert ( expected_b - == non_strict_contract_with_constructor_args_instance(address=contract_address) + == non_strict_contract_with_constructor_args_factory(address=contract_address) .functions.data_b() .call() ) @@ -181,10 +181,10 @@ def test_contract_constructor_transact_with_arguments_non_strict( def test_contract_constructor_transact_with_address_argument( w3, - contract_with_constructor_address_instance, + contract_with_constructor_address_factory, address_conversion_func, ): - deploy_txn = contract_with_constructor_address_instance.constructor( + deploy_txn = contract_with_constructor_address_factory.constructor( TEST_ADDRESS ).transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -197,28 +197,26 @@ def test_contract_constructor_transact_with_address_argument( ) assert ( TEST_ADDRESS - == contract_with_constructor_address_instance(address=contract_address) + == contract_with_constructor_address_factory(address=contract_address) .functions.testAddr() .call() ) -def test_contract_constructor_build_transaction_to_field_error(math_contract_instance): +def test_contract_constructor_build_transaction_to_field_error(math_contract_factory): with pytest.raises(ValueError): - math_contract_instance.constructor().build_transaction({"to": "123"}) + math_contract_factory.constructor().build_transaction({"to": "123"}) def test_contract_constructor_build_transaction_no_constructor( - w3, math_contract_instance, address_conversion_func + w3, math_contract_factory, address_conversion_func ): - txn_hash = math_contract_instance.constructor().transact( + txn_hash = math_contract_factory.constructor().transact( {"from": address_conversion_func(w3.eth.accounts[0])} ) txn = w3.eth.get_transaction(txn_hash) nonce = w3.eth.get_transaction_count(w3.eth.coinbase) - unsent_txn = math_contract_instance.constructor().build_transaction( - {"nonce": nonce} - ) + unsent_txn = math_contract_factory.constructor().build_transaction({"nonce": nonce}) assert txn["data"] == unsent_txn["data"] new_txn_hash = w3.eth.send_transaction(unsent_txn) @@ -228,16 +226,14 @@ def test_contract_constructor_build_transaction_no_constructor( def test_contract_constructor_build_transaction_without_arguments( - w3, math_contract_instance, address_conversion_func + w3, math_contract_factory, address_conversion_func ): - txn_hash = math_contract_instance.constructor().transact( + txn_hash = math_contract_factory.constructor().transact( {"from": address_conversion_func(w3.eth.accounts[0])} ) txn = w3.eth.get_transaction(txn_hash) nonce = w3.eth.get_transaction_count(w3.eth.coinbase) - unsent_txn = math_contract_instance.constructor().build_transaction( - {"nonce": nonce} - ) + unsent_txn = math_contract_factory.constructor().build_transaction({"nonce": nonce}) assert txn["data"] == unsent_txn["data"] new_txn_hash = w3.eth.send_transaction(unsent_txn) @@ -257,17 +253,17 @@ def test_contract_constructor_build_transaction_without_arguments( ) def test_contract_constructor_build_transaction_with_arguments( w3_non_strict_abi, - non_strict_contract_with_constructor_args_instance, + non_strict_contract_with_constructor_args_factory, constructor_args, constructor_kwargs, address_conversion_func, ): - txn_hash = non_strict_contract_with_constructor_args_instance.constructor( + txn_hash = non_strict_contract_with_constructor_args_factory.constructor( *constructor_args, **constructor_kwargs ).transact({"from": address_conversion_func(w3_non_strict_abi.eth.accounts[0])}) txn = w3_non_strict_abi.eth.get_transaction(txn_hash) nonce = w3_non_strict_abi.eth.get_transaction_count(w3_non_strict_abi.eth.coinbase) - unsent_txn = non_strict_contract_with_constructor_args_instance.constructor( + unsent_txn = non_strict_contract_with_constructor_args_factory.constructor( *constructor_args, **constructor_kwargs ).build_transaction({"nonce": nonce}) assert txn["data"] == unsent_txn["data"] @@ -279,21 +275,21 @@ def test_contract_constructor_build_transaction_with_arguments( def test_async_contract_constructor_abi_encoding_with_no_constructor_fn( - async_math_contract_instance, math_contract_bytecode + async_math_contract_factory, math_contract_bytecode ): deploy_data = ( - async_math_contract_instance.constructor()._encode_data_in_transaction() + async_math_contract_factory.constructor()._encode_data_in_transaction() ) assert deploy_data == math_contract_bytecode @pytest.mark.asyncio async def test_async_contract_constructor_gas_estimate_no_constructor( - async_w3, async_math_contract_instance + async_w3, async_math_contract_factory ): - gas_estimate = await async_math_contract_instance.constructor().estimate_gas() + gas_estimate = await async_math_contract_factory.constructor().estimate_gas() - deploy_txn = await async_math_contract_instance.constructor().transact() + deploy_txn = await async_math_contract_factory.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -302,13 +298,13 @@ async def test_async_contract_constructor_gas_estimate_no_constructor( @pytest.mark.asyncio async def test_async_contract_constructor_gas_estimate_with_block_id( - async_w3, async_math_contract_instance + async_w3, async_math_contract_factory ): block_identifier = None - gas_estimate = await async_math_contract_instance.constructor().estimate_gas( + gas_estimate = await async_math_contract_factory.constructor().estimate_gas( block_identifier=block_identifier ) - deploy_txn = await async_math_contract_instance.constructor().transact() + deploy_txn = await async_math_contract_factory.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -317,14 +313,14 @@ async def test_async_contract_constructor_gas_estimate_with_block_id( @pytest.mark.asyncio async def test_async_contract_constructor_gas_estimate_without_arguments( - async_w3, async_simple_constructor_contract_instance + async_w3, async_simple_constructor_contract_factory ): gas_estimate = ( - await async_simple_constructor_contract_instance.constructor().estimate_gas() + await async_simple_constructor_contract_factory.constructor().estimate_gas() ) deploy_txn = ( - await async_simple_constructor_contract_instance.constructor().transact() + await async_simple_constructor_contract_factory.constructor().transact() ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) gas_used = txn_receipt.get("gasUsed") @@ -344,18 +340,18 @@ async def test_async_contract_constructor_gas_estimate_without_arguments( ) async def test_async_contract_constructor_gas_estimate_with_arguments_non_strict( async_w3_non_strict_abi, - async_non_strict_constructor_with_args_contract_instance, + async_non_strict_constructor_with_args_contract_factory, constructor_args, constructor_kwargs, ): gas_estimate = ( - await async_non_strict_constructor_with_args_contract_instance.constructor( + await async_non_strict_constructor_with_args_contract_factory.constructor( *constructor_args, **constructor_kwargs ).estimate_gas() ) deploy_txn = ( - await async_non_strict_constructor_with_args_contract_instance.constructor( + await async_non_strict_constructor_with_args_contract_factory.constructor( *constructor_args, **constructor_kwargs ).transact() ) @@ -370,16 +366,16 @@ async def test_async_contract_constructor_gas_estimate_with_arguments_non_strict @pytest.mark.asyncio async def test_async_contract_constructor_with_address_argument_gas_estimate( async_w3, - async_constructor_with_address_arg_contract_instance, + async_constructor_with_address_arg_contract_factory, address_conversion_func, ): gas_estimate = ( - await async_constructor_with_address_arg_contract_instance.constructor( + await async_constructor_with_address_arg_contract_factory.constructor( address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") ).estimate_gas() ) - deploy_txn = await async_constructor_with_address_arg_contract_instance.constructor( + deploy_txn = await async_constructor_with_address_arg_contract_factory.constructor( address_conversion_func("0x16D9983245De15E7A9A73bC586E01FF6E08dE737") ).transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -391,11 +387,11 @@ async def test_async_contract_constructor_with_address_argument_gas_estimate( @pytest.mark.asyncio async def test_async_contract_constructor_transact_no_constructor( async_w3, - async_math_contract_instance, + async_math_contract_factory, math_contract_runtime, address_conversion_func, ): - deploy_txn = await async_math_contract_instance.constructor().transact() + deploy_txn = await async_math_contract_factory.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -410,11 +406,11 @@ async def test_async_contract_constructor_transact_no_constructor( @pytest.mark.asyncio async def test_async_contract_constructor_transact_without_arguments( async_w3, - async_simple_constructor_contract_instance, + async_simple_constructor_contract_factory, address_conversion_func, ): deploy_txn = ( - await async_simple_constructor_contract_instance.constructor().transact() + await async_simple_constructor_contract_factory.constructor().transact() ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -439,7 +435,7 @@ async def test_async_contract_constructor_transact_without_arguments( ) async def test_async_contract_constructor_transact_with_arguments_non_strict( async_w3_non_strict_abi, - async_non_strict_constructor_with_args_contract_instance, + async_non_strict_constructor_with_args_contract_factory, constructor_args, constructor_kwargs, expected_a, @@ -447,7 +443,7 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( address_conversion_func, ): deploy_txn = ( - await async_non_strict_constructor_with_args_contract_instance.constructor( + await async_non_strict_constructor_with_args_contract_factory.constructor( *constructor_args, **constructor_kwargs ).transact() ) @@ -464,7 +460,7 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( assert blockchain_code == decode_hex(CONSTRUCTOR_WITH_ARGUMENTS_CONTRACT_RUNTIME) assert ( expected_a - == await async_non_strict_constructor_with_args_contract_instance( + == await async_non_strict_constructor_with_args_contract_factory( address=contract_address ) .functions.data_a() @@ -472,7 +468,7 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( ) assert ( expected_b - == await async_non_strict_constructor_with_args_contract_instance( + == await async_non_strict_constructor_with_args_contract_factory( address=contract_address ) .functions.data_b() @@ -483,10 +479,10 @@ async def test_async_contract_constructor_transact_with_arguments_non_strict( @pytest.mark.asyncio async def test_async_contract_constructor_transact_with_address_arguments( async_w3, - async_constructor_with_address_arg_contract_instance, + async_constructor_with_address_arg_contract_factory, address_conversion_func, ): - deploy_txn = await async_constructor_with_address_arg_contract_instance.constructor( + deploy_txn = await async_constructor_with_address_arg_contract_factory.constructor( TEST_ADDRESS ).transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -499,7 +495,7 @@ async def test_async_contract_constructor_transact_with_address_arguments( ) assert ( TEST_ADDRESS - == await async_constructor_with_address_arg_contract_instance( + == await async_constructor_with_address_arg_contract_factory( address=contract_address ) .functions.testAddr() @@ -509,26 +505,24 @@ async def test_async_contract_constructor_transact_with_address_arguments( @pytest.mark.asyncio async def test_async_contract_constructor_build_transaction_to_field_error( - async_math_contract_instance, + async_math_contract_factory, ): with pytest.raises(ValueError): - await async_math_contract_instance.constructor().build_transaction( - {"to": "123"} - ) + await async_math_contract_factory.constructor().build_transaction({"to": "123"}) @pytest.mark.asyncio async def test_async_contract_constructor_build_transaction_no_constructor( - async_w3, async_math_contract_instance, address_conversion_func + async_w3, async_math_contract_factory, address_conversion_func ): async_w3_accounts = await async_w3.eth.accounts - txn_hash = await async_math_contract_instance.constructor().transact( + txn_hash = await async_math_contract_factory.constructor().transact( {"from": address_conversion_func(async_w3_accounts[0])} ) txn = await async_w3.eth.get_transaction(txn_hash) async_w3_coinbase = await async_w3.eth.coinbase nonce = await async_w3.eth.get_transaction_count(async_w3_coinbase) - unsent_txn = await async_math_contract_instance.constructor().build_transaction( + unsent_txn = await async_math_contract_factory.constructor().build_transaction( {"nonce": nonce} ) assert txn["data"] == unsent_txn["data"] @@ -541,16 +535,16 @@ async def test_async_contract_constructor_build_transaction_no_constructor( @pytest.mark.asyncio async def test_async_contract_constructor_build_transaction_without_arguments( - async_w3, async_math_contract_instance, address_conversion_func + async_w3, async_math_contract_factory, address_conversion_func ): async_w3_accounts = await async_w3.eth.accounts - txn_hash = await async_math_contract_instance.constructor().transact( + txn_hash = await async_math_contract_factory.constructor().transact( {"from": address_conversion_func(async_w3_accounts[0])} ) txn = await async_w3.eth.get_transaction(txn_hash) async_w3_coinbase = await async_w3.eth.coinbase nonce = await async_w3.eth.get_transaction_count(async_w3_coinbase) - unsent_txn = await async_math_contract_instance.constructor().build_transaction( + unsent_txn = await async_math_contract_factory.constructor().build_transaction( {"nonce": nonce} ) assert txn["data"] == unsent_txn["data"] @@ -573,14 +567,14 @@ async def test_async_contract_constructor_build_transaction_without_arguments( ) async def test_async_contract_constructor_build_transaction_with_arguments( async_w3_non_strict_abi, - async_non_strict_constructor_with_args_contract_instance, + async_non_strict_constructor_with_args_contract_factory, constructor_args, constructor_kwargs, address_conversion_func, ): async_w3_accounts = await async_w3_non_strict_abi.eth.accounts txn_hash = ( - await async_non_strict_constructor_with_args_contract_instance.constructor( + await async_non_strict_constructor_with_args_contract_factory.constructor( *constructor_args, **constructor_kwargs ).transact({"from": address_conversion_func(async_w3_accounts[0])}) ) @@ -588,7 +582,7 @@ async def test_async_contract_constructor_build_transaction_with_arguments( async_w3_coinbase = await async_w3_non_strict_abi.eth.coinbase nonce = await async_w3_non_strict_abi.eth.get_transaction_count(async_w3_coinbase) unsent_txn = ( - await async_non_strict_constructor_with_args_contract_instance.constructor( + await async_non_strict_constructor_with_args_contract_factory.constructor( *constructor_args, **constructor_kwargs ).build_transaction({"nonce": nonce}) ) diff --git a/tests/core/contracts/test_contract_constructor_encoding.py b/tests/core/contracts/test_contract_constructor_encoding.py index 7f0054290b..ed8e9946a2 100644 --- a/tests/core/contracts/test_contract_constructor_encoding.py +++ b/tests/core/contracts/test_contract_constructor_encoding.py @@ -11,16 +11,16 @@ def test_contract_constructor_abi_encoding_with_no_constructor_fn( - math_contract_instance, math_contract_bytecode + math_contract_factory, math_contract_bytecode ): - deploy_data = math_contract_instance._encode_constructor_data() + deploy_data = math_contract_factory._encode_constructor_data() assert deploy_data == math_contract_bytecode def test_contract_constructor_abi_encoding_with_constructor_with_no_args( - simple_constructor_contract_instance, + simple_constructor_contract_factory, ): - deploy_data = simple_constructor_contract_instance._encode_constructor_data() + deploy_data = simple_constructor_contract_factory._encode_constructor_data() assert deploy_data == SIMPLE_CONSTRUCTOR_CONTRACT_BYTECODE @@ -32,10 +32,10 @@ def test_contract_constructor_abi_encoding_with_constructor_with_no_args( ), ) def test_contract_error_if_additional_args_are_supplied_with_no_constructor_fn( - math_contract_instance, args, kwargs + math_contract_factory, args, kwargs ): with pytest.raises(TypeError, match="Constructor args"): - math_contract_instance._encode_constructor_data(args, kwargs) + math_contract_factory._encode_constructor_data(args, kwargs) @pytest.mark.parametrize( @@ -50,10 +50,10 @@ def test_contract_error_if_additional_args_are_supplied_with_no_constructor_fn( ), ) def test_error_if_invalid_arguments_supplied( - contract_with_constructor_args_instance, arguments + contract_with_constructor_args_factory, arguments ): with pytest.raises(TypeError): - contract_with_constructor_args_instance._encode_constructor_data(arguments) + contract_with_constructor_args_factory._encode_constructor_data(arguments) @pytest.mark.parametrize( @@ -71,11 +71,11 @@ def test_error_if_invalid_arguments_supplied( ) def test_contract_constructor_encoding( w3, - contract_with_constructor_args_instance, + contract_with_constructor_args_factory, encoded_args, bytes_arg, ): - deploy_data = contract_with_constructor_args_instance._encode_constructor_data( + deploy_data = contract_with_constructor_args_factory._encode_constructor_data( [1234, bytes_arg] ) expected_ending = encode_hex( @@ -94,10 +94,10 @@ def test_contract_constructor_encoding( ), ) def test_contract_constructor_encoding_non_strict( - w3_non_strict_abi, non_strict_contract_with_constructor_args_instance, bytes_arg + w3_non_strict_abi, non_strict_contract_with_constructor_args_factory, bytes_arg ): deploy_data = ( - non_strict_contract_with_constructor_args_instance._encode_constructor_data( + non_strict_contract_with_constructor_args_factory._encode_constructor_data( [1234, bytes_arg] ) ) @@ -119,12 +119,12 @@ def test_contract_constructor_encoding_non_strict( ), ) def test_contract_constructor_encoding_strict_errors( - contract_with_constructor_args_instance, bytes_arg + contract_with_constructor_args_factory, bytes_arg ): with pytest.raises( TypeError, match="One or more arguments could not be encoded to the necessary ABI type.", ): - contract_with_constructor_args_instance._encode_constructor_data( + contract_with_constructor_args_factory._encode_constructor_data( [1234, bytes_arg] ) diff --git a/tests/core/contracts/test_contract_deployment.py b/tests/core/contracts/test_contract_deployment.py index 8149c9e721..956e646a3c 100644 --- a/tests/core/contracts/test_contract_deployment.py +++ b/tests/core/contracts/test_contract_deployment.py @@ -15,9 +15,9 @@ def test_contract_deployment_no_constructor( - w3, math_contract_instance, math_contract_runtime + w3, math_contract_factory, math_contract_runtime ): - deploy_txn = math_contract_instance.constructor().transact() + deploy_txn = math_contract_factory.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -31,9 +31,9 @@ def test_contract_deployment_no_constructor( def test_contract_deployment_with_constructor_without_args( w3, - simple_constructor_contract_instance, + simple_constructor_contract_factory, ): - deploy_txn = simple_constructor_contract_instance.constructor().transact() + deploy_txn = simple_constructor_contract_factory.constructor().transact() txn_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -54,10 +54,10 @@ def test_contract_deployment_with_constructor_without_args( ) def test_contract_deployment_with_constructor_with_arguments_strict_by_default( w3, - contract_with_constructor_args_instance, + contract_with_constructor_args_factory, constructor_arg, ): - deploy_txn = contract_with_constructor_args_instance.constructor( + deploy_txn = contract_with_constructor_args_factory.constructor( 1234, constructor_arg ).transact() @@ -73,9 +73,9 @@ def test_contract_deployment_with_constructor_with_arguments_strict_by_default( def test_contract_deployment_with_constructor_with_arguments_non_strict( w3_non_strict_abi, - non_strict_contract_with_constructor_args_instance, + non_strict_contract_with_constructor_args_factory, ): - deploy_txn = non_strict_contract_with_constructor_args_instance.constructor( + deploy_txn = non_strict_contract_with_constructor_args_factory.constructor( 1234, "abcd" ).transact() @@ -90,20 +90,20 @@ def test_contract_deployment_with_constructor_with_arguments_non_strict( def test_contract_deployment_with_constructor_with_arguments_strict_error( - contract_with_constructor_args_instance, + contract_with_constructor_args_factory, ): with pytest.raises( TypeError, match="One or more arguments could not be encoded to the necessary ABI type. Expected types are: uint256, bytes32", # noqa: E501 ): - contract_with_constructor_args_instance.constructor(1234, "abcd").transact() + contract_with_constructor_args_factory.constructor(1234, "abcd").transact() def test_contract_deployment_with_constructor_with_address_argument( w3, - contract_with_constructor_address_instance, + contract_with_constructor_address_factory, ): - deploy_txn = contract_with_constructor_address_instance.constructor( + deploy_txn = contract_with_constructor_address_factory.constructor( "0x16D9983245De15E7A9A73bC586E01FF6E08dE737", ).transact() @@ -121,9 +121,9 @@ def test_contract_deployment_with_constructor_with_address_argument( @pytest.mark.asyncio async def test_async_contract_deployment_no_constructor( - async_w3, async_math_contract_instance, math_contract_runtime + async_w3, async_math_contract_factory, math_contract_runtime ): - deploy_txn = await async_math_contract_instance.constructor().transact() + deploy_txn = await async_math_contract_factory.constructor().transact() txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) assert txn_receipt is not None @@ -138,10 +138,10 @@ async def test_async_contract_deployment_no_constructor( @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_no_args( async_w3, - async_simple_constructor_contract_instance, + async_simple_constructor_contract_factory, ): deploy_txn = ( - await async_simple_constructor_contract_instance.constructor().transact() + await async_simple_constructor_contract_factory.constructor().transact() ) txn_receipt = await async_w3.eth.wait_for_transaction_receipt(deploy_txn) @@ -164,11 +164,11 @@ async def test_async_contract_deployment_with_constructor_no_args( ) async def test_async_contract_deployment_with_constructor_arguments( async_w3, - async_constructor_with_args_contract_instance, + async_constructor_with_args_contract_factory, constructor_arg, ): - deploy_txn = await async_constructor_with_args_contract_instance.constructor( + deploy_txn = await async_constructor_with_args_contract_factory.constructor( 1234, constructor_arg ).transact() @@ -185,13 +185,13 @@ async def test_async_contract_deployment_with_constructor_arguments( @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_with_arguments_non_strict( async_w3_non_strict_abi, - async_non_strict_constructor_with_args_contract_instance, + async_non_strict_constructor_with_args_contract_factory, ): deploy_txn = ( - await async_non_strict_constructor_with_args_contract_instance.constructor( + await async_non_strict_constructor_with_args_contract_factory.constructor( 1234, "abcd" ).transact() - ) # noqa: E501 + ) txn_receipt = await async_w3_non_strict_abi.eth.wait_for_transaction_receipt( deploy_txn @@ -207,13 +207,13 @@ async def test_async_contract_deployment_with_constructor_with_arguments_non_str @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_arguments_strict_error( - async_constructor_with_args_contract_instance, + async_constructor_with_args_contract_factory, ): with pytest.raises( TypeError, match="One or more arguments could not be encoded to the necessary ABI type. Expected types are: uint256, bytes32", # noqa: E501 ): - await async_constructor_with_args_contract_instance.constructor( + await async_constructor_with_args_contract_factory.constructor( 1234, "abcd" ).transact() @@ -221,9 +221,9 @@ async def test_async_contract_deployment_with_constructor_arguments_strict_error @pytest.mark.asyncio async def test_async_contract_deployment_with_constructor_with_address_argument( async_w3, - async_constructor_with_address_arg_contract_instance, -): # noqa: E501 - deploy_txn = await async_constructor_with_address_arg_contract_instance.constructor( + async_constructor_with_address_arg_contract_factory, +): + deploy_txn = await async_constructor_with_address_arg_contract_factory.constructor( "0x16D9983245De15E7A9A73bC586E01FF6E08dE737", ).transact() diff --git a/tests/core/contracts/test_contract_init.py b/tests/core/contracts/test_contract_init.py index 508a0762a1..e297dd5113 100644 --- a/tests/core/contracts/test_contract_init.py +++ b/tests/core/contracts/test_contract_init.py @@ -11,25 +11,23 @@ @pytest.fixture() -def math_addr(math_contract_instance, address_conversion_func): - w3 = math_contract_instance.w3 - deploy_txn = math_contract_instance.constructor().transact( - {"from": w3.eth.coinbase} - ) +def math_addr(math_contract_factory, address_conversion_func): + w3 = math_contract_factory.w3 + deploy_txn = math_contract_factory.constructor().transact({"from": w3.eth.coinbase}) deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None return address_conversion_func(deploy_receipt["contractAddress"]) -def test_contract_with_unset_address(math_contract_instance): - with contract_ens_addresses(math_contract_instance, []): +def test_contract_with_unset_address(math_contract_factory): + with contract_ens_addresses(math_contract_factory, []): with pytest.raises(NameNotFound): - math_contract_instance(address="unsetname.eth") + math_contract_factory(address="unsetname.eth") -def test_contract_with_name_address(math_contract_instance, math_addr): - with contract_ens_addresses(math_contract_instance, [("thedao.eth", math_addr)]): - mc = math_contract_instance(address="thedao.eth") +def test_contract_with_name_address(math_contract_factory, math_addr): + with contract_ens_addresses(math_contract_factory, [("thedao.eth", math_addr)]): + mc = math_contract_factory(address="thedao.eth") caller = mc.w3.eth.coinbase assert mc.address == "thedao.eth" assert mc.functions.return13().call({"from": caller}) == 13 @@ -55,10 +53,10 @@ def test_contract_with_name_address_from_eth_contract( assert mc.functions.return13().call({"from": caller}) == 13 -def test_contract_with_name_address_changing(math_contract_instance, math_addr): +def test_contract_with_name_address_changing(math_contract_factory, math_addr): # Contract address is validated once on creation - with contract_ens_addresses(math_contract_instance, [("thedao.eth", math_addr)]): - mc = math_contract_instance(address="thedao.eth") + with contract_ens_addresses(math_contract_factory, [("thedao.eth", math_addr)]): + mc = math_contract_factory(address="thedao.eth") caller = mc.w3.eth.coinbase assert mc.address == "thedao.eth" diff --git a/tests/core/contracts/test_contract_transact_interface.py b/tests/core/contracts/test_contract_transact_interface.py index 94f0d606f9..4c58d9ab88 100644 --- a/tests/core/contracts/test_contract_transact_interface.py +++ b/tests/core/contracts/test_contract_transact_interface.py @@ -166,7 +166,6 @@ def test_transacting_with_contract_with_bytes32_array_argument( assert final_value == new_bytes32_array -# TODO: strict by default def test_transacting_with_contract_with_byte_array_argument_strict( w3, arrays_contract, transact, call ): @@ -462,7 +461,6 @@ async def test_async_transacting_with_contract_with_bytes32_array_argument( assert final_value == new_bytes32_array -# TODO: strict by default @pytest.mark.asyncio async def test_async_transacting_with_contract_with_byte_array_argument( async_w3, diff --git a/tests/core/contracts/test_extracting_event_data.py b/tests/core/contracts/test_extracting_event_data.py index 60018d63cf..bc06909b58 100644 --- a/tests/core/contracts/test_extracting_event_data.py +++ b/tests/core/contracts/test_extracting_event_data.py @@ -44,18 +44,16 @@ def emitter( wait_for_block, address_conversion_func, ): - emitter_contract_instance = w3.eth.contract(**emitter_contract_data) + emitter_contract_factory = w3.eth.contract(**emitter_contract_data) wait_for_block(w3) - deploy_txn_hash = emitter_contract_instance.constructor().transact( - {"gas": 30029121} - ) + deploy_txn_hash = emitter_contract_factory.constructor().transact({"gas": 30029121}) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == emitter_contract_instance.bytecode_runtime - _emitter = emitter_contract_instance(address=contract_address) + assert bytecode == emitter_contract_factory.bytecode_runtime + _emitter = emitter_contract_factory(address=contract_address) assert _emitter.address == contract_address return _emitter diff --git a/tests/core/contracts/test_extracting_event_data_old.py b/tests/core/contracts/test_extracting_event_data_old.py index 071e92238b..a2bf1cb747 100644 --- a/tests/core/contracts/test_extracting_event_data_old.py +++ b/tests/core/contracts/test_extracting_event_data_old.py @@ -17,18 +17,16 @@ def emitter( wait_for_block, address_conversion_func, ): - emitter_contract_instance = w3.eth.contract(**emitter_contract_data) + emitter_contract_factory = w3.eth.contract(**emitter_contract_data) wait_for_block(w3) - deploy_txn_hash = emitter_contract_instance.constructor().transact( - {"gas": 10000000} - ) + deploy_txn_hash = emitter_contract_factory.constructor().transact({"gas": 10000000}) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == emitter_contract_instance.bytecode_runtime - _emitter = emitter_contract_instance(address=contract_address) + assert bytecode == emitter_contract_factory.bytecode_runtime + _emitter = emitter_contract_factory(address=contract_address) assert _emitter.address == contract_address return _emitter diff --git a/tests/core/contracts/test_offchain_lookup.py b/tests/core/contracts/test_offchain_lookup.py index 42e6aa1bde..a077ebf93b 100644 --- a/tests/core/contracts/test_offchain_lookup.py +++ b/tests/core/contracts/test_offchain_lookup.py @@ -26,7 +26,7 @@ @pytest.fixture -def offchain_lookup_contract_instance(w3): +def offchain_lookup_contract_factory(w3): return w3.eth.contract(**OFFCHAIN_LOOKUP_DATA) @@ -34,20 +34,20 @@ def offchain_lookup_contract_instance(w3): def offchain_lookup_contract( w3, wait_for_block, - offchain_lookup_contract_instance, + offchain_lookup_contract_factory, wait_for_transaction, address_conversion_func, ): wait_for_block(w3) - deploy_txn_hash = offchain_lookup_contract_instance.constructor().transact( + deploy_txn_hash = offchain_lookup_contract_factory.constructor().transact( {"gas": 10000000} ) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == offchain_lookup_contract_instance.bytecode_runtime - deployed_offchain_lookup = offchain_lookup_contract_instance( + assert bytecode == offchain_lookup_contract_factory.bytecode_runtime + deployed_offchain_lookup = offchain_lookup_contract_factory( address=contract_address ) assert deployed_offchain_lookup.address == contract_address diff --git a/tests/core/contracts/utils.py b/tests/core/contracts/utils.py index 1edf353f49..165939cf86 100644 --- a/tests/core/contracts/utils.py +++ b/tests/core/contracts/utils.py @@ -3,25 +3,25 @@ ) -def deploy(w3, contract_instance, apply_func=identity, args=None): +def deploy(w3, contract_factory, apply_func=identity, args=None): args = args or [] - deploy_txn = contract_instance.constructor(*args).transact() + deploy_txn = contract_factory.constructor(*args).transact() deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = apply_func(deploy_receipt["contractAddress"]) - contract = contract_instance(address=address) + contract = contract_factory(address=address) assert contract.address == address assert len(w3.eth.get_code(contract.address)) > 0 return contract -async def async_deploy(async_web3, contract_instance, apply_func=identity, args=None): +async def async_deploy(async_web3, contract_factory, apply_func=identity, args=None): args = args or [] - deploy_txn = await contract_instance.constructor(*args).transact() + deploy_txn = await contract_factory.constructor(*args).transact() deploy_receipt = await async_web3.eth.wait_for_transaction_receipt(deploy_txn) assert deploy_receipt is not None address = apply_func(deploy_receipt["contractAddress"]) - contract = contract_instance(address=address) + contract = contract_factory(address=address) assert contract.address == address assert len(await async_web3.eth.get_code(contract.address)) > 0 return contract diff --git a/tests/core/filtering/conftest.py b/tests/core/filtering/conftest.py index 78659ddb28..331381be2a 100644 --- a/tests/core/filtering/conftest.py +++ b/tests/core/filtering/conftest.py @@ -27,21 +27,21 @@ def w3(request): @pytest.fixture -def emitter_contract_instance(w3, emitter_contract_data): +def emitter_contract_factory(w3, emitter_contract_data): return w3.eth.contract(**emitter_contract_data) @pytest.fixture def emitter( w3, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, wait_for_block, address_conversion_func, ): return _emitter_fixture_logic( w3, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, wait_for_block, address_conversion_func, @@ -74,21 +74,21 @@ def async_w3(request): @pytest.fixture -def async_emitter_contract_instance(async_w3, emitter_contract_data): +def async_emitter_contract_factory(async_w3, emitter_contract_data): return async_w3.eth.contract(**emitter_contract_data) @pytest_asyncio.fixture async def async_emitter( async_w3, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, async_wait_for_block, address_conversion_func, ): return await _async_emitter_fixture_logic( async_w3, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, async_wait_for_block, address_conversion_func, diff --git a/tests/core/filtering/test_contract_data_filters.py b/tests/core/filtering/test_contract_data_filters.py index e1dd33063d..d35457ca5e 100644 --- a/tests/core/filtering/test_contract_data_filters.py +++ b/tests/core/filtering/test_contract_data_filters.py @@ -93,10 +93,10 @@ def emitter( wait_for_block, address_conversion_func, ): - emitter_contract_instance = w3.eth.contract(**emitter_contract_data) + emitter_contract_factory = w3.eth.contract(**emitter_contract_data) return _emitter_fixture_logic( w3, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, wait_for_block, address_conversion_func, @@ -289,7 +289,7 @@ def async_w3(request): @pytest.fixture(scope="module") -def async_emitter_contract_instance(async_w3, emitter_contract_data): +def async_emitter_contract_factory(async_w3, emitter_contract_data): async_w3.eth.contract(**emitter_contract_data) @@ -301,10 +301,10 @@ async def async_emitter( async_wait_for_block, address_conversion_func, ): - async_emitter_contract_instance = async_w3.eth.contract(**emitter_contract_data) + async_emitter_contract_factory = async_w3.eth.contract(**emitter_contract_data) return await _async_emitter_fixture_logic( async_w3, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, async_wait_for_block, address_conversion_func, diff --git a/tests/core/filtering/test_contract_on_event_filtering.py b/tests/core/filtering/test_contract_on_event_filtering.py index df95b2aaa7..d9fb47ad0d 100644 --- a/tests/core/filtering/test_contract_on_event_filtering.py +++ b/tests/core/filtering/test_contract_on_event_filtering.py @@ -8,12 +8,12 @@ @pytest.mark.parametrize("call_deployed_contract", (True, False)) def test_create_filter_address_parameter( - emitter, emitter_contract_instance, call_deployed_contract + emitter, emitter_contract_factory, call_deployed_contract ): if call_deployed_contract: event_filter = emitter.events.LogNoArguments.create_filter(fromBlock="latest") else: - event_filter = emitter_contract_instance.events.LogNoArguments.create_filter( + event_filter = emitter_contract_factory.events.LogNoArguments.create_filter( fromBlock="latest" ) @@ -30,7 +30,7 @@ def test_create_filter_address_parameter( def test_on_filter_using_get_entries_interface( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -41,7 +41,7 @@ def test_on_filter_using_get_entries_interface( if call_deployed_contract: contract = emitter else: - contract = emitter_contract_instance + contract = emitter_contract_factory if api_style == "build_filter": event_filter = contract.events.LogNoArguments.build_filter().deploy(w3) @@ -67,7 +67,7 @@ def test_on_filter_using_get_entries_interface( def test_on_sync_filter_with_event_name_and_single_argument( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -78,7 +78,7 @@ def test_on_sync_filter_with_event_name_and_single_argument( if call_deployed_contract: contract = emitter else: - contract = emitter_contract_instance + contract = emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -115,7 +115,7 @@ def test_on_sync_filter_with_event_name_and_single_argument( def test_on_sync_filter_with_event_name_and_non_indexed_argument( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -126,7 +126,7 @@ def test_on_sync_filter_with_event_name_and_non_indexed_argument( if call_deployed_contract: contract = emitter else: - contract = emitter_contract_instance + contract = emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -186,7 +186,7 @@ def test_filter_with_contract_address( def test_on_sync_filter_with_topic_filter_options_on_old_apis( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -196,7 +196,7 @@ def test_on_sync_filter_with_topic_filter_options_on_old_apis( if call_deployed_contract: contract = emitter else: - contract = emitter_contract_instance + contract = emitter_contract_factory event_filter = create_filter( contract, ["LogTripleWithIndex", {"filter": {"arg1": [1, 2], "arg2": [1, 2]}}] @@ -236,7 +236,7 @@ def event_loop(): @pytest.mark.asyncio @pytest.mark.parametrize("call_deployed_contract", (True, False)) async def test_async_create_filter_address_parameter( - async_emitter, async_emitter_contract_instance, call_deployed_contract + async_emitter, async_emitter_contract_factory, call_deployed_contract ): if call_deployed_contract: event_filter = await async_emitter.events.LogNoArguments.create_filter( @@ -244,7 +244,7 @@ async def test_async_create_filter_address_parameter( ) else: event_filter = ( - await async_emitter_contract_instance.events.LogNoArguments.create_filter( + await async_emitter_contract_factory.events.LogNoArguments.create_filter( fromBlock="latest" ) ) @@ -263,7 +263,7 @@ async def test_async_create_filter_address_parameter( async def test_on_async_filter_using_get_entries_interface( async_w3, async_emitter, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -274,7 +274,7 @@ async def test_on_async_filter_using_get_entries_interface( if call_deployed_contract: contract = async_emitter else: - contract = async_emitter_contract_instance + contract = async_emitter_contract_factory if api_style == "build_filter": event_filter = await contract.events.LogNoArguments.build_filter().deploy( @@ -303,7 +303,7 @@ async def test_on_async_filter_using_get_entries_interface( async def test_on_async_filter_with_event_name_and_single_argument( async_w3, async_emitter, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -314,7 +314,7 @@ async def test_on_async_filter_with_event_name_and_single_argument( if call_deployed_contract: contract = async_emitter else: - contract = async_emitter_contract_instance + contract = async_emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -358,7 +358,7 @@ async def test_on_async_filter_with_event_name_and_single_argument( async def test_on_async_filter_with_event_name_and_non_indexed_argument( async_w3, async_emitter, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -369,7 +369,7 @@ async def test_on_async_filter_with_event_name_and_non_indexed_argument( if call_deployed_contract: contract = async_emitter else: - contract = async_emitter_contract_instance + contract = async_emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogTripleWithIndex.build_filter() @@ -439,7 +439,7 @@ async def test_async_filter_with_contract_address( async def test_on_async_filter_with_topic_filter_options_on_old_apis( async_w3, async_emitter, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -449,7 +449,7 @@ async def test_on_async_filter_with_topic_filter_options_on_old_apis( if call_deployed_contract: contract = async_emitter else: - contract = async_emitter_contract_instance + contract = async_emitter_contract_factory event_filter = await async_create_filter( contract, ["LogTripleWithIndex", {"filter": {"arg1": [1, 2], "arg2": [1, 2]}}] diff --git a/tests/core/filtering/test_contract_past_event_filtering.py b/tests/core/filtering/test_contract_past_event_filtering.py index 1b5c54b0ab..011b4f2248 100644 --- a/tests/core/filtering/test_contract_past_event_filtering.py +++ b/tests/core/filtering/test_contract_past_event_filtering.py @@ -11,7 +11,7 @@ def test_on_filter_using_get_all_entries_interface( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -21,7 +21,7 @@ def test_on_filter_using_get_all_entries_interface( if call_deployed_contract: contract = emitter else: - contract = emitter_contract_instance + contract = emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() @@ -54,7 +54,7 @@ def test_on_filter_using_get_all_entries_interface( def test_get_all_entries_returned_block_data( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -69,7 +69,7 @@ def test_get_all_entries_returned_block_data( if call_deployed_contract: contract = emitter else: - contract = emitter_contract_instance + contract = emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() @@ -108,7 +108,7 @@ def event_loop(): async def test_on_async_filter_using_get_all_entries_interface( async_w3, async_emitter, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -118,7 +118,7 @@ async def test_on_async_filter_using_get_all_entries_interface( if call_deployed_contract: contract = async_emitter else: - contract = async_emitter_contract_instance + contract = async_emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() @@ -152,7 +152,7 @@ async def test_on_async_filter_using_get_all_entries_interface( async def test_async_get_all_entries_returned_block_data( async_w3, async_emitter, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, emitter_contract_event_ids, call_deployed_contract, @@ -167,7 +167,7 @@ async def test_async_get_all_entries_returned_block_data( if call_deployed_contract: contract = async_emitter else: - contract = async_emitter_contract_instance + contract = async_emitter_contract_factory if api_style == "build_filter": builder = contract.events.LogNoArguments.build_filter() diff --git a/tests/core/filtering/test_contract_topic_filters.py b/tests/core/filtering/test_contract_topic_filters.py index 93d3cadd54..6ba4673520 100644 --- a/tests/core/filtering/test_contract_topic_filters.py +++ b/tests/core/filtering/test_contract_topic_filters.py @@ -93,10 +93,10 @@ def emitter( wait_for_block, address_conversion_func, ): - emitter_contract_instance = w3.eth.contract(**emitter_contract_data) + emitter_contract_factory = w3.eth.contract(**emitter_contract_data) return _emitter_fixture_logic( w3, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, wait_for_block, address_conversion_func, @@ -277,11 +277,11 @@ async def async_emitter( async_wait_for_block, address_conversion_func, ): - async_emitter_contract_instance = async_w3.eth.contract(**emitter_contract_data) + async_emitter_contract_factory = async_w3.eth.contract(**emitter_contract_data) return await _async_emitter_fixture_logic( async_w3, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, async_wait_for_block, address_conversion_func, diff --git a/tests/core/filtering/test_filters_against_many_blocks.py b/tests/core/filtering/test_filters_against_many_blocks.py index 26db54d0f2..1a31532060 100644 --- a/tests/core/filtering/test_filters_against_many_blocks.py +++ b/tests/core/filtering/test_filters_against_many_blocks.py @@ -36,7 +36,7 @@ def single_transaction(w3): def test_event_filter_new_events( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, api_style, @@ -103,7 +103,7 @@ def test_transaction_filter_without_mining(w3): def test_event_filter_new_events_many_deployed_contracts( w3, emitter, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, emitter_contract_event_ids, api_style, @@ -113,7 +113,7 @@ def test_event_filter_new_events_many_deployed_contracts( matching_transact = emitter.functions.logNoArgs(which=1).transact deployed_contract_addresses = deploy_contracts( - w3, emitter_contract_instance, wait_for_transaction + w3, emitter_contract_factory, wait_for_transaction ) def gen_non_matching_transact(): @@ -122,7 +122,7 @@ def gen_non_matching_transact(): random.randint(0, len(deployed_contract_addresses) - 1) ] yield w3.eth.contract( - address=contract_address, abi=emitter_contract_instance.abi + address=contract_address, abi=emitter_contract_factory.abi ).functions.logNoArgs(which=1).transact non_matching_transact = gen_non_matching_transact() @@ -267,7 +267,7 @@ async def test_async_transaction_filter_without_mining(async_w3): async def test_async_event_filter_new_events_many_deployed_contracts( async_w3, async_emitter, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, api_style, ): @@ -275,7 +275,7 @@ async def test_async_event_filter_new_events_many_deployed_contracts( matching_transact = async_emitter.functions.logNoArgs(which=1).transact deployed_contract_addresses = await async_deploy_contracts( - async_w3, async_emitter_contract_instance, async_wait_for_transaction + async_w3, async_emitter_contract_factory, async_wait_for_transaction ) async def gen_non_matching_transact(): @@ -284,7 +284,7 @@ async def gen_non_matching_transact(): random.randint(0, len(deployed_contract_addresses) - 1) ] yield async_w3.eth.contract( - address=contract_address, abi=async_emitter_contract_instance.abi + address=contract_address, abi=async_emitter_contract_factory.abi ).functions.logNoArgs(which=1).transact non_matching_transact = gen_non_matching_transact() diff --git a/tests/core/filtering/utils.py b/tests/core/filtering/utils.py index ed9a79ed26..ef54e97869 100644 --- a/tests/core/filtering/utils.py +++ b/tests/core/filtering/utils.py @@ -23,21 +23,19 @@ def _w3_fixture_logic(request): def _emitter_fixture_logic( w3, - emitter_contract_instance, + emitter_contract_factory, wait_for_transaction, wait_for_block, address_conversion_func, ): wait_for_block(w3) - deploy_txn_hash = emitter_contract_instance.constructor().transact( - {"gas": 10000000} - ) + deploy_txn_hash = emitter_contract_factory.constructor().transact({"gas": 10000000}) deploy_receipt = wait_for_transaction(w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = w3.eth.get_code(contract_address) - assert bytecode == emitter_contract_instance.bytecode_runtime - _emitter = emitter_contract_instance(address=contract_address) + assert bytecode == emitter_contract_factory.bytecode_runtime + _emitter = emitter_contract_factory(address=contract_address) assert _emitter.address == contract_address return _emitter @@ -57,20 +55,20 @@ def _async_w3_fixture_logic(request): async def _async_emitter_fixture_logic( async_w3, - async_emitter_contract_instance, + async_emitter_contract_factory, async_wait_for_transaction, async_wait_for_block, address_conversion_func, ): await async_wait_for_block(async_w3) - deploy_txn_hash = await async_emitter_contract_instance.constructor().transact( + deploy_txn_hash = await async_emitter_contract_factory.constructor().transact( {"gas": 10000000} ) deploy_receipt = await async_wait_for_transaction(async_w3, deploy_txn_hash) contract_address = address_conversion_func(deploy_receipt["contractAddress"]) bytecode = await async_w3.eth.get_code(contract_address) - assert bytecode == async_emitter_contract_instance.bytecode_runtime - _emitter = async_emitter_contract_instance(address=contract_address) + assert bytecode == async_emitter_contract_factory.bytecode_runtime + _emitter = async_emitter_contract_factory(address=contract_address) assert _emitter.address == contract_address return _emitter diff --git a/tests/ens/conftest.py b/tests/ens/conftest.py index 7fe0eb23e1..cc00a4a5f9 100644 --- a/tests/ens/conftest.py +++ b/tests/ens/conftest.py @@ -173,7 +173,7 @@ def ens_setup(): ) reverse_tld_namehash = bytes32( 0xA097F6721CE401E757D1223A763FEF49B8B5F90BB18567DDB86FD205DFF71D34 - ) # noqa: E501 + ) reverser_namehash = bytes32( 0x91D1777781884D03A6757A803996E38DE2A42967FB37EEACA72729271025A9E2 )