interledger / interledger-rs

An easy-to-use, high-performance Interledger implementation written in Rust
http://interledger.rs
Other
201 stars 70 forks source link

Handling special rate #578

Open ibanfi opened 4 years ago

ibanfi commented 4 years ago

The stock ILP node is able to handle flat exchange rate only, it cannot handle complex business logic (pricing curves) and it cannot handle either when I want to provide special exchange rate for my customers.

The idea is: instead of implementing a complex and parameterized rate service into the ILP node (or outside, providing as a service), let the customer do this. The sender sends the amount and defines the target amount/currency or target rate. In this case the ILP node won't apply its own rate, it accepts and processes the requested transaction. Of course we have to consider so many restrictions, including:

Sample payload

Target amount

{
  "receiver": "$payment-pointer.example.com",
  "source_amount": 100000,
  "target_amount": 250
  "target_ccy": "USD"
}

Special rate

{
  "receiver": "$payment-pointer.example.com",
  "source_amount": 100000,
  "special_rate": 1.237
  "target_ccy": USD
}
sappenin commented 4 years ago

I'm not sure this is possible as you've framed the question. Let's imagine a $100 payment through the Connector. It's likely the Connector will see this "payment" as a series of packetized ILPv4 "payments" (e.g., 10000 packets of $.01 each).

Because of this, I don't think the Connector would have any way to know that any particular packet is for any particular macro-payment. That is, it won't be able to know: "when sending $100, apply this FX rate".

Some alternative ideas...

This isn't something we're going to work on in the short-term (next few months), but if you want to start a design spec or conversation around this with the rest of the community, I would be open to thinking more about it.

Implementation-wise, you would probably have to build it though unless you can wait a bit for the feature to gain broad acceptance.