"""A web3.py Contract class for the {{contract_name}} contract.

DO NOT EDIT.  This file was generated by pypechain v{{pypechain_version}}.
See documentation at https://github.com/delvtech/pypechain """

# contracts have PascalCase names
# pylint: disable=invalid-name

# contracts control how many attributes and arguments we have in generated code
# pylint: disable=too-many-instance-attributes
# pylint: disable=too-many-arguments

# we don't need else statement if the other conditionals all have return,
# but it's easier to generate
# pylint: disable=no-else-return

# This file is bound to get very long depending on contract sizes.
# pylint: disable=too-many-lines

# methods are overridden with specific arguments instead of generic *args, **kwargs
# pylint: disable=arguments-differ

# consumers have too many opinions on line length
# pylint: disable=line-too-long

# We use protected classes within pypechain
# pylint: disable=protected-access

# We sometimes define a variable that might not be returned in `call`,
# but we still may want to call the function
# pylint: disable=unused-variable



from __future__ import annotations

from dataclasses import fields, is_dataclass
from typing import Any, NamedTuple, Tuple, Type, TypeVar, cast, overload
from typing import Iterable, Sequence

from eth_typing import ChecksumAddress, HexStr, ABIFunction, ABI
from eth_account.signers.local import LocalAccount
from hexbytes import HexBytes
from typing_extensions import Self
from web3 import Web3
from web3.contract.contract import Contract, ContractFunction, ContractFunctions, ContractConstructor
from web3.contract.contract import ContractEvent, ContractEvents
from web3.types import BlockIdentifier, StateOverride, TxParams, Nonce, EventData, TxReceipt
from web3._utils.filters import LogFilter
import copy

{% for name in structs_filenames%}
from ..{{name}} import {{name}}Types as {{name}}
{% endfor %}

{% for name in structs_without_filenames%}
from ..{{name}}.{{name}}Types import {{name}}
{% endfor %}

{% for contract_name in link_references.contract_names %}
from ..{{contract_name}} import {{contract_name}}Contract
{% endfor %}

{% if has_events %}
from web3.logs import WARN
from web3._utils.events import EventLogErrorFlags
from pypechain.core import BaseEventArgs
{% endif %}

{% if has_errors %}
from pypechain.core import PypechainBaseError
{% endif %}

{% if has_errors or has_events %}
from pypechain.core import combomethod_typed
{% endif %}

{% for event in events %}
from .{{contract_name}}Types import {{event.capitalized_name}}Event
{% endfor %}

from pypechain.core import (
    dataclass_to_tuple, 
    get_abi_input_types, 
    rename_returned_types, 
    tuple_to_dataclass, 
    get_arg_type_names,
    expand_struct_type_str,
    PypechainContractFunction,
    PypechainContractLogicError,
    PypechainBaseContractErrors,
    handle_contract_logic_error,
    check_txn_receipt,
)


structs = {
{%- for struct in structs_used %}
{% if struct.contract_name %}
    "{{struct.contract_name}}.{{struct.name}}" : {{struct.contract_name}}.{{struct.name}},
{% else %}
    "{{struct.name}}" : {{struct.name}},
{% endif %}
{%- endfor %}}


{{functions_block}}

{% if has_events %}{{ events_block }}{% endif %}


{{abi_block}}

{{ errors_block }}

{{contract_block}}