Repository: rotki/rotki

Issue:
I'm not seeing my Solana on Coinbase.
## Problem Definition

I'm not seeing my Solana on Coinbase.

## Logs

[06/09/2021 23:42:30 GMT Daylight Time] WARNING rotkehlchen.user_messages Greenlet-3: Found coinbase balance result with unknown asset SOL. Ignoring it.
[06/09/2021 23:44:06 GMT Daylight Time] WARNING rotkehlchen.user_messages Greenlet-7: Found coinbase transaction with unknown asset SOL. Ignoring it.
[06/09/2021 23:44:06 GMT Daylight Time] WARNING rotkehlchen.user_messages Greenlet-7: Found coinbase transaction with unknown asset SOL. Ignoring it.

### System Description


Operating system: windows 10
Rotki version: 1.20.1



Discussion:
Hey @samal-rasmussen that's due to a recent mapping problem. Thanks for reporting.

@yabirgb this should be fixed like the mappings for other exchanges. For coinbase we just have a function atm since it has very few assets compared to all others. Perhaps a mapping here would also make sense.

https://github.com/rotki/rotki/blob/develop/rotkehlchen/assets/converters.py#L815-L834

Resolving patch:
diff --git a/rotkehlchen/assets/asset.py b/rotkehlchen/assets/asset.py
--- a/rotkehlchen/assets/asset.py
+++ b/rotkehlchen/assets/asset.py
@@ -402,6 +402,10 @@ def deserialize_from_db(cls, entry: UnderlyingTokenDBTuple) -> 'UnderlyingToken'
     strethaddress_to_identifier('0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b'): 'AXS',
 }
 
+WORLD_TO_COINBASE = {
+    'SOL-2': 'SOL',
+}
+
 # Create a generic variable that can be 'Asset', or any subclass.
 Z = TypeVar('Z', bound='Asset')
 
diff --git a/rotkehlchen/assets/converters.py b/rotkehlchen/assets/converters.py
--- a/rotkehlchen/assets/converters.py
+++ b/rotkehlchen/assets/converters.py
@@ -5,6 +5,7 @@
     WORLD_TO_BITFINEX,
     WORLD_TO_BITTREX,
     WORLD_TO_COINBASE_PRO,
+    WORLD_TO_COINBASE,
     WORLD_TO_FTX,
     WORLD_TO_ICONOMI,
     WORLD_TO_KRAKEN,
@@ -661,6 +662,7 @@
 KUCOIN_TO_WORLD = {v: k for k, v, in WORLD_TO_KUCOIN.items()}
 ICONOMI_TO_WORLD = {v: k for k, v in WORLD_TO_ICONOMI.items()}
 COINBASE_PRO_TO_WORLD = {v: k for k, v in WORLD_TO_COINBASE_PRO.items()}
+COINBASE_TO_WORLD = {v: k for k, v in WORLD_TO_COINBASE.items()}
 
 RENAMED_BINANCE_ASSETS = {
     # The old BCC in binance forked into BCHABC and BCHSV
@@ -813,7 +815,9 @@ def asset_from_binance(binance_name: str) -> Asset:
 
 
 def asset_from_coinbase(cb_name: str, time: Optional[Timestamp] = None) -> Asset:
-    """May raise UnknownAsset
+    """May raise:
+    - DeserializationError
+    - UnknownAsset
     """
     # During the transition from DAI(SAI) to MCDAI(DAI) coinbase introduced an MCDAI
     # wallet for the new DAI during the transition period. We should be able to handle this
@@ -827,11 +831,13 @@ def asset_from_coinbase(cb_name: str, time: Optional[Timestamp] = None) -> Asset
         if time < COINBASE_DAI_UPGRADE_END_TS:
             # Then it should be the single collateral version
             return A_SAI
-        # else
         return A_DAI
 
-    # else
-    return symbol_to_asset_or_token(cb_name)
+    if not isinstance(cb_name, str):
+        raise DeserializationError(f'Got non-string type {type(cb_name)} for coinbase asset')
+
+    name = COINBASE_TO_WORLD.get(cb_name, cb_name)
+    return symbol_to_asset_or_token(name)
 
 
 def asset_from_ftx(ftx_name: str) -> Asset:


Test patch: