Ejemplo n.º 1
0
def test_fund_wallet(web3, coinbase, hosted_wallet):
    """Send some funds int the wallet and see the balance updates."""

    current_balance = wei_to_eth(web3.eth.getBalance(hosted_wallet.address))

    # value = get_wallet_balance(wallet_contract_address)
    txid = send_balance_to_contract(hosted_wallet, TEST_VALUE)

    wait_tx(web3, txid)

    new_balance = hosted_wallet.get_balance()

    assert new_balance == current_balance + TEST_VALUE
Ejemplo n.º 2
0
def house_address(dbsession, eth_service, web3, eth_network_id) -> UUID:
    """Create a network specific house address.

    :return: Address UUID
    """
    with transaction.manager:
        network = dbsession.query(AssetNetwork).get(eth_network_id)
        op = create_house_address(network)
        opid = op.id
        address_id = op.address.id
        assert address_id

    # this runs op
    eth_service.run_waiting_operations()

    with transaction.manager:
        address = dbsession.query(CryptoAddress).get(address_id)
        addr = bin_to_eth_address(address.address)

    # Send some funds to the house from coinbase
    txid = send_balance_to_address(web3, addr, Decimal("0.1"))
    wait_tx(web3, txid)

    return address_id
Ejemplo n.º 3
0
def house_address(dbsession, eth_service, web3, eth_network_id) -> UUID:
    """Create a network specific house address.

    :return: Address UUID
    """
    with transaction.manager:
        network = dbsession.query(AssetNetwork).get(eth_network_id)
        op = create_house_address(network)
        opid = op.id
        address_id = op.address.id
        assert address_id

    # this runs op
    eth_service.run_waiting_operations()

    with transaction.manager:
        address = dbsession.query(CryptoAddress).get(address_id)
        addr = bin_to_eth_address(address.address)

    # Send some funds to the house from coinbase
    txid = send_balance_to_address(web3, addr, Decimal("0.1"))
    wait_tx(web3, txid)

    return address_id
Ejemplo n.º 4
0
def topped_up_hosted_wallet(web3, hosted_wallet):
    """Wallet with ensured amount of funds."""

    txid = send_balance_to_contract(hosted_wallet, TOP_UP_VALUE)
    wait_tx(web3, txid)
    return hosted_wallet
Ejemplo n.º 5
0
def topped_up_hosted_wallet(web3, hosted_wallet):
    """Wallet with ensured amount of funds."""

    txid = send_balance_to_contract(hosted_wallet, TOP_UP_VALUE)
    wait_tx(web3, txid)
    return hosted_wallet