digital-asset / contingent-claims

Apache License 2.0
5 stars 0 forks source link

Tag each payment with the corresponding payment time #91

Closed matteolimberto-da closed 2 years ago

matteolimberto-da commented 2 years ago

This is a small but breaking change to the Lifecycle Result.

The pending items, which included the asset and quantity to be settled, now additionally include the corresponding payment time.

There are a couple of reasons why I think this makes sense:

Happy to hear your feedback on this.

lucianojoublanc-da commented 2 years ago
  • It is a building block if we want the LC function to return all known payments,

How do you envision this working for conditional branches?

  • generate the tree on-the-fly during lifecycling and chop off the payments that have already been made

I'm not sure I understand why you need the dates for this?

matteolimberto-da commented 2 years ago
  • It is a building block if we want the LC function to return all known payments,

How do you envision this working for conditional branches?

Are you referring here to sub-trees of a Cond node or to sub-trees of When pred ?

In the first case, if we acquire the Cond node then we are guaranteed to immediately acquire only one of the two sub-trees.

In the second case, any payment falling after a When pred c would be considered as unknown.

  • generate the tree on-the-fly during lifecycling and chop off the payments that have already been made

I'm not sure I understand why you need the dates for this?

You are right that it is not needed for a bond or a swap, where we could effectively just generate the "remaining claim" from a strongly-typed contract. It just felt easier in my mind to avoid modifying the tree and just act on pending payments, but it is indeed not a constraint.

lucianojoublanc-da commented 2 years ago

In the second case, any payment falling after a When pred c would be considered as unknown.

Ok, I think I misunderstood what you meant by 'known'. I didn't quite understand how you could return "all known payments" in the future, if there was an Or or a Anytime branch, for instance. So known = past.

matteolimberto-da commented 2 years ago

In the second case, any payment falling after a When pred c would be considered as unknown.

Ok, I think I misunderstood what you meant by 'known'. I didn't quite understand how you could return "all ~known~ payments" in the future, if there was an Or or a Anytime branch, for instance. So known = past.

Indeed, I should have been more precise. I meant "return all payments that are known today".