This one’s an example, not a guide or tutorial. I had some fun today modelling a Secret Santa game in DAML. I’ll run this on project:DABL for Digital Asset employees. It’s only DAML so far, but if there is enough interest, I’ll add a UI over the next few weeks.
I believe the model is safe, sound, and privacy-preserving. Santa is regulated by a holiday regulator. I’ll leave it to you to do due diligence using the code above. The basic rules are thus:
- The app starts in sign-up, which Santa gets to close once enough elves have signed up.
- Once signup ends, Santa matches the elves in the usual way. You find out who you are getting a gift for, but now who’s getting one for you.
- Once you have been matched, you must pledge your gift by December 25th by saying in plain text what it is. Don’t worry, the receiver doesn’t find out. If you miss that deadline, Santa gets to penalize you and your pledge defaults to a bag of homebaked cookies.
- Then every time you meet someone that is also part of the secret santa (socially or 1<>1) , you register that meeting in the app. If you met the person that you are getting a gift for, the pledge will be revealed. If Santa sees that the receiver claims to have met you, but you neither revealed your pledge, nor registered the meeting in reverse, Santa will chase you.
- When you have received your gift, you Resolve the Pledge.
- Once all Pledges are resolved, the fun is over.