Beispiel #1
0
def update_erc20(details):
    networks = [
        'eth',
        'exp',
        # 'rop',
        # 'rin',
        'ubq',
        # 'rsk',
        # 'kov',
        'etc',
    ]

    LATEST_T1 = 'https://raw.githubusercontent.com/trezor/trezor-mcu/v1.6.1/firmware/ethereum_tokens.c'
    LATEST_T2 = 'https://raw.githubusercontent.com/trezor/trezor-core/v2.0.6/src/apps/ethereum/tokens.py'

    tokens = ethereum_tokens_gen.get_tokens()
    tokens_t1 = requests.get(LATEST_T1).text
    tokens_t2 = requests.get(LATEST_T2).text

    supported = []
    for t in tokens:
        # print('Updating', t['symbol'])

        if t['chain'] not in networks:
            print('Skipping, %s is disabled' % t['chain'])
            continue

        key = "erc20:%s:%s" % (t['chain'], t['symbol'])
        supported.append(key)
        out = details['coins'].setdefault(key, {})
        out['type'] = 'erc20'
        out['network'] = t['chain']
        out['address'] = t['address']

        set_default(out, 'shortcut', t['symbol'])
        set_default(out, 'name', t['name'])
        set_default(out, 'links', {})

        if "\" %s\"" % t['symbol'] in tokens_t1:
            out['t1_enabled'] = 'yes'
        else:
            out['t1_enabled'] = 'soon'

        if "'%s'" % t['symbol'] in tokens_t2:
            out['t2_enabled'] = 'yes'
        else:
            out['t2_enabled'] = 'soon'

        out['links']['MyCrypto Wallet'] = 'https://mycrypto.com'
        out['links']['MyEtherWallet'] = 'https://www.myetherwallet.com'

        if t['website']:
            out['links']['Homepage'] = t['website']
        if t.get('social', {}).get('github', None):
            out['links']['Github'] = t['social']['github']

        update_marketcap(out, out.get('coinmarketcap_alias', t['symbol']))

    check_unsupported(details, 'erc20:', supported)
Beispiel #2
0
def update_erc20(details):
    networks = [
        'eth',
        'exp',
        # 'rop',
        # 'rin',
        'ubq',
        # 'rsk',
        # 'kov',
        'etc',
    ]

    tokens = ethereum_tokens_gen.get_tokens()
    supported = []
    for t in tokens:
        print('Updating', t['symbol'])

        if t['chain'] not in networks:
            print('Skipping, %s is disabled' % t['chain'])
            continue

        key = "erc20:%s:%s" % (t['chain'], t['symbol'])
        supported.append(key)
        out = details['coins'].setdefault(key, {})
        out['type'] = 'erc20'
        out['network'] = t['chain']
        out['address'] = t['address']

        set_default(out, 'shortcut', t['symbol'])
        set_default(out, 'name', t['name'])
        set_default(out, 't1_enabled', 'yes')
        set_default(out, 't2_enabled', 'yes')
        set_default(out, 'links', {})

        if t['website']:
            out['links']['Homepage'] = t['website']
        if t.get('social', {}).get('github', None):
            out['links']['Github'] = t['social']['github']

        update_marketcap(out, out.get('coinmarketcap_alias', t['symbol']))

    check_unsupported(details, 'erc20:', supported)