Last active
September 7, 2020 21:47
-
-
Save entzik/beea29063f031770493db72cc5f990c9 to your computer and use it in GitHub Desktop.
Sample DAML Contract Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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