interledger / rafiki

An open-source, comprehensive Interledger service for wallet providers, enabling them to provide Interledger functionality to their users.
https://rafiki.dev/
Apache License 2.0
226 stars 77 forks source link

Treat rates as composite exchange and network rates #2742

Open sabineschaller opened 1 month ago

sabineschaller commented 1 month ago

Context

Currently, Rafiki requires an exchange rates endpoint EXCHANGE_RATES_URL, that provides exchange rates in the format

{
  base: "CURRENCY_CODE_0",
  rates: {
    "CURRENCY_CODE_1": value, // exchange rate
    ...
  }
}

However, as soon as we enable multi-hop routing, the rates should not just reflect the exchange rates but also the fee of forwarding packets. No middle connector would want to forward the packets for free. Hence, we need to update the endpoint to be called RATES_URL again and to change the expected response to be of the form

{
  base: "CURRENCY_CODE_0",
  rates: {
    "CURRENCY_CODE_0": value, // just forwarding fees
    "CURRENCY_CODE_1": value,  // exchange rate + exchange fee + forwarding fee
    ...
  }
}

Todos