Skip to content

Instantly share code, notes, and snippets.

@entzik
Last active September 7, 2020 21:47
Show Gist options
  • Save entzik/beea29063f031770493db72cc5f990c9 to your computer and use it in GitHub Desktop.
Save entzik/beea29063f031770493db72cc5f990c9 to your computer and use it in GitHub Desktop.
Sample DAML Contract Template
module User where
template User with
username: Party
following: [Party]
where
signatory username
observer following
agreement
"I hereby agree that by signing this contract I become a user and I can authorize other users to follow me."
key username: Party
maintainer key
nonconsuming choice Follow: ContractId User with
userToFollow: Party
controller username
do
assertMsg "You cannot follow yourself" (userToFollow /= username)
assertMsg "You cannot follow the same user twice" (notElem userToFollow following)
archive self
create this with following = userToFollow :: following
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment