Anyone know where the off-chain price oracle is hosted? AWS? Server in Dfinity’s basement?
I believe the deterministic xdr_per_ipc is on chain.
Get_value(xdr_per_ipc).
this is protobuf; not candid.
Something like (in motoko):
type NNSActor = actor { get_icp_to_cycles_conversion_rate : () -> (nat64) };
let nns: NNSActor = actor("qoctq-giaaa-aaaaa-aaaea-cai");
let icpxdr : Nat64 = await nns.get_icp_to_cycles_conversion_rate();
So there’d be two canisters needed, one for NNS and one for the price oracle?
qoctq-giaaa-aaaaa-aaaea-cai would be the canister ID for the NNS?
The example I pasted above should do what you want on its own without a second canister
Your question in discussed in this thread (to which I provided an answer):
These oracles are run on multiple independent data centers (neither on AWS nor in DFINITY’s basement).
this is in nns-ui canister, But the source code is not opened.
Ah, totally missed this. Thanks.
Yeah NNS canister, I pulled the candid from IC.rocks for it
Hey everyone!
If you are using the exchange rate in your projects, be aware that the mechanism will change in the upcoming weeks.
Specifically, the exchange rate will no longer be maintained in the NNS registry. Instead, the cycles minting canister will store it directly and make it available using the same interface.
Quick update: The change that I mentioned above is now live.
You can request the exchange rate directly from the cycles minting canister (rkp4c-7iaaa-aaaaa-aaaca-cai
).
I’m trying to get the XDR-to-ICP exchange rate through the minting canister using the method that previously existed on the registry canister (get_icp_to_cycles_conversion_rate()), but am getting an error that this method doesn’t exist on the minting canister. I wonder if it’s been renamed?
The function is called get_icp_xdr_conversion_rate()
as you can see here.
You can test it using dfx
:
dfx canister --no-wallet --network ic call --query "rkp4c-7iaaa-aaaaa-aaaca-cai" get_icp_xdr_conversion_rate
Thank you, that’s what I was looking for
Does anyone know why theres a get_average_icp_xdr ex rate as well?
Right now ICP is 7.07 ish dollars and from google 1 xdr is about 1.334 some dollars. So xdr to icp function is giving me the correct answer of about 5.19ish xdr per icp.
But the avg_xdr to icp exchange rate is giving me 7.6680. I dont know where this is coming from.
That’s the average ICP/XDR rate over the past 30 days. This is used to calculate node provider rewards. You can also see this on the IC dashboard Conversion Rate chart.