accordproject / models

Accord Project Model Repository
https://models.accordproject.org
Apache License 2.0
29 stars 42 forks source link

feature(base) Simplify parties in Accord Project models #134

Closed jeromesimeon closed 3 years ago

jeromesimeon commented 3 years ago

Signed-off-by: Jerome Simeon jeromesimeon@me.com

Handling of contract parties in the base models is inconsistent.

While we bake in a notion accord project party for contracts: https://github.com/accordproject/models/blob/2051f2724546d58a9b06c3b62599de9aa9b24fb8/src/accordproject/contract.cto#L24-L27

we do not require obligations to be tied to those parties at runtime: https://github.com/accordproject/models/blob/2051f2724546d58a9b06c3b62599de9aa9b24fb8/src/accordproject/runtime.cto#L40-L44

The reason for the latter is clearer in retrospect: we sometimes need contracts tied to other kinds of parties that could be identified by something different from a partyId. E.g., a business's email in this template: https://github.com/accordproject/cicero-template-library/blob/d0f6e14be765da258c18037955ae54c4bcf4d013/src/supplyagreement-perishable-goods/model/contract.cto#L26-L27

I believe this example to be a really valid (and likely important) usecase. My suggestion is to disentangle the notion of contract from a built-in notion of party. A contract could be tied to any participant, making that consistent with how obligations are handled rather than trying to impose a single notion of party. We can leave the current accord project party as a convenience (many templates do use it).

Additional note

I also opted for removal of this line: https://github.com/accordproject/models/blob/2051f2724546d58a9b06c3b62599de9aa9b24fb8/src/accordproject/contract.cto#L32

It could be instead replaced by:

--> Participant[] parties optional

But this isn't used in any template that I know of, and it is likely that we will have to revise this anyway when we discuss contract signatures.

Changes