When multiplying QueriedExchangeRates, the forex timestamp was only assigned when the rates both had a forex timestamp that were equal. This would result in the following:
(
variant {
Ok = record {
metadata = record {
decimals = 9 : nat32;
forex_timestamp = null;
quote_asset_num_received_rates = 1 : nat64;
base_asset_num_received_rates = 5 : nat64;
base_asset_num_queried_sources = 6 : nat64;
standard_deviation = 5_926_094 : nat64;
quote_asset_num_queried_sources = 7 : nat64;
};
rate = 3_798_391_839 : nat64;
timestamp = 1_678_321_020 : nat64;
quote_asset = record {
class = variant { FiatCurrency };
symbol = "CXDR";
};
base_asset = record {
class = variant { Cryptocurrency };
symbol = "ICP";
};
}
},
)
This PR updates the logic so that if one rate has a timestamp or both rates have the same timestamp, the forex timestamp is carried over to the result.
(
variant {
Ok = record {
metadata = record {
decimals = 9 : nat32;
forex_timestamp = opt (1_678_320_000 : nat64);
quote_asset_num_received_rates = 1 : nat64;
base_asset_num_received_rates = 5 : nat64;
base_asset_num_queried_sources = 6 : nat64;
standard_deviation = 5_926_094 : nat64;
quote_asset_num_queried_sources = 7 : nat64;
};
rate = 3_798_391_839 : nat64;
timestamp = 1_678_321_020 : nat64;
quote_asset = record {
class = variant { FiatCurrency };
symbol = "CXDR";
};
base_asset = record {
class = variant { Cryptocurrency };
symbol = "ICP";
};
}
},
)
When multiplying QueriedExchangeRates, the forex timestamp was only assigned when the rates both had a forex timestamp that were equal. This would result in the following:
This PR updates the logic so that if one rate has a timestamp or both rates have the same timestamp, the forex timestamp is carried over to the result.