Repository: rotki/rotki

Issue:
Unsupported asset a3CRV with address 0x… encountered during DeFi protocol queries
## Problem Definition

The [aave](https://curve.fi/aave) pool on Curve is not supported by Rotki.

## Logs

```
Unsupported asset a3CRV with address 0x… encountered during DeFi protocol queries
```


Discussion:
Will add it in v1.16.0 but we also need to add detection for all of the missing ones as per: https://github.com/rotki/rotki/issues/2456. The latter will happen a bit later though since v1.16.0 is already overdue.
> Will add it in v1.16.0 but we also need to add detection for all of the missing ones as per: #2456. The latter will happen a bit later though since v1.16.0 is already overdue.

You da best
> > Will add it in v1.16.0 but we also need to add detection for all of the missing ones as per: #2456. The latter will happen a bit later though since v1.16.0 is already overdue.
> 
> You da best

I am kind of biased here as I also use it :smile: 

![2021-04-15_00-00](https://user-images.githubusercontent.com/1658405/114785969-b2baee00-9d7d-11eb-8371-5b738337b28e.png)


FYI, until it's added you can also add the aTokens you got in there as a manual balance so your overall balance is correct, and once we can properly detect it delete the manual balance entry.
So you add each of the 3 aTokens as a manual balance and then update each time you open Rotki?

I was also adding my Uniswap LP just as a USD balance until it's supported.
> So you add each of the 3 aTokens as a manual balance and then update each time you open Rotki?

I don't need that much accuracy. I just added aDAI (since I only made 1 aDAI deposit into the pool). But since they are stablecoins and close to their peg you can keep it simple and add one only (but with the proper amount)
Ah this is not done yet. Needs work on the rotki repo too.

Resolving patch:
diff --git a/rotkehlchen/chain/ethereum/defi/price.py b/rotkehlchen/chain/ethereum/defi/price.py
--- a/rotkehlchen/chain/ethereum/defi/price.py
+++ b/rotkehlchen/chain/ethereum/defi/price.py
@@ -63,6 +63,7 @@
 CURVEFI_SRENSWAP = EthereumConstants().contract('CURVEFI_SRENSWAP')
 CURVEFI_SUSDV2SWAP = EthereumConstants().contract('CURVEFI_SUSDV2SWAP')
 CURVEFI_3POOLSWAP = EthereumConstants().contract('CURVEFI_3POOLSWAP')
+CURVEFI_A3CRVSWAP = EthereumConstants().contract('CURVEFI_A3CRVSWAP')
 CURVEFI_GUSDC3CRVSWAP = EthereumConstants().contract('CURVEFI_GUSDC3CRVSWAP')
 YEARN_CONTROLLER = EthereumConstants().contract('YEARN_CONTROLLER')
 
@@ -233,6 +234,9 @@ def handle_defi_price_query(
         usd_value = _handle_curvepool_price(ethereum, CURVEFI_SUSDV2SWAP, token.decimals, ONE)
     elif token == A_CRV_3CRV:
         usd_value = _handle_curvepool_price(ethereum, CURVEFI_3POOLSWAP, token.decimals, ONE)
+    # a3CRV: Comparing address since constant won't be found if user has not updated their DB
+    elif token.ethereum_address == '0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900':
+        usd_value = _handle_curvepool_price(ethereum, CURVEFI_A3CRVSWAP, token.decimals, ONE)
     elif token == A_CRV_GUSD:
         usd_value = _handle_curvepool_price(ethereum, CURVEFI_GUSDC3CRVSWAP, token.decimals, ONE)
     elif token == A_CRVP_DAIUSDCTBUSD:
diff --git a/rotkehlchen/chain/ethereum/modules/yearn/vaults.py b/rotkehlchen/chain/ethereum/modules/yearn/vaults.py
--- a/rotkehlchen/chain/ethereum/modules/yearn/vaults.py
+++ b/rotkehlchen/chain/ethereum/modules/yearn/vaults.py
@@ -46,7 +46,7 @@
 from rotkehlchen.errors import UnknownAsset
 from rotkehlchen.fval import FVal
 from rotkehlchen.history.price import query_usd_price_zero_if_error
-from rotkehlchen.inquirer import SPECIAL_TOKENS, Inquirer
+from rotkehlchen.inquirer import Inquirer
 from rotkehlchen.premium.premium import Premium
 from rotkehlchen.typing import ChecksumEthAddress, Price, Timestamp
 from rotkehlchen.user_messages import MessagesAggregator
@@ -173,8 +173,9 @@ def get_usd_price_zero_if_error(
     TODO: MAke an issue about this
     This can be solved when we have an archive node.
     """
-    if asset in SPECIAL_TOKENS:
-        return Inquirer().find_usd_price(asset)
+    inquirer = Inquirer()
+    if asset in inquirer.special_tokens:
+        return inquirer.find_usd_price(asset)
 
     return query_usd_price_zero_if_error(
         asset=asset,
diff --git a/rotkehlchen/inquirer.py b/rotkehlchen/inquirer.py
--- a/rotkehlchen/inquirer.py
+++ b/rotkehlchen/inquirer.py
@@ -54,6 +54,7 @@
     PriceQueryUnsupportedAsset,
     RemoteError,
     UnableToDecryptRemoteData,
+    UnknownAsset,
 )
 from rotkehlchen.externalapis.xratescom import (
     get_current_xratescom_exchange_rates,
@@ -79,38 +80,6 @@
 
 CURRENT_PRICE_CACHE_SECS = 300  # 5 mins
 
-SPECIAL_TOKENS = (
-    A_YV1_DAIUSDCTBUSD,
-    A_CRVP_DAIUSDCTBUSD,
-    A_CRVP_DAIUSDCTTUSD,
-    A_YV1_DAIUSDCTTUSD,
-    A_YV1_DAIUSDCTTUSD,
-    A_CRVP_RENWSBTC,
-    A_YV1_RENWSBTC,
-    A_CRV_RENWBTC,
-    A_CRV_YPAX,
-    A_CRV_GUSD,
-    A_CRV_3CRV,
-    A_YV1_3CRV,
-    A_CRV_3CRVSUSD,
-    A_YV1_ALINK,
-    A_YV1_DAI,
-    A_YV1_WETH,
-    A_YV1_YFI,
-    A_YV1_USDT,
-    A_YV1_USDC,
-    A_YV1_TUSD,
-    A_YV1_GUSD,
-    A_FARM_USDC,
-    A_FARM_USDT,
-    A_FARM_DAI,
-    A_FARM_TUSD,
-    A_FARM_WETH,
-    A_FARM_WBTC,
-    A_FARM_RENBTC,
-    A_FARM_CRVRENWBTC,
-)
-
 ASSETS_UNDERLYING_BTC = (
     A_YV1_RENWSBTC,
     A_FARM_CRVRENWBTC,
@@ -227,6 +196,7 @@ class Inquirer():
     _ethereum: Optional['EthereumManager'] = None
     _oracles: Optional[List[CurrentPriceOracle]] = None
     _oracle_instances: Optional[List[CurrentPriceOracleInstance]] = None
+    special_tokens: List[EthereumToken]
 
     def __new__(
             cls,
@@ -247,6 +217,43 @@ def __new__(
         Inquirer._cryptocompare = cryptocompare
         Inquirer._coingecko = coingecko
         Inquirer._cached_current_price = {}
+        Inquirer.special_tokens = [
+            A_YV1_DAIUSDCTBUSD,
+            A_CRVP_DAIUSDCTBUSD,
+            A_CRVP_DAIUSDCTTUSD,
+            A_YV1_DAIUSDCTTUSD,
+            A_YV1_DAIUSDCTTUSD,
+            A_CRVP_RENWSBTC,
+            A_YV1_RENWSBTC,
+            A_CRV_RENWBTC,
+            A_CRV_YPAX,
+            A_CRV_GUSD,
+            A_CRV_3CRV,
+            A_YV1_3CRV,
+            A_CRV_3CRVSUSD,
+            A_YV1_ALINK,
+            A_YV1_DAI,
+            A_YV1_WETH,
+            A_YV1_YFI,
+            A_YV1_USDT,
+            A_YV1_USDC,
+            A_YV1_TUSD,
+            A_YV1_GUSD,
+            A_FARM_USDC,
+            A_FARM_USDT,
+            A_FARM_DAI,
+            A_FARM_TUSD,
+            A_FARM_WETH,
+            A_FARM_WBTC,
+            A_FARM_RENBTC,
+            A_FARM_CRVRENWBTC,
+        ]
+        # This asset may be missing if user has not yet updated their DB
+        try:
+            a3crv = EthereumToken('0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900')
+            Inquirer.special_tokens.append(a3crv)
+        except UnknownAsset:
+            pass
 
         return Inquirer.__instance
 
@@ -362,7 +369,7 @@ def find_usd_price(
             except RemoteError:
                 pass  # continue, a price can be found by one of the oracles (CC for example)
 
-        if asset in SPECIAL_TOKENS:
+        if asset in instance.special_tokens:
             ethereum = instance._ethereum
             assert ethereum, 'Inquirer should never be called before the injection of ethereum'
             token = EthereumToken.from_asset(asset)


Test patch: