XRC canister not supporting (some) Ethererum pairs?

I tried to look up some common trading pairs in the Ethereum DeFi ecosystem, such as USDC/WETH but did not successfully get any rates back:

Errors:

Asset: Asset { symbol: "USDC", class: Cryptocurrency }, Error: Failed to retrieve rate from Coinbase: IC0503: Error from Canister uf6dk-hyaaa-aaaaq-qaaaq-cai: Canister called `ic0.trap` with message: Failed to deserialize JSON: error: invalid type: map, expected a sequence at line 1 column 0 response: {"message":"Coinbase Pro API is deprecated."}.

Asset: Asset { symbol: "USDC", class: Cryptocurrency }, Error: Failed to retrieve rate from GateIo: Connecting to api.gateio.ws failed: Request failed direct connect client error (Connect) and connect through socks client error (Connect)

Asset: Asset { symbol: "USDC", class: Cryptocurrency }, Error: Failed to retrieve rate from Poloniex: IC0503: Error from Canister uf6dk-hyaaa-aaaaq-qaaaq-cai: Canister called `ic0.trap` with message: Failed to deserialize JSON: error: invalid type: map, expected a sequence at line 1 column 0 response: {   "code" : 24101,   "message" : "Invalid symbol!" }.

[KuCoin] Failed to deserialize JSON: error: missing field `data` at line 1 column 51 response: {"msg":"Unsupported trading pair.","code":"400100"}

… and some more.

Maybe the XRC canister should not be used for these kinds of pairs?

I guess WETH is not a super common token to use on centralised exchanges. It is the #14 of all tokens though, according to Coingecko. So, it seems reasonable the XRC canister should support it?

@dskloet @0x5279616e

The exchange rate canister supports all tokens traded at the major (centralized) exchanges. WETH is not one of them…

Out of curiosity, why do you need it? The WETH/USDC rate should never be far from the ETH/USDC rate, right?

1 Like

I am building a DCA (Dollar Cost Average) example using ic-alloy. You setup a canister with a base token and a swap token and then, every X minutes it swaps some of the base token for the swap token using Uniswap. In order to calculate the slippage, I need the exchange rate. And, since I am using Uniswap I need an exchange rate source that supports all tokens on Uniswap.

ps. It turns out Uniswap provides exchange rates for all their supported pairs. I will use that for now.

1 Like

Sounds cool! Thanks for the info!