Exemplo n.º 1
0
def test_cap_table_formats(logger, dbsession, network, scanned_distribution, web3):
    """We format cap tables with different orderings."""

    identity_provider = NullIdentityProvider()

    token_address = scanned_distribution
    for sort_direction in ["asc", "desc"]:
        for sort_order in ["address", "name", "balance", "updated"]:
            generate_cap_table(
                logger,
                dbsession,
                token_address,
                order_by=sort_order,
                identity_provider=identity_provider,
                order_direction=sort_direction,
                include_empty=False,
                TokenScanStatus=TokenScanStatus,
                TokenHolderAccount=TokenHolderAccount,
            )
Exemplo n.º 2
0
def test_cap_table_printer(logger, dbsession, network, scanned_distribution,
                           web3):
    """We print cap tables with different orderings."""

    identity_provider = NullIdentityProvider()

    token_address = scanned_distribution
    table = generate_cap_table(logger,
                               dbsession,
                               token_address,
                               order_by="balance",
                               identity_provider=identity_provider,
                               include_empty=False,
                               order_direction="desc",
                               TokenScanStatus=TokenScanStatus,
                               TokenHolderAccount=TokenHolderAccount)
    print_cap_table(table, max_entries=1000, accuracy=2)
Exemplo n.º 3
0
Arquivo: main.py Projeto: uivlis/sto
def cap_table(config: BoardCommmadConfiguration, token_address, identity_file,
              order_by, order_direction, include_empty, max_entries, accuracy):
    """Print out token holder cap table.

    The token holder data must have been scanned earlier using token-scan command.

    You can supply optional CSV file that contains Ethereum address mappings to individual token holder names.
    """

    assert is_ethereum_network(config.network)

    logger = config.logger

    from sto.generic.captable import generate_cap_table, print_cap_table
    from sto.identityprovider import read_csv, NullIdentityProvider, CSVIdentityProvider
    from sto.models.implementation import TokenScanStatus, TokenHolderAccount

    dbsession = config.dbsession

    if identity_file:
        entries = read_csv(logger, identity_file)
        provider = CSVIdentityProvider(entries)
    else:
        provider = NullIdentityProvider()

    cap_table = generate_cap_table(logger,
                                   dbsession,
                                   token_address=token_address,
                                   identity_provider=provider,
                                   order_by=order_by,
                                   order_direction=order_direction,
                                   include_empty=include_empty,
                                   TokenScanStatus=TokenScanStatus,
                                   TokenHolderAccount=TokenHolderAccount)

    print_cap_table(cap_table, max_entries, accuracy)