Let’s say I have many templates that have a changeTime
field like
template A
with
creator : Party
changeTime : Time
where
signatory creator
choice Foo : ContractId A
controller creator
do
-- Update some other fields as well, skipped for brevity
currentTime <- getTIme
create this with
changeTime = currentTime
template B
with
creator : Party
changeTime : Time
where
signatory creator
choice Bar : ContractId B
controller creator
do
-- Update some other fields as well, skipped for brevity
currentTime <- getTIme
create this with
changeTime = currentTime
I’d like to know if there is a way to abstract the currentTime <- getTime; create this with changeTime = currentTime
away from the choice implementations, but making sure all templates having a changeTime
field will automatically ‘inherit’ (for lack of a better term) the behaviour of getting its changeTime
field updated when Foo
or Bar
is exercised.
I am thinking interfaces might help but I am not exactly sure.