This example models the concept of crowd funding campaign where backers contribute money to a project, but the collected funds can only be released if they exceed a predefined threshold. If the threshold is not reached the funds can be reclaimed. A suggested extension to this model is to introduce a time threshold, which controls when claims or reclaims can happen.
- The
originator
creates aProject
contract defining the requiredthreshold
to reach. - The originator invites backers via invite/accept, collecting signatures from each on the
Project
contract. - Backers can then
Pledge
Iou
s to the project, which get locked up in the process. Pledges can only be done before the project'sdeadline
. - Once the
deadline
has passed and if the raised amount exceeds thethreshold
of theProject
theoriginator
canClaim
the raised funds, which subsequently get transferred to him using the collected authorization on theProject
contract. - If the raised funds are below the
threshold
the backers can trigger aReclaim
for theIou
s to be returned.
To compile the project:
daml build
To test all scripts:
daml test --color
To load the project into the sandbox and start navigator:
daml start