Esempio n. 1
0
def new_nettingcontract(our_key, partner_key, tester_state, log_listener,
                        channelmanager, settle_timeout):

    if settle_timeout < NETTINGCHANNEL_SETTLE_TIMEOUT_MIN:
        raise ValueError('settle_timeout must be larger-or-equal to {}'.format(
            NETTINGCHANNEL_SETTLE_TIMEOUT_MIN
        ))

    netting_channel_address0_hex = channelmanager.newChannel(
        privatekey_to_address(partner_key),
        settle_timeout,
        sender=our_key,
    )
    tester_state.mine(number_of_blocks=1)

    nettingchannel_translator = tester.ContractTranslator(
        CONTRACT_MANAGER.get_abi(CONTRACT_NETTING_CHANNEL)
    )

    nettingchannel = tester.ABIContract(
        tester_state,
        nettingchannel_translator,
        netting_channel_address0_hex,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )

    return nettingchannel
Esempio n. 2
0
def create_nettingchannel_proxy(tester_state, tester_nettingchannel_address, log_listener):
    translator = tester.ContractTranslator(NETTING_CHANNEL_ABI)
    netting_channel_abi = tester.ABIContract(
        tester_state,
        translator,
        tester_nettingchannel_address,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )
    return netting_channel_abi
Esempio n. 3
0
def create_channelmanager_proxy(tester_state, tester_channelmanager_address, log_listener):
    translator = tester.ContractTranslator(CHANNEL_MANAGER_ABI)
    channel_manager_abi = tester.ABIContract(
        tester_state,
        translator,
        tester_channelmanager_address,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )
    return channel_manager_abi
Esempio n. 4
0
def create_registryproxy(tester_state, tester_registry_address, log_listener):
    translator = tester.ContractTranslator(REGISTRY_ABI)
    registry_abi = tester.ABIContract(
        tester_state,
        translator,
        tester_registry_address,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )
    return registry_abi
Esempio n. 5
0
def create_tokenproxy(tester_state, tester_token_address, log_listener):
    translator = tester.ContractTranslator(HUMAN_TOKEN_ABI)
    token_abi = tester.ABIContract(
        tester_state,
        translator,
        tester_token_address,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )
    return token_abi
Esempio n. 6
0
def create_registryproxy(tester_state, tester_registry_address, log_listener):
    translator = tester.ContractTranslator(CONTRACT_MANAGER.get_abi(CONTRACT_REGISTRY))
    registry_abi = tester.ABIContract(
        tester_state,
        translator,
        tester_registry_address,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )
    return registry_abi
Esempio n. 7
0
def create_tokenproxy(tester_state, tester_token_address, log_listener):
    translator = tester.ContractTranslator(
        CONTRACT_MANAGER.get_abi(CONTRACT_HUMAN_STANDARD_TOKEN))
    token_abi = tester.ABIContract(
        tester_state,
        translator,
        tester_token_address,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )
    return token_abi
Esempio n. 8
0
def new_nettingcontract(our_key, partner_key, tester_state, log_listener,
                        channelmanager, settle_timeout):

    netting_channel_address0_hex = channelmanager.newChannel(
        privatekey_to_address(partner_key),
        settle_timeout,
        sender=our_key,
    )
    tester_state.mine(number_of_blocks=1)

    nettingchannel_translator = tester.ContractTranslator(NETTING_CHANNEL_ABI)

    nettingchannel = tester.ABIContract(
        tester_state,
        nettingchannel_translator,
        netting_channel_address0_hex,
        log_listener=log_listener,
        default_key=INVALID_KEY,
    )

    return nettingchannel