Repository: rotki/rotki

Issue:
SOL token is Solana, not Sola
## Problem Definition

The SOL token on the exchanges is reported with the correct value but the wrong name.  Its Solana, not Sola.




Discussion:
Hey @JezSan that is actually an exchange mapping error then.

Which exchange are you referring to?

As you probably know cryptocurrency tokens don't have an existing registry of symbols that governs which symbol each token can take. So multiple tokens with the same symbol can be found.

To solve that we have our own registry of tokens with a unique identifier for each token (in all_assets.json). The unique identifier is essentially the same as the symbol, unless another identifier with the same symbol exists. In which case we start appending a counter. 

Rotki supports the following (from all_assets.json):

```json
    "SOL": {
        "coingecko": "",
        "ethereum_address": "0x1F54638b7737193FFd86c19Ec51907A7c41755D8",
        "ethereum_token_decimals": 6,
        "name": "Sola Token",
        "started": 1514467063,
        "symbol": "SOL",
        "type": "ethereum token"
    },
    "SOL-2": {
        "coingecko": "solana",
        "cryptocompare": "SOLAN",
        "name": "Solana",
        "started": 1586494758,
        "symbol": "SOL",
        "type": "own chain"
    },
```

You are interested in Solana I guess, but for some exchange we must be having the wrong mapping. Can you tell me for which exchange you saw it?

It should not just be the name that's wrong, but also the price.
SOL on binance is solana.    It shows the correct price on Rotki but not the right name

I know there’s a legacy sola token but it’s not listed anywhere and has no price. 

So this issue does look like a misnamed token and not a confusion between two similarly named tokens



Sent from my iPhone. Apologies for all the typos!

> On 5 Dec 2020, at 20:53, Lefteris Karapetsas <notifications@github.com> wrote:
> 
> ﻿
> Hey @JezSan that is actually an exchange mapping error then.
> 
> Which exchange are you referring to?
> 
> As you probably know cryptocurrency tokens don't have an existing registry of symbols that governs which symbol each token can take. So multiple tokens with the same symbol can be found.
> 
> To solve that we have our own registry of tokens with a unique identifier for each token (in all_assets.json). The unique identifier is essentially the same as the symbol, unless another identifier with the same symbol exists. In which case we start appending a counter.
> 
> Rotki supports the following (from all_assets.json):
> 
>     "SOL": {
>         "coingecko": "",
>         "ethereum_address": "0x1F54638b7737193FFd86c19Ec51907A7c41755D8",
>         "ethereum_token_decimals": 6,
>         "name": "Sola Token",
>         "started": 1514467063,
>         "symbol": "SOL",
>         "type": "ethereum token"
>     },
>     "SOL-2": {
>         "coingecko": "solana",
>         "cryptocompare": "SOLAN",
>         "name": "Solana",
>         "started": 1586494758,
>         "symbol": "SOL",
>         "type": "own chain"
>     },
> You are interested in Solana I guess, but for some exchange we must be having the wrong mapping. Can you tell me for which exchange you saw it?
> 
> It should not just be the name that's wrong, but also the price.
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or unsubscribe.

That's really weird if you actually do see the correct current price.

If Binance returns a token as SOL and we don't have a special mapping arranged for it (can't see anything), then it should default to the legacy one. And the price feed is coming from cryptocompare: https://min-api.cryptocompare.com/data/pricehistorical?fsym=SOL&tsyms=USD&ts=1607205381

Price of that is  0.001904 while SOL is 1.96.

>I know there’s a legacy sola token but it’s not listed anywhere and has no price.

It's in cryptocompare: https://www.cryptocompare.com/coins/sol/overview. It's only historical data. We can't delist/remove tokens since we do historical accounting. Even if something has no price now it had at some point in the past when you traded it.


Let me look into this a bit further. The fix is super easy. What I don't get is why you get the right price.
Okay the price reason is that cryptocompare seems to have SOL, listed as SOLA, but actually return Solana's price for current price and SOLA's price for historical prices.

Oh boy ...

Resolving patch:
diff --git a/rotkehlchen/assets/asset.py b/rotkehlchen/assets/asset.py
--- a/rotkehlchen/assets/asset.py
+++ b/rotkehlchen/assets/asset.py
@@ -141,6 +141,8 @@
     'LUNA-2': 'LUNA',
     # YOYOW is known as YOYO in Binance
     'YOYOW': 'YOYO',
+    # Solana is SOL-2 in rotki
+    'SOL-2': 'SOL',
 }
 
 


Test patch:
diff --git a/rotkehlchen/tests/api/test_aave.py b/rotkehlchen/tests/api/test_aave.py
--- a/rotkehlchen/tests/api/test_aave.py
+++ b/rotkehlchen/tests/api/test_aave.py
@@ -206,7 +206,7 @@ def _query_borrowing_aave_history_test(setup: BalancesTestSetup, server: APIServ
     total_lost = result[AAVE_TEST_ACC_3]['total_lost']
     total_earned_liquidations = result[AAVE_TEST_ACC_3]['total_earned_liquidations']
 
-    assert len(total_earned_interest) == 1
+    assert len(total_earned_interest) >= 1
     assert len(total_earned_interest['aWBTC']) == 2
     assert FVal(total_earned_interest['aWBTC']['amount']) >= FVal('0.00000833')
     assert FVal(total_earned_interest['aWBTC']['usd_value']) >= ZERO
diff --git a/rotkehlchen/tests/api/test_balances.py b/rotkehlchen/tests/api/test_balances.py
--- a/rotkehlchen/tests/api/test_balances.py
+++ b/rotkehlchen/tests/api/test_balances.py
@@ -13,6 +13,7 @@
 from rotkehlchen.constants.misc import ZERO
 from rotkehlchen.fval import FVal
 from rotkehlchen.tests.utils.api import (
+    ASYNC_TASK_WAIT_TIMEOUT,
     api_url_for,
     assert_error_response,
     assert_ok_async_response,
@@ -580,8 +581,9 @@ def test_balances_caching_mixup(
             task_id_btc,
         )
         result_eth = wait_for_async_task_with_result(
-            rotkehlchen_api_server,
-            task_id_eth,
+            server=rotkehlchen_api_server,
+            task_id=task_id_eth,
+            timeout=ASYNC_TASK_WAIT_TIMEOUT * 2,
         )
         assert result_eth['per_account']['ETH'][ethereum_accounts[0]]['assets']['ETH']['amount'] == '1'  # noqa: E501
         assert result_eth['per_account']['ETH'][ethereum_accounts[0]]['assets']['RDN']['amount'] == '2'  # noqa: E501
diff --git a/rotkehlchen/tests/api/test_blockchain.py b/rotkehlchen/tests/api/test_blockchain.py
--- a/rotkehlchen/tests/api/test_blockchain.py
+++ b/rotkehlchen/tests/api/test_blockchain.py
@@ -346,7 +346,7 @@ def _add_blockchain_accounts_test_start(
             result = wait_for_async_task_with_result(
                 api_server,
                 task_id,
-                timeout=ASYNC_TASK_WAIT_TIMEOUT * 2,
+                timeout=ASYNC_TASK_WAIT_TIMEOUT * 4,
             )
         else:
             result = assert_proper_response_with_result(response)