This PR adds support for fetching fiat prices from the DIA batching server.
It also fixes the default value parsing for the supported_currencies argument.
It works as follows:
If the blockchain identifier of a queried currency equals FIAT, the batching server will request the price information from the Traditional Finance Data API Endpoint. The symbol should be of form <base>-<target>. For our use cases the off-chain worker in the DIA pallet should always query using USD as the target currency but this has to be configured in the respective runtime/chain spec of the substrate chains. I decided not to make an assumption of USD always being the target currency here to not make the batching server too limited to our case. The price information for USD-USD is handled separately because we want the offchain-worker to also feed that price to the on-chain storage. Although it does not make too much sense to query the USD to USD price, we need to have the price available on-chain for our other (price) oracle pallet to work properly.
This PR adds support for fetching fiat prices from the DIA batching server. It also fixes the default value parsing for the
supported_currencies
argument.It works as follows: If the
blockchain
identifier of a queried currency equalsFIAT
, the batching server will request the price information from the Traditional Finance Data API Endpoint. The symbol should be of form<base>-<target>
. For our use cases the off-chain worker in the DIA pallet should always query usingUSD
as the target currency but this has to be configured in the respective runtime/chain spec of the substrate chains. I decided not to make an assumption ofUSD
always being the target currency here to not make the batching server too limited to our case. The price information forUSD-USD
is handled separately because we want the offchain-worker to also feed that price to the on-chain storage. Although it does not make too much sense to query the USD to USD price, we need to have the price available on-chain for our other (price) oracle pallet to work properly.