hydrachain/native_contracts.py
def chain_nac_proxy(chain, sender, contract_address, value=0):
    "create an object which acts as a proxy for the contract on the chain"
    klass = registry[contract_address].im_self
    assert issubclass(klass, NativeABIContract)

    def mk_method(method):
        def m(s, *args):
            data = abi_encode_args(method, args)
            block = chain.head_candidate
            output = test_call(block, sender, contract_address, data)
            if output is not None:
                return abi_decode_return_vals(method, output)
        return m

    class cproxy(object):
        pass
    for m in klass._abi_methods():
        setattr(cproxy, m.__func__.func_name, mk_method(m))

    return cproxy()
def chain_nac_proxy(chain, sender, contract_address, value=0):
    "create an object which acts as a proxy for the contract on the chain"
    klass = registry[contract_address].im_self
    assert issubclass(klass, NativeABIContract)

    def mk_method(method):
        def m(s, *args):
            data = abi_encode_args(method, args)
            block = chain.head_candidate
            output = test_call(block, sender, contract_address, data)
            if output is not None:
                return abi_decode_return_vals(method, output)
        return m

    class cproxy(object):
        pass
    for m in klass._abi_methods():
        setattr(cproxy, m.__func__.func_name, mk_method(m))

    return cproxy()
create an object which acts as a proxy for the contract on the chain