No, there is no (hard-coded) list. The exchange rate canister simply collects all the symbols that the forex data providers return.
There is only a small number of providers that support “XDR”, so it is possible that you don’t get any rates for specific timestamps.
Since we need support for XDR, there is a “computed XDR” rate (symbol “CXDR”), which is artificially added. It is derived from the rates and weights defined by the IMF (the weights are shown in the screenshot).
In short, if you need the IMF SDR asset conversion rate, the preferred way is to use the “CXDR” symbol.
Is there any way to receive multiple assets in one go? I feel like having to make 3 separate async calls per 3 different assets could cause some kind of reentrancy attack if thats the right term. Basically, if you need to calculate the amount of you hold in USD for five different assets simultanously, would this current exchange rate canister make that feasible?
or if not now, will there be plans to do this?
Oh yea, is this supposed to be the defacto one source exchange rate shop for the ic, similar to how chainlink is and its bad practice to use any other price feed sources or should this be looked at just as another source that could be faulty and its good to have backups? On localnet, I have quite a bit of random failures but so far none on the mainnet so I am curious?
No, there is not. Note that the exchange rate canister needs to make calls to all exchanges for each requested asset individually anyway, so there is no way to reduce the number of HTTPS outcalls in this scenario. Moreover, if you don’t want to make the requests sequentially, you can choose to make multiple calls in parallel and await the completion of all these calls.
However, you should only request a small number of rates at any given time because there is rate limiting in place to make sure there aren’t too many HTTPS outcalls at the same time. If you are requesting too may rates, you’ll get a response containing the ExchangeRateError::RateLimited error.
As mentioned above, adding such an endpoint wouldn’t add a lot of value in my opinion. I agree that it would make things more convenient for developers. I will discuss it with the rest of the exchange rate canister team to see how they feel about it.
It is just one canister that acts as an oracle for cryptocurrency and fiat currency exchange rates. There can definitely be many others, for example, interacting with other/more sources, providing exchange rates for other assets such as stocks and so on.
Everybody is free to develop their own oracle services and use whichever service suits their needs.
Just to be clear, the exchange rate canister is more than “just another source” because it interacts with multiple data sources and consolidates the received rates to provide a rate that is likely to be accurate. Note that the cycle-minting canister will soon receive the ICP/XDR rate from the exchange rate canister.
There is no guarantee that the rate is correct, however, so you may choose to get the rate from other oracles as well (but they may be faulty, too).
The dashboard of the exchange rate canister shows that the CMC (rkp4c-7iaaa-aaaaa-aaaca-cai) requests the rate from the exchange rate canister.
You can verify that the conversion rate proposals stopped a few hours ago on the Internet Computer dashboard (by looking at the Exchange Rate topic) and that the CMC updates the rate successfully using the get_icp_xdr_conversion_rate endpoint.
Awesome, thanks for the replies. So the canister is fully open for usage, the CMC is using it live, and any canister can now rely on it (and has been able to for some time)?
The XRC demo works like a charm deployed locally. Is anyone able to guide a noob like me with an example call on the live canister via dfx/terminal or even better some kind of inter canister call example from within motoko. Either way, awesome work seems really useful.
Thanks, yes this is the sample code I tested with. This worked fine via candid in a browser but if I wanted to call the live canister on the ic? I presume this is possible from within my own Dapp?
I think maybe I was looking at this in an incorrect way, is your xrc demo an interim dapp that is contacting the exchange rate canister with a degree of separation rather than retrieving the live data directly from market makers. This makes more sense. I’ll have a another look at the example and try to adapt that to my environment.