# Path: hydrachain/native_contracts.py
# class Registry(object):
# class NativeContractBase(object):
# class CreateNativeContractInstance(NativeContractBase):
# class NativeABIContract(NativeContractBase):
# class ABIEvent(object):
#     class cproxy(object):
#     class cproxy(object):
# class TypedStorage(object):
# class Scalar(TypedStorage):
# class List(TypedStorage):
# class Dict(List):
# class IterableDict(Dict):
# class Struct(TypedStorage):
# class TypedStorageContract(NativeContractBase):
# class NativeContract(NativeABIContract, TypedStorageContract):
#     def __init__(self):
#     def mk_instance_address(self, native_contract, sender, nonce):
#     def is_instance_address(self, address):
#     def address_to_native_contract_class(self, address):
#     def register(self, contract):
#     def unregister(self, contract):
#     def abi_contracts(self):
#     def __contains__(self, address):
#     def __getitem__(self, address):
#     def __init__(self, ext, msg):
#     def _on_msg(cls, ext, msg):
#     def _get_storage_data(self, key):
#     def _set_storage_data(self, key, value):
#     def _safe_call(self):
#     def _safe_call(self):
# def _abi_decode_single_patch(typ, val):
# def abi_encode_args(method, args):
# def abi_decode_args(method, data):
# def abi_encode_return_vals(method, vals):
# def abi_decode_return_vals(method, data):
# def constant(f):
#     def __init__(self, ext, msg):
#         def mk_event_method(ctx, evt):
#             def m(*args):
#     def balance(self):  # can change during subcalls
#     def suicide(self, address):
#     def call(self, to, data='', **kargs):
#     def call_abi(self, to, abi_contract_method, *args, **kargs):
#     def _get_method_abi(cls, method):
#     def json_abi(cls):
#     def _abi_methods(cls):
#     def _find_method(cls, method_id):
#     def default_method(self):
#     def _safe_call(self):
#     def __setattr__(self, key, value):
#     def arg_types(cls):
#     def arg_names(cls):
#     def event_id(cls):
#     def __init__(self, ctx, *args):
#     def listen(cls, log_, address=None, callback=None):
# def listen_logs(state, event, address=None, callback=None):
# def tester_call_method(state, sender, method, *args):
# def tester_nac(state, sender, address, value=0):
#     def mk_method(method):
#         def m(s, *args):
# def test_call(block, sender, to, data='', gasprice=0, value=0):
# def chain_nac_proxy(chain, sender, contract_address, value=0):
#     def mk_method(method):
#         def m(s, *args):
# def tester_create_native_contract_instance(state, sender, contract, value=0):
#     def __init__(self, value_type):
#     def setup(self, prefix, getter, setter):
#     def _db_decode_type(cls, value_type, data):
#     def _db_encode_type(cls, value_type, val):
#     def _key(self, k):
#     def set(self, k=b'', v=None, value_type=None):
#             def _set(ts_k, v):
#     def get(self, k=b'', value_type=None):
#             def _set(ts_k, v):
#     def markstorage(self, k):
#     def __getitem__(self, i):
#     def __setitem__(self, i, v):
#     def updatelen(self, i, v):
#     def markstorage(self, i):
#     def __len__(self):
#     def append(self, v):
#     def __contains__(self, idx):
#     def __iter__(self):
#     def __getitem__(self, k):
#     def __setitem__(self, k, v):
#     def markstorage(self, k):
#     def __contains__(self, k):
#     def __len__(self):
#     def __getitem__(self, k):
#     def _ckey(self, idx):
#     def __setitem__(self, k, v):
#     def updatelen(self, k):
#     def markstorage(self, k):
#     def __contains__(self, idx):
#     def keys(self):
#     def values(self):
#     def items(self):
#     def __len__(self):
#     def __init__(self, **kwargs):
#     def __getattribute__(self, k, *default):
#     def _ckey(self, idx):
#     def __setattr__(self, k, v):
#     def setup(self, prefix, getter, setter):
#     def __init__(self, ext, msg):
#     def _prepare_storage(self, get_storage_data, set_storage_data):
#         def slots():
#                 def _mk_property(skalar):


import random
import string
import pytest
import logging
import random
import string
from ethereum import abi
from ethereum import tester
from ethereum import utils
from ethereum.utils import zpad
from hydrachain import native_contracts as nc

    a.setup(b'a', _get, _set)
    c.setup(b'c', _get, _set)
    k.setup(b'k', _get, _set)

    # test invalid types

    with pytest.raises(AttributeError):
        a.b == 81

    with pytest.raises(ValueError):
        a['one']['two'] = 63432

    with pytest.raises(TypeError):
        a['one'][2] = 'somestr'

    with pytest.raises(NotImplementedError):
        k[1] = 2

    with pytest.raises(NotImplementedError):
        c[1] = 2


def test_nested_typed_storage_struct():

    def _key(self, k):
        k = zpad(k, 32)
        return b'%s:%s' % (self._prefix, k)

    original_key = nc.TypedStorage._key

# Path: hydrachain/native_contracts.py
# class Registry(object):
# class NativeContractBase(object):
# class CreateNativeContractInstance(NativeContractBase):
# class NativeABIContract(NativeContractBase):
# class ABIEvent(object):
#     class cproxy(object):
#     class cproxy(object):
# class TypedStorage(object):
# class Scalar(TypedStorage):
# class List(TypedStorage):
# class Dict(List):
# class IterableDict(Dict):
# class Struct(TypedStorage):
# class TypedStorageContract(NativeContractBase):
# class NativeContract(NativeABIContract, TypedStorageContract):
#     def __init__(self):
#     def mk_instance_address(self, native_contract, sender, nonce):
#     def is_instance_address(self, address):
#     def address_to_native_contract_class(self, address):
#     def register(self, contract):
#     def unregister(self, contract):
#     def abi_contracts(self):
#     def __contains__(self, address):
#     def __getitem__(self, address):
#     def __init__(self, ext, msg):
#     def _on_msg(cls, ext, msg):
#     def _get_storage_data(self, key):
#     def _set_storage_data(self, key, value):
#     def _safe_call(self):
#     def _safe_call(self):
# def _abi_decode_single_patch(typ, val):
# def abi_encode_args(method, args):
# def abi_decode_args(method, data):
# def abi_encode_return_vals(method, vals):
# def abi_decode_return_vals(method, data):
# def constant(f):
#     def __init__(self, ext, msg):
#         def mk_event_method(ctx, evt):
#             def m(*args):
#     def balance(self):  # can change during subcalls
#     def suicide(self, address):
#     def call(self, to, data='', **kargs):
#     def call_abi(self, to, abi_contract_method, *args, **kargs):
#     def _get_method_abi(cls, method):
#     def json_abi(cls):
#     def _abi_methods(cls):
#     def _find_method(cls, method_id):
#     def default_method(self):
#     def _safe_call(self):
#     def __setattr__(self, key, value):
#     def arg_types(cls):
#     def arg_names(cls):
#     def event_id(cls):
#     def __init__(self, ctx, *args):
#     def listen(cls, log_, address=None, callback=None):
# def listen_logs(state, event, address=None, callback=None):
# def tester_call_method(state, sender, method, *args):
# def tester_nac(state, sender, address, value=0):
#     def mk_method(method):
#         def m(s, *args):
# def test_call(block, sender, to, data='', gasprice=0, value=0):
# def chain_nac_proxy(chain, sender, contract_address, value=0):
#     def mk_method(method):
#         def m(s, *args):
# def tester_create_native_contract_instance(state, sender, contract, value=0):
#     def __init__(self, value_type):
#     def setup(self, prefix, getter, setter):
#     def _db_decode_type(cls, value_type, data):
#     def _db_encode_type(cls, value_type, val):
#     def _key(self, k):
#     def set(self, k=b'', v=None, value_type=None):
#             def _set(ts_k, v):
#     def get(self, k=b'', value_type=None):
#             def _set(ts_k, v):
#     def markstorage(self, k):
#     def __getitem__(self, i):
#     def __setitem__(self, i, v):
#     def updatelen(self, i, v):
#     def markstorage(self, i):
#     def __len__(self):
#     def append(self, v):
#     def __contains__(self, idx):
#     def __iter__(self):
#     def __getitem__(self, k):
#     def __setitem__(self, k, v):
#     def markstorage(self, k):
#     def __contains__(self, k):
#     def __len__(self):
#     def __getitem__(self, k):
#     def _ckey(self, idx):
#     def __setitem__(self, k, v):
#     def updatelen(self, k):
#     def markstorage(self, k):
#     def __contains__(self, idx):
#     def keys(self):
#     def values(self):
#     def items(self):
#     def __len__(self):
#     def __init__(self, **kwargs):
#     def __getattribute__(self, k, *default):
#     def _ckey(self, idx):
#     def __setattr__(self, k, v):
#     def setup(self, prefix, getter, setter):
#     def __init__(self, ext, msg):
#     def _prepare_storage(self, get_storage_data, set_storage_data):
#         def slots():
#                 def _mk_property(skalar):


# Path: hydrachain/tests/test_native_contracts.py
import random
import string
import pytest
import logging
import random
import string
from ethereum import abi
from ethereum import tester
from ethereum import utils
from ethereum.utils import zpad
from hydrachain import native_contracts as nc


    a.setup(b'a', _get, _set)
    c.setup(b'c', _get, _set)
    k.setup(b'k', _get, _set)

    # test invalid types

    with pytest.raises(AttributeError):
        a.b == 81

    with pytest.raises(ValueError):
        a['one']['two'] = 63432

    with pytest.raises(TypeError):
        a['one'][2] = 'somestr'

    with pytest.raises(NotImplementedError):
        k[1] = 2

    with pytest.raises(NotImplementedError):
        c[1] = 2


def test_nested_typed_storage_struct():

    def _key(self, k):
        k = zpad(k, 32)
        return b'%s:%s' % (self._prefix, k)

    original_key = nc.TypedStorage._key

    nc.TypedStorage._key = _key