Skip to content
Permalink
Browse files

chore: make comment about exchange rate more clear

  • Loading branch information...
gakonst committed Nov 5, 2019
1 parent f9f4580 commit 4ce37859304542807f7e38f86fb9b09d06cbf696
Showing with 4 additions and 3 deletions.
  1. +4 −3 crates/interledger-service-util/src/exchange_rates_service.rs
@@ -95,9 +95,10 @@ where
.store
.get_exchange_rates(&[&request.from.asset_code(), &request.to.asset_code()])
{
// if `from` is worth 1 USD and `to` is worth 10 USD, the
// outgoing amount will actually be 1/10th of the source amount,
// i.e. `from_amount * (from_rate / to_rate)`
// Exchange rates are expressed as `base asset / asset`. To calculate the outgoing amount,
// we multiply by the incoming asset's rate and divide by the outgoing asset's rate. For example,
// if an incoming packet is denominated in an asset worth 1 USD and the outgoing asset is worth
// 10 USD, the outgoing amount will be 1/10th of the source amount.
rates[0] / rates[1]
} else {
error!(

0 comments on commit 4ce3785

Please sign in to comment.
You can’t perform that action at this time.