This PR resolves the discovered possibility of division by zero errors while inverting a rate. This is accomplished by updating the division in utils::invert_rate (renamed to utils::checked_invert_rate) to checked_div and returning the result.
When used to invert a QueriedExchangeRate, the failed results are filtered out using filter_map.
When inverting a stablecoin rate, if the rate fails to be inverted, a CallExchangeError::NoRateFound is returned.
This PR resolves the discovered possibility of division by zero errors while inverting a rate. This is accomplished by updating the division in
utils::invert_rate
(renamed toutils::checked_invert_rate
) tochecked_div
and returning the result.QueriedExchangeRate
, the failed results are filtered out usingfilter_map
.CallExchangeError::NoRateFound
is returned.