コード例 #1
0
    def serialize(self) -> Dict[str, Any]:
        profit_loss_amounts: Dict[str, Any] = {
        }  # Includes all assets, even with zero amount
        for pool_token, profit_loss_amount in zip(
                self.pool_address_token.underlying_tokens,
                self.profit_loss_amounts):  # noqa: E501
            token_identifier = ethaddress_to_identifier(pool_token.address)
            profit_loss_amounts[token_identifier] = str(profit_loss_amount)

        return {
            'pool_address':
            self.pool_address_token.ethereum_address,
            'pool_tokens': [
                ethaddress_to_identifier(x.address)
                for x in self.pool_address_token.underlying_tokens
            ],  # noqa: E501
            'events': [
                event.serialize(
                    pool_tokens=self.pool_address_token.underlying_tokens)
                for event in self.events
            ],  # noqa: E501
            'profit_loss_amounts':
            profit_loss_amounts,
            'usd_profit_loss':
            str(self.usd_profit_loss),
        }
コード例 #2
0
 def initialize(  # type: ignore  # figure out a way to make mypy happy
     cls: Type[Y],
     address: ChecksumEthAddress,
     decimals: Optional[int] = None,
     name: Optional[str] = None,
     symbol: Optional[str] = None,
     started: Optional[Timestamp] = None,
     swapped_for: Optional[Asset] = None,
     coingecko: Optional[str] = None,
     # add the token with inactive cryptocompare so querying is not attempted by symbol
     cryptocompare: Optional[str] = '',
     protocol: Optional[str] = None,
     underlying_tokens: Optional[List[UnderlyingToken]] = None,
 ) -> Y:
     """Initialize a token from fields"""
     token = cls('whatever', direct_field_initialization=True)
     object.__setattr__(token, 'identifier',
                        ethaddress_to_identifier(address))
     object.__setattr__(token, 'name', name)
     object.__setattr__(token, 'symbol', symbol)
     object.__setattr__(token, 'asset_type', AssetType.ETHEREUM_TOKEN)
     object.__setattr__(token, 'started', started)
     object.__setattr__(token, 'forked', None)
     object.__setattr__(token, 'swapped_for', swapped_for)
     object.__setattr__(token, 'cryptocompare', cryptocompare)
     object.__setattr__(token, 'coingecko', coingecko)
     object.__setattr__(token, 'ethereum_address', address)
     object.__setattr__(token, 'decimals', decimals)
     object.__setattr__(token, 'protocol', protocol)
     object.__setattr__(token, 'underlying_tokens', underlying_tokens)
     return token
コード例 #3
0
def test_balance_sheet_to_dict():
    a = BalanceSheet(
        assets={
            A_USD: Balance(amount=FVal('2'), usd_value=FVal('2')),
            A_ETH: Balance(amount=FVal('3'), usd_value=FVal('900')),
        },
        liabilities={
            A_DAI: Balance(amount=FVal('5'), usd_value=FVal('5.1')),
            A_ETH: Balance(amount=FVal('0.5'), usd_value=FVal('150')),
        },
    )
    assert a.to_dict() == {
        'assets': {
            'USD': {
                'amount': FVal('2'),
                'usd_value': FVal('2')
            },
            'ETH': {
                'amount': FVal('3'),
                'usd_value': FVal('900')
            },
        },
        'liabilities': {
            ethaddress_to_identifier('0x6B175474E89094C44Da98b954EedeAC495271d0F'):
            {
                'amount': FVal('5'),
                'usd_value': FVal('5.1')
            },  # noqa: E501
            'ETH': {
                'amount': FVal('0.5'),
                'usd_value': FVal('150')
            },
        },
    }
コード例 #4
0
def test_get_ethereum_token_identifier(globaldb):
    assert globaldb.get_ethereum_token_identifier(
        '0xnotexistingaddress') is None
    token_0_id = globaldb.get_ethereum_token_identifier(
        INITIAL_TOKENS[0].ethereum_address)
    assert token_0_id == ethaddress_to_identifier(
        INITIAL_TOKENS[0].ethereum_address)
コード例 #5
0
ファイル: test_inquirer.py プロジェクト: jsloane/rotki
def test_price_underlying_tokens(inquirer, globaldb):
    aave_weight, link_weight, crv_weight = FVal('0.6'), FVal('0.2'), FVal(
        '0.2')
    address = make_ethereum_address()
    token = EthereumToken.initialize(
        address=address,
        decimals=18,
        name='Test',
        symbol='YAB',
        underlying_tokens=[
            UnderlyingToken(address=A_AAVE.ethereum_address,
                            weight=aave_weight),
            UnderlyingToken(address=A_LINK.ethereum_address,
                            weight=link_weight),
            UnderlyingToken(address=A_CRV.ethereum_address, weight=crv_weight),
        ],
    )
    globaldb.add_asset(
        asset_id=ethaddress_to_identifier(address),
        asset_type=AssetType.ETHEREUM_TOKEN,
        data=token,
    )

    price = inquirer.find_price(EthereumToken(address), A_USD)
    assert price == FVal(67)
コード例 #6
0
    def serialize(self) -> Dict[str, Any]:
        profit_loss_amounts: Dict[str, Any] = {
        }  # Includes all assets, even with zero amount
        tokens_and_weights = []
        for pool_token, profit_loss_amount in zip(
                self.pool_address_token.underlying_tokens,
                self.profit_loss_amounts):  # noqa: E501
            token_identifier = ethaddress_to_identifier(pool_token.address)
            profit_loss_amounts[token_identifier] = str(profit_loss_amount)
            tokens_and_weights.append({
                'token': token_identifier,
                'weight': str(pool_token.weight * 100),
            })

        return {
            'pool_address':
            self.pool_address_token.ethereum_address,
            'pool_tokens':
            tokens_and_weights,
            'events': [
                event.serialize(
                    pool_tokens=self.pool_address_token.underlying_tokens)
                for event in self.events
            ],  # noqa: E501
            'profit_loss_amounts':
            profit_loss_amounts,
            'usd_profit_loss':
            str(self.usd_profit_loss),
        }
コード例 #7
0
def test_vault_types():
    assert len(COLLATERAL_TYPE_MAPPING) == len(GEMJOIN_MAPPING)
    assert set(COLLATERAL_TYPE_MAPPING.keys()) == set(GEMJOIN_MAPPING.keys())
    for collateral_type, asset in COLLATERAL_TYPE_MAPPING.items():
        if collateral_type == 'PAXUSD-A':
            assert asset.identifier == ethaddress_to_identifier(
                '0x8E870D67F660D95d5be530380D0eC0bd388289E1'
            )  # PAX # noqa: E501
            continue

        assert asset.symbol.lower() == collateral_type.split('-')[0].lower()
コード例 #8
0
ファイル: test_assets.py プロジェクト: trolleypoleking/rotki
def test_case_does_not_matter_for_asset_constructor():
    """Test that whatever case we give to asset constructor result is the same"""
    a1 = Asset('bTc')
    a2 = Asset('BTC')
    assert a1 == a2
    assert a1.identifier == 'BTC'
    assert a2.identifier == 'BTC'

    a3 = symbol_to_ethereum_token('UsDt')
    a4 = symbol_to_ethereum_token('usdt')
    assert a3.identifier == a4.identifier == ethaddress_to_identifier('0xdAC17F958D2ee523a2206206994597C13D831ec7')  # noqa: E501
コード例 #9
0
ファイル: test_globaldb_upgrades.py プロジェクト: rotki/rotki
def test_upgrade_v1_v2(globaldb):
    # at this point upgrade should have happened
    assert globaldb.get_setting_value('version', None) == 2

    for identifier, entry in globaldb.get_all_asset_data(mapping=True, serialized=False).items():
        if entry.asset_type == AssetType.ETHEREUM_TOKEN:
            assert identifier == ethaddress_to_identifier(entry.ethereum_address)

        swapped_for = entry.swapped_for

        # check the swapped_for key also changed for one we know
        if entry.name == 'Aurora DAO':
            assert entry.swapped_for == strethaddress_to_identifier('0xB705268213D593B8FD88d3FDEFF93AFF5CbDcfAE')  # noqa: E501

        if swapped_for and swapped_for not in ('AM', 'PHB', 'FIRO', 'DIVI', 'SCRT', 'HAI', 'MED', 'NOAHP', 'VET', 'XDC'):  # noqa: E501
            assert entry.swapped_for.startswith(ETHEREUM_DIRECTIVE)

    # Check some swapped for that we know should have changed. DIVX -> DIVI
    asset_data = globaldb.get_asset_data(strethaddress_to_identifier('0x13f11C9905A08ca76e3e853bE63D4f0944326C72'), form_with_incomplete_data=True)  # noqa: E501
    assert asset_data.swapped_for == 'DIVI'
    # GNT -> GLM
    asset_data = globaldb.get_asset_data(strethaddress_to_identifier('0xa74476443119A942dE498590Fe1f2454d7D4aC0d'), form_with_incomplete_data=True)  # noqa: E501
    assert asset_data.swapped_for == strethaddress_to_identifier('0x7DD9c5Cba05E151C895FDe1CF355C9A1D5DA6429')  # noqa: E501

    # Make sure the number of assets remained the same
    cursor = globaldb._conn.cursor()
    assert cursor.execute('SELECT COUNT(*) from assets').fetchone()[0] == 1886
    assert cursor.execute('SELECT COUNT(*) from user_owned_assets').fetchone()[0] == 105
    # Make sure that populated underlying assets are still there
    query = cursor.execute('SELECT * from underlying_tokens_list;')
    assert query.fetchall() == [
        ('0x42Fa37aC7c115bf17ca5DDfcb94b73b91B10B61B', '0.5', '0xBBc2AE13b23d715c30720F079fcd9B4a74093505'),  # noqa: E501
        ('0x647C4CD779043b3f00a4ccdec550F35Dd18792b3', '0.5', '0xBBc2AE13b23d715c30720F079fcd9B4a74093505'),  # noqa: E501
    ]
    # Make sure that the previous custom assets are still in the DB
    query = cursor.execute(
        'SELECT COUNT(*) from assets where identifier IN (?, ?, ?, ?);',
        ('_ceth_0x35bD01FC9d6D5D81CA9E055Db88Dc49aa2c699A8',
         '_ceth_0xBBc2AE13b23d715c30720F079fcd9B4a74093505',
         '_ceth_0x42Fa37aC7c115bf17ca5DDfcb94b73b91B10B61B',
         '_ceth_0x647C4CD779043b3f00a4ccdec550F35Dd18792b3',
         ),
    )
    assert query.fetchone()[0] == 4
    query = cursor.execute(
        'SELECT COUNT(*) from ethereum_tokens where address IN (?, ?, ?, ?);',
        ('0x35bD01FC9d6D5D81CA9E055Db88Dc49aa2c699A8',
         '0xBBc2AE13b23d715c30720F079fcd9B4a74093505',
         '0x42Fa37aC7c115bf17ca5DDfcb94b73b91B10B61B',
         '0x647C4CD779043b3f00a4ccdec550F35Dd18792b3',
         ),
    )
    assert query.fetchone()[0] == 4
コード例 #10
0
ファイル: handler.py プロジェクト: jsloane/rotki
    def _add_underlying_tokens(
        connection: sqlite3.Connection,
        parent_token_address: ChecksumEthAddress,
        underlying_tokens: List[UnderlyingToken],
    ) -> None:
        """Add the underlying tokens for the parent token

        Passing in the connection so it can be rolled back in case of error
        """
        cursor = GlobalDBHandler()._conn.cursor()
        for underlying_token in underlying_tokens:
            # make sure underlying token address is tracked if not already there
            asset_id = GlobalDBHandler.get_ethereum_token_identifier(
                underlying_token.address)  # noqa: E501
            if asset_id is None:
                try:  # underlying token does not exist. Track it
                    cursor.execute(
                        'INSERT INTO ethereum_tokens(address) VALUES(?)',
                        (underlying_token.address, ),
                    )
                    asset_id = ethaddress_to_identifier(
                        underlying_token.address)
                    cursor.execute(
                        """INSERT INTO assets(identifier, type, name, symbol,
                        started, swapped_for, coingecko, cryptocompare, details_reference)
                        VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)""",
                        (asset_id, 'C', None, None, None, None, None, None,
                         underlying_token.address),
                    )
                except sqlite3.IntegrityError as e:
                    connection.rollback()
                    raise InputError(
                        f'Failed to add underlying tokens for {parent_token_address} '
                        f'due to {str(e)}', ) from e
            try:
                cursor.execute(
                    'INSERT INTO underlying_tokens_list(address, weight, parent_token_entry) '
                    'VALUES(?, ?, ?)',
                    (
                        underlying_token.address,
                        str(underlying_token.weight),
                        parent_token_address,
                    ),
                )
            except sqlite3.IntegrityError as e:
                connection.rollback()
                raise InputError(
                    f'Failed to add underlying tokens for {parent_token_address} due to {str(e)}',
                ) from e
コード例 #11
0
ファイル: common.py プロジェクト: LefterisJP/rotkehlchen
def atoken_to_asset(atoken: EthereumToken) -> Optional[Asset]:
    if atoken == A_AETH_V1:
        return A_ETH
    if atoken == A_AREP_V1:
        return A_REP

    asset_symbol = atoken.symbol[1:]
    cursor = GlobalDBHandler().conn.cursor()
    result = cursor.execute(
        'SELECT A.address from ethereum_tokens as A LEFT OUTER JOIN assets as B '
        'WHERE A.address=B.details_reference AND B.symbol=? COLLATE NOCASE',
        (asset_symbol,),
    ).fetchall()
    if len(result) != 1:
        log.error(f'Could not find asset from {atoken} since multiple or no results were returned')
        return None

    return Asset(ethaddress_to_identifier(result[0][0]))
コード例 #12
0
ファイル: test_inquirer.py プロジェクト: jsloane/rotki
def test_find_uniswap_v2_lp_token_price(inquirer, globaldb, ethereum_manager):
    addess = '0xa2107FA5B38d9bbd2C461D6EDf11B11A50F6b974'
    inquirer.inject_ethereum(ethereum_manager)
    token = EthereumToken.initialize(
        address=addess,
        decimals=18,
        name='Uniswap LINK/ETH',
        symbol='UNI-V2',
        protocol='UNI-V2',
    )
    globaldb.add_asset(
        asset_id=ethaddress_to_identifier(addess),
        asset_type=AssetType.ETHEREUM_TOKEN,
        data=token,
    )

    price = inquirer.find_uniswap_v2_lp_price(EthereumToken(addess))
    assert price is not None
コード例 #13
0
    def serialize(
            self,
            pool_tokens: Optional[List[UnderlyingToken]] = None,
    ) -> Dict[str, Any]:
        amounts: Union[List[str], Dict[str, Any]]
        if isinstance(pool_tokens, list) and len(pool_tokens) > 0:
            amounts = {}
            for pool_token, amount in zip(pool_tokens, self.amounts):
                token_identifier = ethaddress_to_identifier(pool_token.address)
                amounts[token_identifier] = str(amount)
        else:
            amounts = [str(amount) for amount in self.amounts]

        return {
            'tx_hash': self.tx_hash,
            'log_index': self.log_index,
            'timestamp': self.timestamp,
            'event_type': str(self.event_type),
            'lp_balance': self.lp_balance.serialize(),
            'amounts': amounts,
        }
コード例 #14
0
ファイル: test_assets.py プロジェクト: rotki/rotki
def test_cryptocompare_asset_support(cryptocompare):
    """Try to detect if a token that we have as not supported by cryptocompare got added"""
    cc_assets = cryptocompare.all_coins()
    exceptions = (
        ethaddress_to_identifier(
            '0xc88Be04c809856B75E3DfE19eB4dCf0a3B15317a'
        ),  # noqa: E501 # Bankcoin Cash but Balkan Coin in CC
        ethaddress_to_identifier('0xEf51c9377FeB29856E61625cAf9390bD0B67eA18'
                                 ),  # noqa: E501 # Bionic but Benja Coin in CC
        'BTG-2',  # Bitgem but Bitcoin Gold in CC
        ethaddress_to_identifier('0x499A6B77bc25C26bCf8265E2102B1B3dd1617024'
                                 ),  # noqa: E501 # Bitether but Bither in CC
        'CBC-2',  # Cashbery coin but Casino Betting Coin in CC
        ethaddress_to_identifier(
            '0x17B26400621695c2D8C2D8869f6259E82D7544c4'
        ),  # noqa: E501 #  CustomContractnetwork but CannaCoin in CC
        ethaddress_to_identifier('0xa456b515303B2Ce344E9d2601f91270f8c2Fea5E'
                                 ),  # noqa: E501 # Cornichon but Corn in CC
        'CTX',  # Centauri coin but CarTaxi in CC
        ethaddress_to_identifier(
            '0xf14922001A2FB8541a433905437ae954419C2439'
        ),  # noqa: E501 # Direct insurance token but DitCoin in CC
        'DRM',  # Dreamcoin but Dreamchain in CC
        ethaddress_to_identifier(
            '0x82fdedfB7635441aA5A92791D001fA7388da8025'
        ),  # noqa: E501 # Digital Ticks but Data Exchange in CC
        'GNC',  # Galaxy network but Greencoin in CC
        ethaddress_to_identifier(
            '0xfF5c25D2F40B47C4a37f989DE933E26562Ef0Ac0'
        ),  # noqa: E501 # Kora network but Knekted in CC
        ethaddress_to_identifier('0x49bD2DA75b1F7AF1E4dFd6b1125FEcDe59dBec58'
                                 ),  # noqa: E501 # Linkey but LuckyCoin in CC
        ethaddress_to_identifier(
            '0x5D4d57cd06Fa7fe99e26fdc481b468f77f05073C'
        ),  # noqa: E501 # Netkoin but Neurotoken in CC
        ethaddress_to_identifier('0xD56daC73A4d6766464b38ec6D91eB45Ce7457c44'
                                 ),  # noqa: E501 # Panvala but Pantos in CC
        ethaddress_to_identifier(
            '0x4689a4e169eB39cC9078C0940e21ff1Aa8A39B9C'
        ),  # noqa: E501 # Proton token but Pink Taxi Token in CC
        ethaddress_to_identifier(
            '0x7Dc4f41294697a7903C4027f6Ac528C5d14cd7eB'
        ),  # noqa: E501 # Remicoin but Russian Miner Coin in CC
        ethaddress_to_identifier(
            '0xBb1f24C0c1554b9990222f036b0AaD6Ee4CAec29'
        ),  # noqa: E501 # Cryptosoul but Phantasma in CC
        ethaddress_to_identifier(
            '0x72430A612Adc007c50e3b6946dBb1Bb0fd3101D1'
        ),  # noqa: E501 # Thingschain but True Investment Coin in CC
        ethaddress_to_identifier(
            '0x9a49f02e128a8E989b443a8f94843C0918BF45E7'
        ),  # noqa: E501 # TOKOK but Tokugawa Coin in CC
        ethaddress_to_identifier(
            '0x9a9bB9b4b11BF8eccff84B58a6CCCCD4058A7f0D'
        ),  # noqa: E501 # Bitcoin card but Vindax Coin in CC
        ethaddress_to_identifier(
            '0x1da015eA4AD2d3e5586E54b9fB0682Ca3CA8A17a'
        ),  # noqa: E501 # Dragon Token but Dark Token in CC
        ethaddress_to_identifier(
            '0x9C78EE466D6Cb57A4d01Fd887D2b5dFb2D46288f'
        ),  # noqa: E501 # Must (Cometh) but Must protocol in CC
        ethaddress_to_identifier(
            '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F'
        ),  # noqa: E501 # Stake DAO token but TerraSDT in CC
        ethaddress_to_identifier('0x3449FC1Cd036255BA1EB19d65fF4BA2b8903A69a'
                                 ),  # noqa: E501 # Basis Cash but BACoin in CC
        ethaddress_to_identifier(
            '0xaF1250fa68D7DECD34fD75dE8742Bc03B29BD58e'
        ),  # noqa: E501 # waiting until cryptocompare fixes historical price for this. https://github.com/rotki/rotki/pull/2176
        'FLOW',  # FLOW from dapper labs but "Flow Protocol" in CC
        ethaddress_to_identifier(
            '0x8A9c4dfe8b9D8962B31e4e16F8321C44d48e246E'
        ),  # noqa: E501 # Name change token but Polyswarm in CC
        ethaddress_to_identifier(
            '0x1966d718A565566e8E202792658D7b5Ff4ECe469'
        ),  # noqa: E501 # newdex token but Index token in CC
        ethaddress_to_identifier(
            '0x1F3f9D3068568F8040775be2e8C03C103C61f3aF'
        ),  # noqa: E501 # Archer DAO Governance token but Archcoin in CC
        ethaddress_to_identifier(
            '0x9A0aBA393aac4dFbFf4333B06c407458002C6183'
        ),  # noqa: E501 # Acoconut token but Asiacoin in CC
        ethaddress_to_identifier(
            '0x6a6c2adA3Ce053561C2FbC3eE211F23d9b8C520a'
        ),  # noqa: E501 # Tontoken but Tokamak network in CC
        ethaddress_to_identifier(
            '0xB5FE099475d3030DDe498c3BB6F3854F762A48Ad'
        ),  # noqa: E501 # Finiko token but FunKeyPai network in CC
        ethaddress_to_identifier(
            '0xb0dFd28d3CF7A5897C694904Ace292539242f858'
        ),  # noqa: E501 # Lotto token but LottoCoin in CC
        ethaddress_to_identifier(
            '0xE4E822C0d5b329E8BB637972467d2E313824eFA0'
        ),  # noqa: E501 # Dfinance token but XFinance in CC
        ethaddress_to_identifier(
            '0xE081b71Ed098FBe1108EA48e235b74F122272E68'
        ),  # noqa: E501 # Gold token but Golden Goose in CC
        'ACM',  # AC Milan Fan Token but Actinium in CC
        'TFC',  # TheFutbolCoin but The Freedom Coin in CC
        ethaddress_to_identifier(
            '0x69af81e73A73B40adF4f3d4223Cd9b1ECE623074'
        ),  # noqa: E501 # Mask Network but NFTX Hashmask Index in CC
        ethaddress_to_identifier(
            '0xE4f726Adc8e89C6a6017F01eadA77865dB22dA14'
        ),  # noqa: E501 # balanced crypto pie but 0xE4f726Adc8e89C6a6017F01eadA77865dB22dA14 in CC
        ethaddress_to_identifier(
            '0x7aBc60B3290F68c85f495fD2e0c3Bd278837a313'
        ),  # noqa: E501 # Cyber Movie Chain but Crowdmachine in CC
        ethaddress_to_identifier(
            '0xBAE235823D7255D9D48635cEd4735227244Cd583'
        ),  # noqa: E501 # Staker Token but Gateio Stater in CC
        ethaddress_to_identifier(
            '0xe2DA716381d7E0032CECaA5046b34223fC3f218D'
        ),  # noqa: E501 # Carbon Utility Token but CUTCoin in CC
        ethaddress_to_identifier(
            '0x1FA3bc860bF823d792f04F662f3AA3a500a68814'
        ),  # noqa: E501 # 1X Short Bitcoin Token but Hedgecoin in CC
        ethaddress_to_identifier(
            '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B'
        ),  # noqa: E501 # Tribe Token (FEI) but another TribeToken in CC
        ethaddress_to_identifier(
            '0x16980b3B4a3f9D89E33311B5aa8f80303E5ca4F8'
        ),  # noqa: E501 # Kira Network (KEX) but another KEX in CC
        'DON',  # Donnie Finance but Donation Coin in CC
        'BAG',  # Baguette but not in CC
        ethaddress_to_identifier(
            '0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F'
        ),  # noqa: E501 # Gitcoin (GTC) but another GTC in CC
        ethaddress_to_identifier(
            '0x6D0F5149c502faf215C89ab306ec3E50b15e2892'
        ),  # noqa: E501 # Portion (PRT) but another PRT in CC
        'ANI',  # Animecoin (ANI) but another ANI in CC
        'XEP',  # Electra Protocol (XEP) but another XEP in CC
        ethaddress_to_identifier(
            '0xcbb20D755ABAD34cb4a9b5fF6Dd081C76769f62e'
        ),  # noqa: E501 # Cash Global Coin (CGC) but another CGC in CC
        ethaddress_to_identifier(
            '0x9BE89D2a4cd102D8Fecc6BF9dA793be995C22541'
        ),  # noqa: E501 # Binance Wrapped BTC (BBTC) but another BBTC in CC
        'NRV',  # Nerve Finance (NRV) but another NRV in CC
        'EDR-2',  # Endor Protocol Token but we have E-Dinar Coin
        ethaddress_to_identifier(
            '0xDa007777D86AC6d989cC9f79A73261b3fC5e0DA0'
        ),  # noqa: E501 # Dappnode (NODE) but another NODE in CC
        'QI',  # noqa: E501 # BENQI (QI) but another QI in CC
        ethaddress_to_identifier(
            '0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5'
        ),  # noqa: E501 # BitDao (BIT) but another BIT in CC
        ethaddress_to_identifier(
            '0x993864E43Caa7F7F12953AD6fEb1d1Ca635B875F'
        ),  # noqa: E501 # Singularity DAO (SDAO) but another SDAO in CC
        ethaddress_to_identifier(
            '0x114f1388fAB456c4bA31B1850b244Eedcd024136'
        ),  # noqa: E501 # Cool Vauld (COOL) but another COOL in CC
        ethaddress_to_identifier(
            '0xD70240Dd62F4ea9a6A2416e0073D72139489d2AA'
        ),  # noqa: E501 # Glyph vault (GLYPH) but another GLYPH in CC
        ethaddress_to_identifier(
            '0x269616D549D7e8Eaa82DFb17028d0B212D11232A'
        ),  # noqa: E501 # PUNK vault (PUNK) but another PUNK in CC
        ethaddress_to_identifier(
            '0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198'
        ),  # noqa: E501 # Bankless token (BANK) but another BANK in CC
        ethaddress_to_identifier(
            '0x1456688345527bE1f37E9e627DA0837D6f08C925'
        ),  # noqa: E501 # USDP stablecoin (USDP) but another USDP in CC
        'POLIS',  # noqa: E501 # Star Atlas DAO (POLIS) but another POLIS in CC
        ethaddress_to_identifier(
            '0x670f9D9a26D3D42030794ff035d35a67AA092ead'
        ),  # noqa: E501 # XBullion Token (GOLD) but another GOLD in CC
        ethaddress_to_identifier(
            '0x3b58c52C03ca5Eb619EBa171091c86C34d603e5f'
        ),  # noqa: E501 # MCI Coin (MCI) but another MCI in CC
        ethaddress_to_identifier(
            '0x5dD57Da40e6866C9FcC34F4b6DDC89F1BA740DfE'
        ),  # noqa: E501 # Bright(BRIGHT) but another BRIGHT in CC
        ethaddress_to_identifier(
            '0x40284109c3309A7C3439111bFD93BF5E0fBB706c'
        ),  # noqa: E501 # Motiv protocol but another MOV in CC
        ethaddress_to_identifier(
            '0xba5BDe662c17e2aDFF1075610382B9B691296350'
        ),  # noqa: E501 # Super Rare but another RARE in CC
        ethaddress_to_identifier(
            '0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54'
        ),  # noqa: E501 # SSV token but another SSV in CC
        ethaddress_to_identifier(
            '0x7b35Ce522CB72e4077BaeB96Cb923A5529764a00'
        ),  # noqa: E501 # Impermax but another IMX in CC
        ethaddress_to_identifier(
            '0x47481c1b44F2A1c0135c45AA402CE4F4dDE4D30e'
        ),  # noqa: E501 # Meetple but another MPT in CC
        'CATE',  # catecoin but another CATE in CC
        'CHESS'  # tranchess but another CHESS in CC
        'BNC',  # Bifrost but another BNC in CC
        'BNX',  # BinaryX but anohter BNX in CC
        'DAR',  # Mines of Dalarnia but a different DAR in CC
        ethaddress_to_identifier(
            '0xEf51c9377FeB29856E61625cAf9390bD0B67eA18'
        ),  # noqa: E501 # Bionic but another BNC in CC
        'CHESS',  # tranchess but another chess in CC
        'BNC',  # bifrost but another BNC in CC
        ethaddress_to_identifier(
            '0x9e6C59321CEB205d5d3BC6c539c017aF6159B16c'
        ),  # noqa: E501 # Mindcell but another MDC in CC
        'TIME',  # Wonderland but another TIME in CC
        'STARS',  # StarLaunch but another STARS in CC
        ethaddress_to_identifier(
            '0x60EF10EDfF6D600cD91caeCA04caED2a2e605Fe5'
        ),  # noqa: E501 # Mochi inu but MOCHI SWAP in CC
        ethaddress_to_identifier(
            '0x3496B523e5C00a4b4150D6721320CdDb234c3079'
        ),  # noqa: E501 # numbers protocol but another NUM in CC
        ethaddress_to_identifier(
            '0x8dB253a1943DdDf1AF9bcF8706ac9A0Ce939d922'
        ),  # noqa: E501 # unbound protocol but another UNB in CC
        'GODZ',  # gozilla but another GODZ in CC
        'DFL',  # Defi land but another DFL in CC
        'CDEX',  # Codex but another CDEX in CC
        'MIMO',  # mimosa but another MIMO in CC
    )
    for asset_data in GlobalDBHandler().get_all_asset_data(mapping=False):
        potential_support = (asset_data.cryptocompare == ''
                             and asset_data.symbol in cc_assets
                             and asset_data.identifier not in exceptions)
        if potential_support:
            msg = (
                f'We have {asset_data.identifier} with symbol {asset_data.symbol} as not supported'
                f' by cryptocompare but the symbol appears in its supported assets'
            )
            test_warnings.warn(UserWarning(msg))
コード例 #15
0
ファイル: test_assets.py プロジェクト: trolleypoleking/rotki
def test_coingecko_identifiers_are_reachable(data_dir):
    """
    Test that all assets have a coingecko entry and that all the identifiers exist in coingecko
    """
    coingecko = Coingecko(data_directory=data_dir)
    all_coins = coingecko.all_coins()
    # If coingecko identifier is missing test is trying to suggest possible assets.
    symbol_checked_exceptions = (  # This is the list of already checked assets
        # only 300 in coingecko is spartan coin: https://www.coingecko.com/en/coins/spartan
        ethaddress_to_identifier('0xaEc98A708810414878c3BCDF46Aad31dEd4a4557'),
        # no arcade city in coingeko. Got other ARC symbol tokens
        ethaddress_to_identifier('0xAc709FcB44a43c35F0DA4e3163b117A17F3770f5'),
        # no avalon in coingecko. Got travalala.com
        ethaddress_to_identifier('0xeD247980396B10169BB1d36f6e278eD16700a60f'),
        # no Bionic in coingecko. Got Bnoincoin
        ethaddress_to_identifier('0xEf51c9377FeB29856E61625cAf9390bD0B67eA18'),
        # no Bitair in coingecko. Got other BTCA symbol tokens
        ethaddress_to_identifier('0x02725836ebF3eCDb1cDf1c7b02FcbBfaa2736AF8'),
        # no Bither in coingecko. Got other BTR symbol tokens
        ethaddress_to_identifier('0xcbf15FB8246F679F9Df0135881CB29a3746f734b'),
        # no Content and Ad Network in coingecko. Got other CAN symbol tokens
        ethaddress_to_identifier('0x5f3789907b35DCe5605b00C0bE0a7eCDBFa8A841'),
        # no DICE money in coingecko. Got other CET symbol tokens
        ethaddress_to_identifier('0xF660cA1e228e7BE1fA8B4f5583145E31147FB577'),
        # no Cyberfi in coingecko. Got other CFI symbol tokens
        ethaddress_to_identifier('0x12FEF5e57bF45873Cd9B62E9DBd7BFb99e32D73e'),
        # The DAO is not in coingecko. Got other DAO symbol tokens
        ethaddress_to_identifier('0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413'),
        # no Earth Token in coingecko. Got other EARTH symbol token and in BSC
        ethaddress_to_identifier('0x900b4449236a7bb26b286601dD14d2bDe7a6aC6c'),
        # no iDice in coingecko. Got other ICE symbol token
        ethaddress_to_identifier('0x5a84969bb663fb64F6d015DcF9F622Aedc796750'),
        # no InvestFeed token in coingecko. Got other IFT symbol token
        ethaddress_to_identifier('0x7654915A1b82D6D2D0AFc37c52Af556eA8983c7E'),
        # no Invacio token in coingecko. Got other INV symbol token
        ethaddress_to_identifier('0xEcE83617Db208Ad255Ad4f45Daf81E25137535bb'),
        # no Live Start token in coingecko. Got other LIVE symbol token
        ethaddress_to_identifier('0x24A77c1F17C547105E14813e517be06b0040aa76'),
        # no Musiconomi in coingecko. Got other MCI symbol token
        ethaddress_to_identifier('0x138A8752093F4f9a79AaeDF48d4B9248fab93c9C'),
        # no Remicoin in coingecko. Got other RMC symbol token
        ethaddress_to_identifier('0x7Dc4f41294697a7903C4027f6Ac528C5d14cd7eB'),
        # no Sola token in coingecko. Got other SOL symbol token
        ethaddress_to_identifier('0x1F54638b7737193FFd86c19Ec51907A7c41755D8'),
        # no Bitcoin card token in coingecko. Got other VD symbol token
        ethaddress_to_identifier('0x9a9bB9b4b11BF8eccff84B58a6CCCCD4058A7f0D'),
        # no Venus Energy token in coingecko. Got other VENUS symbol token
        ethaddress_to_identifier('0xEbeD4fF9fe34413db8fC8294556BBD1528a4DAca'),
        # no WinToken in coingecko. Got other WIN symbol token
        ethaddress_to_identifier('0xBfaA8cF522136C6FAfC1D53Fe4b85b4603c765b8'),
        # no Snowball in coingecko. Got other SNBL symbol token
        ethaddress_to_identifier('0x198A87b3114143913d4229Fb0f6D4BCb44aa8AFF'),
        'ACC',  # no Adcoin in Coingecko. Got other ACC symbol token
        'APH',  # no Aphelion in Coingecko. Got other APH symbol token
        'ARCH',  # no ARCH in Coingecko. Got other ARCH symbol token
        'BET-2',  # no BetaCoin in Coingecko. Got other BET symbol token
        'CCN-2',  # no CannaCoin in Coingecko. Got other CCN symbol token
        'CHAT',  # no ChatCoin in Coingecko. Got other CHAT symbol token
        'CMT-2',  # no Comet in Coingecko. Got other CMT symbol token
        'CRC-2',  # no CrownCoin in Coingecko. Got other CRC symbol token
        'CYC',  # no ConspiracyCoin in Coingecko. Got other CYC symbol token
        'EDR-2',  # no E-Dinar coin in Coingecko. Got other EDR symbol token
        'FLAP',  # no FlappyCoin coin in Coingecko. Got other FLAP symbol token
        'HC-2',  # no Harvest Masternode Coin in Coingecko. Got other HC symbol token
        'KEY-3',  # no KeyCoin Coin in Coingecko. Got other KEY symbol token
        'OCC',  # no Octoin Coin in Coingecko. Got other OCC symbol token
        'SPA',  # no SpainCoin Coin in Coingecko. Got other SPA symbol token
        'WEB-2',  # no Webchain in Coingecko. Got other WEB symbol token
        'WOLF',  # no Insanity Coin in Coingecko. Got other WOLF symbol token
        'XPB',  # no Pebble Coin in Coingecko. Got other XPB symbol token
        'XNS',  # no Insolar in Coingecko. Got other XNS symbol token
    )
    for asset_data in GlobalDBHandler().get_all_asset_data(mapping=False):
        identifier = asset_data.identifier
        if identifier in DELISTED_ASSETS:
            # delisted assets won't be in the mapping
            continue

        if asset_data.asset_type == AssetType.FIAT:
            continue

        found = True
        coingecko_str = asset_data.coingecko
        have_id = True
        if coingecko_str is not None or coingecko_str != '':
            have_id = False
            found = False
            for entry in all_coins:
                if coingecko_str == entry['id']:
                    found = True
                    break

        suggestions = []
        if not found:
            for entry in all_coins:
                if entry['symbol'].upper() == asset_data.symbol.upper():
                    suggestions.append((entry['id'], entry['name'], entry['symbol']))
                    continue

                if entry['name'].upper() == asset_data.symbol.upper():
                    suggestions.append((entry['id'], entry['name'], entry['symbol']))
                    continue

        if have_id is False and (len(suggestions) == 0 or identifier in symbol_checked_exceptions):
            continue  # no coingecko identifier and no suggestion or is in known exception

        msg = f'Asset {identifier} with symbol {asset_data.symbol} coingecko mapping does not exist.'  # noqa: E501
        if len(suggestions) != 0:
            for s in suggestions:
                msg += f'\nSuggestion: id:{s[0]} name:{s[1]} symbol:{s[2]}'
        if not found:
            test_warnings.warn(UserWarning(msg))
コード例 #16
0
def test_coingecko_identifiers_are_reachable():
    """
    Test that all assets have a coingecko entry and that all the identifiers exist in coingecko
    """
    coingecko = Coingecko()
    all_coins = coingecko.all_coins()
    # If coingecko identifier is missing test is trying to suggest possible assets.
    symbol_checked_exceptions = (  # This is the list of already checked assets
        # only 300 in coingecko is spartan coin: https://www.coingecko.com/en/coins/spartan
        ethaddress_to_identifier('0xaEc98A708810414878c3BCDF46Aad31dEd4a4557'),
        # no arcade city in coingeko. Got other ARC symbol tokens
        ethaddress_to_identifier('0xAc709FcB44a43c35F0DA4e3163b117A17F3770f5'),
        # no avalon in coingecko. Got travalala.com
        ethaddress_to_identifier('0xeD247980396B10169BB1d36f6e278eD16700a60f'),
        # no Bionic in coingecko. Got Bnoincoin
        ethaddress_to_identifier('0xEf51c9377FeB29856E61625cAf9390bD0B67eA18'),
        # no Bitair in coingecko. Got other BTCA symbol tokens
        ethaddress_to_identifier('0x02725836ebF3eCDb1cDf1c7b02FcbBfaa2736AF8'),
        # no Bither in coingecko. Got other BTR symbol tokens
        ethaddress_to_identifier('0xcbf15FB8246F679F9Df0135881CB29a3746f734b'),
        # no Content and Ad Network in coingecko. Got other CAN symbol tokens
        ethaddress_to_identifier('0x5f3789907b35DCe5605b00C0bE0a7eCDBFa8A841'),
        # no DICE money in coingecko. Got other CET symbol tokens
        ethaddress_to_identifier('0xF660cA1e228e7BE1fA8B4f5583145E31147FB577'),
        # no Cyberfi in coingecko. Got other CFI symbol tokens
        ethaddress_to_identifier('0x12FEF5e57bF45873Cd9B62E9DBd7BFb99e32D73e'),
        # The DAO is not in coingecko. Got other DAO symbol tokens
        ethaddress_to_identifier('0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413'),
        # no Earth Token in coingecko. Got other EARTH symbol token and in BSC
        ethaddress_to_identifier('0x900b4449236a7bb26b286601dD14d2bDe7a6aC6c'),
        # no iDice in coingecko. Got other ICE symbol token
        ethaddress_to_identifier('0x5a84969bb663fb64F6d015DcF9F622Aedc796750'),
        # no InvestFeed token in coingecko. Got other IFT symbol token
        ethaddress_to_identifier('0x7654915A1b82D6D2D0AFc37c52Af556eA8983c7E'),
        # no Invacio token in coingecko. Got other INV symbol token
        ethaddress_to_identifier('0xEcE83617Db208Ad255Ad4f45Daf81E25137535bb'),
        # no Live Start token in coingecko. Got other LIVE symbol token
        ethaddress_to_identifier('0x24A77c1F17C547105E14813e517be06b0040aa76'),
        # no Musiconomi in coingecko. Got other MCI symbol token
        ethaddress_to_identifier('0x138A8752093F4f9a79AaeDF48d4B9248fab93c9C'),
        # no Remicoin in coingecko. Got other RMC symbol token
        ethaddress_to_identifier('0x7Dc4f41294697a7903C4027f6Ac528C5d14cd7eB'),
        # no Sola token in coingecko. Got other SOL symbol token
        ethaddress_to_identifier('0x1F54638b7737193FFd86c19Ec51907A7c41755D8'),
        # no Bitcoin card token in coingecko. Got other VD symbol token
        ethaddress_to_identifier('0x9a9bB9b4b11BF8eccff84B58a6CCCCD4058A7f0D'),
        # no Venus Energy token in coingecko. Got other VENUS symbol token
        ethaddress_to_identifier('0xEbeD4fF9fe34413db8fC8294556BBD1528a4DAca'),
        # no WinToken in coingecko. Got other WIN symbol token
        ethaddress_to_identifier('0xBfaA8cF522136C6FAfC1D53Fe4b85b4603c765b8'),
        # no Snowball in coingecko. Got other SNBL symbol token
        ethaddress_to_identifier('0x198A87b3114143913d4229Fb0f6D4BCb44aa8AFF'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xFD25676Fc2c4421778B18Ec7Ab86E7C5701DF187'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xcca0c9c383076649604eE31b20248BC04FdF61cA'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xAef38fBFBF932D1AeF3B808Bc8fBd8Cd8E1f8BC5'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0x662aBcAd0b7f345AB7FfB1b1fbb9Df7894f18e66'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0x497bAEF294c11a5f0f5Bea3f2AdB3073DB448B56'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xAbdf147870235FcFC34153828c769A70B3FAe01F'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0x4DF47B4969B2911C966506E3592c41389493953b'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xB563300A3BAc79FC09B93b6F84CE0d4465A2AC27'),
        'ACC',  # no Adcoin in Coingecko. Got other ACC symbol token
        'APH',  # no Aphelion in Coingecko. Got other APH symbol token
        'ARCH',  # no ARCH in Coingecko. Got other ARCH symbol token
        'BET-2',  # no BetaCoin in Coingecko. Got other BET symbol token
        'CCN-2',  # no CannaCoin in Coingecko. Got other CCN symbol token
        'CHAT',  # no ChatCoin in Coingecko. Got other CHAT symbol token
        'CMT-2',  # no Comet in Coingecko. Got other CMT symbol token
        'CRC-2',  # no CrownCoin in Coingecko. Got other CRC symbol token
        'CYC',  # no ConspiracyCoin in Coingecko. Got other CYC symbol token
        'EDR-2',  # no E-Dinar coin in Coingecko. Got other EDR symbol token
        'FLAP',  # no FlappyCoin coin in Coingecko. Got other FLAP symbol token
        'HC-2',  # no Harvest Masternode Coin in Coingecko. Got other HC symbol token
        'KEY-3',  # no KeyCoin Coin in Coingecko. Got other KEY symbol token
        'MUSIC',  # Music in coingecko is nftmusic and not our MUSIC
        'NAUT',  # Token suggestion doesn't match token in db
        'OCC',  # no Octoin Coin in Coingecko. Got other OCC symbol token
        'SPA',  # no SpainCoin Coin in Coingecko. Got other SPA symbol token
        'WEB-2',  # no Webchain in Coingecko. Got other WEB symbol token
        'WOLF',  # no Insanity Coin in Coingecko. Got other WOLF symbol token
        'XAI',  # Token suggestion doesn't match token in db
        'XPB',  # no Pebble Coin in Coingecko. Got other XPB symbol token
        'XNS',  # no Insolar in Coingecko. Got other XNS symbol token
        'PIGGY',  # Coingecko listed another asset PIGGY that is not Piggy Coin
        # coingecko listed CAR that is not our token CarBlock.io
        ethaddress_to_identifier('0x4D9e23a3842fE7Eb7682B9725cF6c507C424A41B'),
        # coingecko listed newb farm with symbol NEWB that is not our newb
        ethaddress_to_identifier('0x5A63Eb358a751b76e58325eadD86c2473fC40e87'),
        # coingecko has BigBang Core (BBC) that is not tradove
        ethaddress_to_identifier('0xe7D3e4413E29ae35B0893140F4500965c74365e5'),
        # MNT is Meownaut in coingecko and not media network token
        ethaddress_to_identifier('0xA9877b1e05D035899131DBd1e403825166D09f92'),
        # Project quantum in coingecko but we have Qubitica
        ethaddress_to_identifier('0xCb5ea3c190d8f82DEADF7ce5Af855dDbf33e3962'),
        # We have Cashbery Coin for symbol CBC that is not listed in the coingecko list
        'CBC-2',
    )
    for asset_data in GlobalDBHandler().get_all_asset_data(mapping=False):
        identifier = asset_data.identifier
        if identifier in DELISTED_ASSETS:
            # delisted assets won't be in the mapping
            continue

        if asset_data.asset_type == AssetType.FIAT:
            continue

        found = True
        coingecko_str = asset_data.coingecko
        have_id = True
        if coingecko_str is not None or coingecko_str != '':
            have_id = False
            found = False
            for entry in all_coins:
                if coingecko_str == entry['id']:
                    found = True
                    break

        suggestions = []
        if not found:
            for entry in all_coins:
                if entry['symbol'].upper() == asset_data.symbol.upper():
                    suggestions.append(
                        (entry['id'], entry['name'], entry['symbol']))
                    continue

                if entry['name'].upper() == asset_data.symbol.upper():
                    suggestions.append(
                        (entry['id'], entry['name'], entry['symbol']))
                    continue

        if have_id is False and (len(suggestions) == 0
                                 or identifier in symbol_checked_exceptions):
            continue  # no coingecko identifier and no suggestion or is in known exception

        msg = f'Asset {identifier} with symbol {asset_data.symbol} coingecko mapping does not exist.'  # noqa: E501
        if len(suggestions) != 0:
            for s in suggestions:
                msg += f'\nSuggestion: id:{s[0]} name:{s[1]} symbol:{s[2]}'
        if not found:
            test_warnings.warn(UserWarning(msg))
コード例 #17
0
def test_exporting_custom_assets_list(rotkehlchen_api_server, globaldb,
                                      with_custom_path):
    """Test that the endpoint for exporting custom assets works correctly"""
    eth_address = make_ethereum_address()
    identifier = ethaddress_to_identifier(eth_address)
    globaldb.add_asset(
        asset_id=identifier,
        asset_type=AssetType.ETHEREUM_TOKEN,
        data=EthereumToken.initialize(
            address=eth_address,
            decimals=18,
            name='yabirtoken',
            symbol='YAB',
            coingecko='YAB',
            cryptocompare='YAB',
        ),
    )
    with tempfile.TemporaryDirectory() as path:
        if with_custom_path:
            response = requests.put(
                api_url_for(
                    rotkehlchen_api_server,
                    'userassetsresource',
                ),
                json={
                    'action': 'download',
                    'destination': path
                },
            )
        else:
            response = requests.put(
                api_url_for(
                    rotkehlchen_api_server,
                    'userassetsresource',
                ),
                json={'action': 'download'},
            )

        if with_custom_path:
            result = assert_proper_response_with_result(response)
            if with_custom_path:
                assert path in result['file']
            zip_file = ZipFile(result['file'])
            data = json.loads(zip_file.read('assets.json'))
            assert int(data['version']) == GLOBAL_DB_VERSION
            assert len(data['assets']) == 1
            assert data['assets'][0] == {
                'identifier': identifier,
                'name': 'yabirtoken',
                'decimals': 18,
                'symbol': 'YAB',
                'asset_type': 'ethereum token',
                'started': None,
                'forked': None,
                'swapped_for': None,
                'cryptocompare': 'YAB',
                'coingecko': 'YAB',
                'protocol': None,
                'underlying_tokens': None,
                'ethereum_address': eth_address,
            }
        else:
            assert response.status_code == HTTPStatus.OK
            assert response.headers['Content-Type'] == 'application/zip'

        # try to download again to see if the database is properly detached
        response = requests.put(
            api_url_for(
                rotkehlchen_api_server,
                'userassetsresource',
            ),
            json={
                'action': 'download',
                'destination': path
            },
        )
        result = assert_proper_response_with_result(response)
コード例 #18
0
def test_cryptocompare_asset_support(cryptocompare):
    """Try to detect if a token that we have as not supported by cryptocompare got added"""
    cc_assets = cryptocompare.all_coins()
    exceptions = (
        ethaddress_to_identifier(
            '0xc88Be04c809856B75E3DfE19eB4dCf0a3B15317a'
        ),  # noqa: E501 # Bankcoin Cash but Balkan Coin in CC
        ethaddress_to_identifier('0xEf51c9377FeB29856E61625cAf9390bD0B67eA18'
                                 ),  # noqa: E501 # Bionic but Benja Coin in CC
        'BTG-2',  # Bitgem but Bitcoin Gold in CC
        ethaddress_to_identifier('0x499A6B77bc25C26bCf8265E2102B1B3dd1617024'
                                 ),  # noqa: E501 # Bitether but Bither in CC
        'CBC-2',  # Cashbery coin but Casino Betting Coin in CC
        ethaddress_to_identifier(
            '0x17B26400621695c2D8C2D8869f6259E82D7544c4'
        ),  # noqa: E501 #  CustomContractnetwork but CannaCoin in CC
        ethaddress_to_identifier('0xa456b515303B2Ce344E9d2601f91270f8c2Fea5E'
                                 ),  # noqa: E501 # Cornichon but Corn in CC
        'CTX',  # Centauri coin but CarTaxi in CC
        ethaddress_to_identifier(
            '0xf14922001A2FB8541a433905437ae954419C2439'
        ),  # noqa: E501 # Direct insurance token but DitCoin in CC
        'DRM',  # Dreamcoin but Dreamchain in CC
        ethaddress_to_identifier(
            '0x82fdedfB7635441aA5A92791D001fA7388da8025'
        ),  # noqa: E501 # Digital Ticks but Data Exchange in CC
        'GNC',  # Galaxy network but Greencoin in CC
        ethaddress_to_identifier(
            '0xfF5c25D2F40B47C4a37f989DE933E26562Ef0Ac0'
        ),  # noqa: E501 # Kora network but Knekted in CC
        ethaddress_to_identifier('0x49bD2DA75b1F7AF1E4dFd6b1125FEcDe59dBec58'
                                 ),  # noqa: E501 # Linkey but LuckyCoin in CC
        ethaddress_to_identifier(
            '0x5D4d57cd06Fa7fe99e26fdc481b468f77f05073C'
        ),  # noqa: E501 # Netkoin but Neurotoken in CC
        ethaddress_to_identifier('0xD56daC73A4d6766464b38ec6D91eB45Ce7457c44'
                                 ),  # noqa: E501 # Panvala but Pantos in CC
        ethaddress_to_identifier(
            '0x4689a4e169eB39cC9078C0940e21ff1Aa8A39B9C'
        ),  # noqa: E501 # Proton token but Pink Taxi Token in CC
        ethaddress_to_identifier(
            '0x7Dc4f41294697a7903C4027f6Ac528C5d14cd7eB'
        ),  # noqa: E501 # Remicoin but Russian Miner Coin in CC
        ethaddress_to_identifier(
            '0xBb1f24C0c1554b9990222f036b0AaD6Ee4CAec29'
        ),  # noqa: E501 # Cryptosoul but Phantasma in CC
        ethaddress_to_identifier(
            '0x72430A612Adc007c50e3b6946dBb1Bb0fd3101D1'
        ),  # noqa: E501 # Thingschain but True Investment Coin in CC
        ethaddress_to_identifier(
            '0x9a49f02e128a8E989b443a8f94843C0918BF45E7'
        ),  # noqa: E501 # TOKOK but Tokugawa Coin in CC
        ethaddress_to_identifier(
            '0x9a9bB9b4b11BF8eccff84B58a6CCCCD4058A7f0D'
        ),  # noqa: E501 # Bitcoin card but Vindax Coin in CC
        ethaddress_to_identifier(
            '0x1da015eA4AD2d3e5586E54b9fB0682Ca3CA8A17a'
        ),  # noqa: E501 # Dragon Token but Dark Token in CC
        ethaddress_to_identifier(
            '0x9C78EE466D6Cb57A4d01Fd887D2b5dFb2D46288f'
        ),  # noqa: E501 # Must (Cometh) but Must protocol in CC
        ethaddress_to_identifier(
            '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F'
        ),  # noqa: E501 # Stake DAO token but TerraSDT in CC
        ethaddress_to_identifier('0x3449FC1Cd036255BA1EB19d65fF4BA2b8903A69a'
                                 ),  # noqa: E501 # Basis Cash but BACoin in CC
        ethaddress_to_identifier(
            '0xaF1250fa68D7DECD34fD75dE8742Bc03B29BD58e'
        ),  # noqa: E501 # waiting until cryptocompare fixes historical price for this. https://github.com/rotki/rotki/pull/2176
        'FLOW',  # FLOW from dapper labs but "Flow Protocol" in CC
        ethaddress_to_identifier(
            '0x8A9c4dfe8b9D8962B31e4e16F8321C44d48e246E'
        ),  # noqa: E501 # Name change token but Polyswarm in CC
        ethaddress_to_identifier(
            '0x1966d718A565566e8E202792658D7b5Ff4ECe469'
        ),  # noqa: E501 # newdex token but Index token in CC
        ethaddress_to_identifier(
            '0x1F3f9D3068568F8040775be2e8C03C103C61f3aF'
        ),  # noqa: E501 # Archer DAO Governance token but Archcoin in CC
        ethaddress_to_identifier(
            '0x9A0aBA393aac4dFbFf4333B06c407458002C6183'
        ),  # noqa: E501 # Acoconut token but Asiacoin in CC
        ethaddress_to_identifier(
            '0x6a6c2adA3Ce053561C2FbC3eE211F23d9b8C520a'
        ),  # noqa: E501 # Tontoken but Tokamak network in CC
        ethaddress_to_identifier(
            '0xB5FE099475d3030DDe498c3BB6F3854F762A48Ad'
        ),  # noqa: E501 # Finiko token but FunKeyPai network in CC
        ethaddress_to_identifier(
            '0xb0dFd28d3CF7A5897C694904Ace292539242f858'
        ),  # noqa: E501 # Lotto token but LottoCoin in CC
        ethaddress_to_identifier(
            '0xE4E822C0d5b329E8BB637972467d2E313824eFA0'
        ),  # noqa: E501 # Dfinance token but XFinance in CC
        ethaddress_to_identifier(
            '0xE081b71Ed098FBe1108EA48e235b74F122272E68'
        ),  # noqa: E501 # Gold token but Golden Goose in CC
        'ACM',  # AC Milan Fan Token but Actinium in CC
        'TFC',  # TheFutbolCoin but The Freedom Coin in CC
        ethaddress_to_identifier(
            '0x69af81e73A73B40adF4f3d4223Cd9b1ECE623074'
        ),  # noqa: E501 # Mask Network but NFTX Hashmask Index in CC
        ethaddress_to_identifier(
            '0xE4f726Adc8e89C6a6017F01eadA77865dB22dA14'
        ),  # noqa: E501 # balanced crypto pie but 0xE4f726Adc8e89C6a6017F01eadA77865dB22dA14 in CC
        ethaddress_to_identifier(
            '0x7aBc60B3290F68c85f495fD2e0c3Bd278837a313'
        ),  # noqa: E501 # Cyber Movie Chain but Crowdmachine in CC
        ethaddress_to_identifier(
            '0xBAE235823D7255D9D48635cEd4735227244Cd583'
        ),  # noqa: E501 # Staker Token but Gateio Stater in CC
        ethaddress_to_identifier(
            '0xe2DA716381d7E0032CECaA5046b34223fC3f218D'
        ),  # noqa: E501 # Carbon Utility Token but CUTCoin in CC
        ethaddress_to_identifier(
            '0x1FA3bc860bF823d792f04F662f3AA3a500a68814'
        ),  # noqa: E501 # 1X Short Bitcoin Token but Hedgecoin in CC
        ethaddress_to_identifier(
            '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B'
        ),  # noqa: E501 # Tribe Token (FEI) but another TribeToken in CC
        ethaddress_to_identifier(
            '0x16980b3B4a3f9D89E33311B5aa8f80303E5ca4F8'
        ),  # noqa: E501 # Kira Network (KEX) but another KEX in CC
        'DON',  # Donnie Finance but Donation Coin in CC
        'BAG',  # Baguette but not in CC
        ethaddress_to_identifier(
            '0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F'
        ),  # noqa: E501 # Gitcoin (GTC) but another GTC in CC
        ethaddress_to_identifier(
            '0x6D0F5149c502faf215C89ab306ec3E50b15e2892'
        ),  # noqa: E501 # Portion (PRT) but another PRT in CC
        'ANI',  # Animecoin (ANI) but another ANI in CC
        'XEP',  # Electra Protocol (XEP) but another XEP in CC
    )
    for asset_data in GlobalDBHandler().get_all_asset_data(mapping=False):
        potential_support = (asset_data.cryptocompare == ''
                             and asset_data.symbol in cc_assets
                             and asset_data.identifier not in exceptions)
        if potential_support:
            msg = (
                f'We have {asset_data.identifier} with symbol {asset_data.symbol} as not supported'
                f' by cryptocompare but the symbol appears in its supported assets'
            )
            test_warnings.warn(UserWarning(msg))
コード例 #19
0
def test_get_asset_with_symbol(globaldb):
    # both categories of assets
    asset_data = globaldb.get_assets_with_symbol('KEY')
    bihukey_address = string_to_ethereum_address(
        '0x4Cd988AfBad37289BAAf53C13e98E2BD46aAEa8c')
    aave_address = string_to_ethereum_address(
        '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9')
    renbtc_address = string_to_ethereum_address(
        '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D')
    assert asset_data == [
        selfkey_asset_data,
        AssetData(
            identifier=ethaddress_to_identifier(bihukey_address),
            name='Bihu KEY',
            symbol='KEY',
            asset_type=AssetType.ETHEREUM_TOKEN,
            started=1507822985,
            forked=None,
            swapped_for=None,
            ethereum_address=bihukey_address,
            decimals=18,
            cryptocompare='BIHU',
            coingecko='key',
            protocol=None,
        ),
        AssetData(
            identifier='KEY-3',
            name='KeyCoin',
            symbol='KEY',
            asset_type=AssetType.OWN_CHAIN,
            started=1405382400,
            forked=None,
            swapped_for=None,
            ethereum_address=None,
            decimals=None,
            cryptocompare='KEYC',
            coingecko='',
            protocol=None,
        )
    ]
    # only non-ethereum token
    assert globaldb.get_assets_with_symbol('BIDR') == [bidr_asset_data]
    # only ethereum token
    assert globaldb.get_assets_with_symbol('AAVE') == [
        AssetData(
            identifier=ethaddress_to_identifier(aave_address),
            name='Aave Token',
            symbol='AAVE',
            asset_type=AssetType.ETHEREUM_TOKEN,
            started=1600970788,
            forked=None,
            swapped_for=None,
            ethereum_address=aave_address,
            decimals=18,
            cryptocompare=None,
            coingecko='aave',
            protocol=None,
        )
    ]
    # finally non existing asset
    assert globaldb.get_assets_with_symbol('DASDSADSDSDSAD') == []

    # also check that symbol comparison is case insensitive for many arg combinations
    expected_renbtc = [
        AssetData(
            identifier=ethaddress_to_identifier(renbtc_address),
            name='renBTC',
            symbol='renBTC',
            asset_type=AssetType.ETHEREUM_TOKEN,
            started=1585090944,
            forked=None,
            swapped_for=None,
            ethereum_address=renbtc_address,
            decimals=8,
            cryptocompare=None,
            coingecko='renbtc',
            protocol=None,
        )
    ]
    for x in itertools.product(('ReNbTc', 'renbtc', 'RENBTC', 'rEnBTc'),
                               (None, AssetType.ETHEREUM_TOKEN)):  # noqa: E501
        assert globaldb.get_assets_with_symbol(*x) == expected_renbtc
コード例 #20
0
from rotkehlchen.constants.assets import A_BAT, A_CRV, A_DAI, A_PICKLE
from rotkehlchen.constants.misc import NFT_DIRECTIVE
from rotkehlchen.constants.resolver import ethaddress_to_identifier
from rotkehlchen.errors import InputError
from rotkehlchen.exchanges.data_structures import Trade
from rotkehlchen.globaldb.handler import GLOBAL_DB_VERSION, GlobalDBHandler
from rotkehlchen.history.typing import HistoricalPriceOracle
from rotkehlchen.serialization.deserialize import deserialize_asset_amount
from rotkehlchen.tests.fixtures.globaldb import create_globaldb
from rotkehlchen.tests.utils.factories import make_ethereum_address
from rotkehlchen.tests.utils.globaldb import INITIAL_TOKENS
from rotkehlchen.typing import Location, Price, Timestamp, TradeType

selfkey_address = string_to_ethereum_address(
    '0x4CC19356f2D37338b9802aa8E8fc58B0373296E7')
selfkey_id = ethaddress_to_identifier(selfkey_address)
selfkey_asset_data = AssetData(
    identifier=selfkey_id,
    name='Selfkey',
    symbol='KEY',
    asset_type=AssetType.ETHEREUM_TOKEN,
    started=Timestamp(1508803200),
    forked=None,
    swapped_for=None,
    ethereum_address=selfkey_address,
    decimals=18,
    cryptocompare=None,
    coingecko='selfkey',
    protocol=None,
)
bidr_asset_data = AssetData(
コード例 #21
0
ファイル: handler.py プロジェクト: step21/rotki
    def edit_ethereum_token(entry: CustomEthereumToken, ) -> str:
        """Edits an ethereum token entry in the DB

        May raise InputError if there is an error during updating

        Returns the token's rotki identifier
        """
        connection = GlobalDBHandler()._conn
        cursor = connection.cursor()
        try:
            cursor.execute(
                'UPDATE assets SET name=?, symbol=?, started=?, swapped_for=?, '
                'coingecko=?, cryptocompare=? WHERE identifier=?;',
                (
                    entry.name,
                    entry.symbol,
                    entry.started,
                    entry.swapped_for.identifier
                    if entry.swapped_for else None,
                    entry.coingecko,
                    entry.cryptocompare,
                    ethaddress_to_identifier(entry.address),
                ),
            )
            cursor.execute(
                'UPDATE ethereum_tokens SET decimals=?, protocol=? WHERE address = ?',
                (entry.decimals, entry.protocol, entry.address),
            )
        except sqlite3.IntegrityError as e:
            raise InputError(
                f'Failed to update DB entry for ethereum token with address {entry.address} '
                f'due to a constraint being hit. Make sure the new values are valid ',
            ) from e

        if cursor.rowcount != 1:
            raise InputError(
                f'Tried to edit non existing ethereum token with address {entry.address}',
            )

        # Since this is editing, make sure no underlying tokens exist
        cursor.execute(
            'DELETE from underlying_tokens_list WHERE parent_token_entry=?',
            (entry.address, ),
        )
        if entry.underlying_tokens is not None:  # and now add any if needed
            GlobalDBHandler()._add_underlying_tokens(
                connection=connection,
                parent_token_address=entry.address,
                underlying_tokens=entry.underlying_tokens,
            )

        rotki_id = GlobalDBHandler().get_ethereum_token_identifier(
            entry.address)
        if rotki_id is None:
            connection.rollback()
            raise InputError(
                f'Unexpected DB state. Ethereum token {entry.address} exists in the DB '
                f'but its corresponding asset entry was not found.', )

        connection.commit()
        return rotki_id
コード例 #22
0
ファイル: test_assets.py プロジェクト: rotki/rotki
def test_coingecko_identifiers_are_reachable():
    """
    Test that all assets have a coingecko entry and that all the identifiers exist in coingecko
    """
    coingecko = Coingecko()
    all_coins = coingecko.all_coins()
    # If coingecko identifier is missing test is trying to suggest possible assets.
    symbol_checked_exceptions = (  # This is the list of already checked assets
        # only 300 in coingecko is spartan coin: https://www.coingecko.com/en/coins/spartan
        ethaddress_to_identifier('0xaEc98A708810414878c3BCDF46Aad31dEd4a4557'),
        # no arcade city in coingeko. Got other ARC symbol tokens
        ethaddress_to_identifier('0xAc709FcB44a43c35F0DA4e3163b117A17F3770f5'),
        # no avalon in coingecko. Got travalala.com
        ethaddress_to_identifier('0xeD247980396B10169BB1d36f6e278eD16700a60f'),
        # no Bionic in coingecko. Got Bnoincoin
        ethaddress_to_identifier('0xEf51c9377FeB29856E61625cAf9390bD0B67eA18'),
        # no Bitair in coingecko. Got other BTCA symbol tokens
        ethaddress_to_identifier('0x02725836ebF3eCDb1cDf1c7b02FcbBfaa2736AF8'),
        # no Bither in coingecko. Got other BTR symbol tokens
        ethaddress_to_identifier('0xcbf15FB8246F679F9Df0135881CB29a3746f734b'),
        # no Content and Ad Network in coingecko. Got other CAN symbol tokens
        ethaddress_to_identifier('0x5f3789907b35DCe5605b00C0bE0a7eCDBFa8A841'),
        # no DICE money in coingecko. Got other CET symbol tokens
        ethaddress_to_identifier('0xF660cA1e228e7BE1fA8B4f5583145E31147FB577'),
        # no Cyberfi in coingecko. Got other CFI symbol tokens
        ethaddress_to_identifier('0x12FEF5e57bF45873Cd9B62E9DBd7BFb99e32D73e'),
        # The DAO is not in coingecko. Got other DAO symbol tokens
        ethaddress_to_identifier('0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413'),
        # no Earth Token in coingecko. Got other EARTH symbol token and in BSC
        ethaddress_to_identifier('0x900b4449236a7bb26b286601dD14d2bDe7a6aC6c'),
        # no iDice in coingecko. Got other ICE symbol token
        ethaddress_to_identifier('0x5a84969bb663fb64F6d015DcF9F622Aedc796750'),
        # no InvestFeed token in coingecko. Got other IFT symbol token
        ethaddress_to_identifier('0x7654915A1b82D6D2D0AFc37c52Af556eA8983c7E'),
        # no Invacio token in coingecko. Got other INV symbol token
        ethaddress_to_identifier('0xEcE83617Db208Ad255Ad4f45Daf81E25137535bb'),
        # no Live Start token in coingecko. Got other LIVE symbol token
        ethaddress_to_identifier('0x24A77c1F17C547105E14813e517be06b0040aa76'),
        # no Musiconomi in coingecko. Got other MCI symbol token
        ethaddress_to_identifier('0x138A8752093F4f9a79AaeDF48d4B9248fab93c9C'),
        # no Remicoin in coingecko. Got other RMC symbol token
        ethaddress_to_identifier('0x7Dc4f41294697a7903C4027f6Ac528C5d14cd7eB'),
        # no Sola token in coingecko. Got other SOL symbol token
        ethaddress_to_identifier('0x1F54638b7737193FFd86c19Ec51907A7c41755D8'),
        # no Bitcoin card token in coingecko. Got other VD symbol token
        ethaddress_to_identifier('0x9a9bB9b4b11BF8eccff84B58a6CCCCD4058A7f0D'),
        # no Venus Energy token in coingecko. Got other VENUS symbol token
        ethaddress_to_identifier('0xEbeD4fF9fe34413db8fC8294556BBD1528a4DAca'),
        # no WinToken in coingecko. Got other WIN symbol token
        ethaddress_to_identifier('0xBfaA8cF522136C6FAfC1D53Fe4b85b4603c765b8'),
        # no Snowball in coingecko. Got other SNBL symbol token
        ethaddress_to_identifier('0x198A87b3114143913d4229Fb0f6D4BCb44aa8AFF'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xFD25676Fc2c4421778B18Ec7Ab86E7C5701DF187'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xcca0c9c383076649604eE31b20248BC04FdF61cA'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xAef38fBFBF932D1AeF3B808Bc8fBd8Cd8E1f8BC5'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0x662aBcAd0b7f345AB7FfB1b1fbb9Df7894f18e66'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0x497bAEF294c11a5f0f5Bea3f2AdB3073DB448B56'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xAbdf147870235FcFC34153828c769A70B3FAe01F'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0x4DF47B4969B2911C966506E3592c41389493953b'),
        # Token suggestion doesn't match token in db
        ethaddress_to_identifier('0xB563300A3BAc79FC09B93b6F84CE0d4465A2AC27'),
        'ACC',  # no Adcoin in Coingecko. Got other ACC symbol token
        'APH',  # no Aphelion in Coingecko. Got other APH symbol token
        'ARCH',  # no ARCH in Coingecko. Got other ARCH symbol token
        'BET-2',  # no BetaCoin in Coingecko. Got other BET symbol token
        'CCN-2',  # no CannaCoin in Coingecko. Got other CCN symbol token
        'CHAT',  # no ChatCoin in Coingecko. Got other CHAT symbol token
        'CMT-2',  # no Comet in Coingecko. Got other CMT symbol token
        'CRC-2',  # no CrownCoin in Coingecko. Got other CRC symbol token
        'CYC',  # no ConspiracyCoin in Coingecko. Got other CYC symbol token
        'EDR-2',  # no E-Dinar coin in Coingecko. Got other EDR symbol token
        'FLAP',  # no FlappyCoin coin in Coingecko. Got other FLAP symbol token
        'HC-2',  # no Harvest Masternode Coin in Coingecko. Got other HC symbol token
        'KEY-3',  # no KeyCoin Coin in Coingecko. Got other KEY symbol token
        'MUSIC',  # Music in coingecko is nftmusic and not our MUSIC
        'NAUT',  # Token suggestion doesn't match token in db
        'OCC',  # no Octoin Coin in Coingecko. Got other OCC symbol token
        'SPA',  # no SpainCoin Coin in Coingecko. Got other SPA symbol token
        'WEB-2',  # no Webchain in Coingecko. Got other WEB symbol token
        'WOLF',  # no Insanity Coin in Coingecko. Got other WOLF symbol token
        'XAI',  # Token suggestion doesn't match token in db
        'XPB',  # no Pebble Coin in Coingecko. Got other XPB symbol token
        'XNS',  # no Insolar in Coingecko. Got other XNS symbol token
        'PIGGY',  # Coingecko listed another asset PIGGY that is not Piggy Coin
        # coingecko listed CAR that is not our token CarBlock.io
        ethaddress_to_identifier('0x4D9e23a3842fE7Eb7682B9725cF6c507C424A41B'),
        # coingecko listed newb farm with symbol NEWB that is not our newb
        ethaddress_to_identifier('0x5A63Eb358a751b76e58325eadD86c2473fC40e87'),
        # coingecko has BigBang Core (BBC) that is not tradove
        ethaddress_to_identifier('0xe7D3e4413E29ae35B0893140F4500965c74365e5'),
        # MNT is Meownaut in coingecko and not media network token
        ethaddress_to_identifier('0xA9877b1e05D035899131DBd1e403825166D09f92'),
        # Project quantum in coingecko but we have Qubitica
        ethaddress_to_identifier('0xCb5ea3c190d8f82DEADF7ce5Af855dDbf33e3962'),
        # We have Cashbery Coin for symbol CBC that is not listed in the coingecko list
        'CBC-2',
        # We have Air token for symbol AIR. Got another AIR symbol token
        ethaddress_to_identifier('0x27Dce1eC4d3f72C3E457Cc50354f1F975dDEf488'),
        # We have Acorn Collective for symbol OAK. Got another OAK symbol token
        ethaddress_to_identifier('0x5e888B83B7287EED4fB7DA7b7d0A0D4c735d94b3'),
        # Coingecko has yearn v1 vault yUSD
        ethaddress_to_identifier('0x0ff3773a6984aD900f7FB23A9acbf07AC3aDFB06'),
        # Coingecko has yearn v1 vault yUSD (different vault from above but same symbol)
        ethaddress_to_identifier('0x4B5BfD52124784745c1071dcB244C6688d2533d3'),
        # Coingecko has Aston Martin Cognizant Fan Token and we have AeroME
        'AM',
        # Coingecko has Swarm (BZZ) and we have SwarmCoin
        'SWARM',
        # Coingecko has aircoin and we have a different airtoken
        'AIR-2',
        # Coingecko has Attlas Token and we have Authorship
        ethaddress_to_identifier('0x2dAEE1AA61D60A252DC80564499A69802853583A'),
        # Coingecko has Lever Network and we have Leverj
        ethaddress_to_identifier('0x0F4CA92660Efad97a9a70CB0fe969c755439772C'),
        # Coingecko has Twirl Governance Token and we have Target Coin
        ethaddress_to_identifier('0xAc3Da587eac229C9896D919aBC235CA4Fd7f72c1'),
        # Coingecko has MyWish and we have another WISH (ethereum addresses don't match)
        ethaddress_to_identifier('0x1b22C32cD936cB97C28C5690a0695a82Abf688e6'),
        # Coingecko has DroneFly and we have KlondikeCoin for symbol KDC
        'KDC',
        # Coingecko has CoinStarter and we have Student Coin for symbol STC
        ethaddress_to_identifier('0x15B543e986b8c34074DFc9901136d9355a537e7E'),
        # Coingecko has Nano Dogecoin symbol:ndc and we have NEVERDIE
        ethaddress_to_identifier('0xA54ddC7B3CcE7FC8b1E3Fa0256D0DB80D2c10970'),
        # Coingecko has olecoin and we have Olive
        ethaddress_to_identifier('0x9d9223436dDD466FC247e9dbbD20207e640fEf58'),
        # Coingecko has orica and we have origami
        ethaddress_to_identifier('0xd2Fa8f92Ea72AbB35dBD6DECa57173d22db2BA49'),
        # Coingeckop has a different storm token
        ethaddress_to_identifier('0xD0a4b8946Cb52f0661273bfbC6fD0E0C75Fc6433'),
        # We have Centra (CTR) but coingecko has creator platform
        ethaddress_to_identifier('0x96A65609a7B84E8842732DEB08f56C3E21aC6f8a'),
        # We have Gladius Token (GLA) but coingecko has Galaxy adventure
        ethaddress_to_identifier('0x71D01dB8d6a2fBEa7f8d434599C237980C234e4C'),
        # We have reftoken (REF) and coingecko has Ref Finance
        ethaddress_to_identifier('0x89303500a7Abfb178B274FD89F2469C264951e1f'),
        # We have Aidus (AID) and coingecko has aidcoin
        ethaddress_to_identifier('0xD178b20c6007572bD1FD01D205cC20D32B4A6015'),
        # We have depository network but coingecko has depo
        ethaddress_to_identifier('0x89cbeAC5E8A13F0Ebb4C74fAdFC69bE81A501106'),
        # Sinthetic ETH but coingecko has iEthereum
        ethaddress_to_identifier('0xA9859874e1743A32409f75bB11549892138BBA1E'),
        # blocklancer but coingecko has Linker
        ethaddress_to_identifier('0x63e634330A20150DbB61B15648bC73855d6CCF07'),
        # Kora network but coingecko Knekted
        ethaddress_to_identifier('0xfF5c25D2F40B47C4a37f989DE933E26562Ef0Ac0'),
        # gambit but coingecko has another gambit
        ethaddress_to_identifier('0xF67451Dc8421F0e0afEB52faa8101034ed081Ed9'),
        # publica but coingecko has another polkalab
        ethaddress_to_identifier('0x55648De19836338549130B1af587F16beA46F66B'),
        # Spin protocol but spinada in coingecko
        ethaddress_to_identifier('0x4F22310C27eF39FEAA4A756027896DC382F0b5E2'),
        # REBL but another REBL (rebel finance) in coingecko
        ethaddress_to_identifier('0x5F53f7A8075614b699Baad0bC2c899f4bAd8FBBF'),
        # Sp8de (SPX) but another SPX in coingecko
        ethaddress_to_identifier('0x05aAaA829Afa407D83315cDED1d45EB16025910c'),
        # marginless but another MRS in coingecko
        ethaddress_to_identifier('0x1254E59712e6e727dC71E0E3121Ae952b2c4c3b6'),
        # oyster (PRL) but another PRL in coingecko
        ethaddress_to_identifier('0x1844b21593262668B7248d0f57a220CaaBA46ab9'),
        # oyster shell but another SHL in coingecko
        ethaddress_to_identifier('0x8542325B72C6D9fC0aD2Ca965A78435413a915A0'),
        # dorado but another DOR in coingecko
        ethaddress_to_identifier('0x906b3f8b7845840188Eab53c3f5AD348A787752f'),
    )
    for asset_data in GlobalDBHandler().get_all_asset_data(mapping=False):
        identifier = asset_data.identifier
        if identifier in DELISTED_ASSETS:
            # delisted assets won't be in the mapping
            continue

        if asset_data.asset_type == AssetType.FIAT:
            continue

        found = True
        coingecko_str = asset_data.coingecko
        have_id = True
        if coingecko_str is not None or coingecko_str != '':
            have_id = False
            found = coingecko_str in all_coins

        suggestions = []
        if not found:
            for cc_id, entry in all_coins.items():
                if entry['symbol'].upper() == asset_data.symbol.upper():
                    suggestions.append((cc_id, entry['name'], entry['symbol']))
                    continue

                if entry['name'].upper() == asset_data.symbol.upper():
                    suggestions.append((cc_id, entry['name'], entry['symbol']))
                    continue

        if have_id is False and (len(suggestions) == 0
                                 or identifier in symbol_checked_exceptions):
            continue  # no coingecko identifier and no suggestion or is in known exception

        msg = f'Asset {identifier} with symbol {asset_data.symbol} coingecko mapping does not exist.'  # noqa: E501
        if len(suggestions) != 0:
            for s in suggestions:
                msg += f'\nSuggestion: id:{s[0]} name:{s[1]} symbol:{s[2]}'
        if not found:
            test_warnings.warn(UserWarning(msg))