I am new to DAML. I am experimenting DAML for lifecycle management for financial instruments use case. One question comes to my mind is how do we extend the default Party interface? Currently I see that a Party can only have a name and id.
A lender/borrower can have its own properties like legal entity id, legal account number and corp id etc... How can we associate those details to a Party in this case lender or borrower?
The way to model workflows in Daml is through templates for smart contracts. In your case you want to create role template for borrower, lender etc. In addition to storing the details you mentioned, a role contract allows to implement rights and obligations that the role should have. E.g. a borrower has the right to apply for a loan, which can be implemented using a nonconsuming choice on a Borrower Daml template.
A role contract can be associated with a Daml Party by way of a contract key. Contract key ensures uniqueness of the contract for the key (in the example below for the combination of system operator and borrower parties) and allows to fetch the contract from the ledger by key. Here's a quick example
template Borrower
with
sysOperator : Party
borrower : Party
fullName : Text
lei : Text
accNum : Int
where
signatory sysOperator, borrower
key (sysOperator, borrower) : (Party, Party)
maintainer key._1
nonconsuming choice ApplyForLoan : ContractId LoanApplication
with
lender : Party
amount : Decimal
expiryDate : Date
controller borrower
do
create LoanApplication with ..