Use self-type in contract keys

I do this quite frequently. It tends to make sense if you have hierarchical relationships between contracts. eg

template Parent
  with
    p : Party
    id : Text
  where
    signatory p
    key this : Parent
    maintainer key.p

template Child
  with
    parent : Parent
    childId : Text
  where
    signatory parent.p
    key this : Child
    maintainer parent.p
2 Likes