Skip to content

Instantly share code, notes, and snippets.

@entzik
Last active October 11, 2020 19:58
Show Gist options
  • Save entzik/db2375d3fa007cdefe88716f36fc0f01 to your computer and use it in GitHub Desktop.
Save entzik/db2375d3fa007cdefe88716f36fc0f01 to your computer and use it in GitHub Desktop.
choice AddVoter : ContractId Doodle
with
voter: Party
controller organizer
do
assertMsg "this doodle has been opened for voting, cannot add voters" (not open)
create this with voters = voter::voters
choice RemoveVoter : ContractId Doodle
with
voter: Party
controller organizer
do
assertMsg "this doodle has been opened for voting, cannot remove voters" (not open)
create this with voters = DA.List.delete voter voters
preconsuming choice IssueInvites : ContractId Doodle
controller organizer
do
assertMsg "this doodle has been opened for voting, cannot issue any more invites" (not open)
DA.Traversable.mapA (\voter -> create DoodleInvite with doodleName = this.name, organizer = this.organizer, voter = voter) voters
-- archive self
create this with open = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment