For Devpost 6-week smart contract hackathon
This repository contains a prototype for a decentralized escrow system developed using DAML. In a decentralized escrow system, the sender and receiver of money don't need to trust a third party. In this project, three roles are implemented - 'UserAdmin', 'Financer' and 'Worker'. Apart of other parameters, the 'Financer' and 'Worker' each have a wallet respectively. Next there is a 'Project' entity which also has an 'Escrow' wallet. Ideally, project and 'Escrow' account shuld have been different entities but for simplicity in this project 'Escrow' wallet is a part of 'Project' entity. Users in other roles are allowed to join the network by the network admin after they request the admin. The 'Financer' can create a 'Project'. A 'Project' has a 'price' associated with it and also a 'Worker'. As soon as a 'Financer' creates a project, the amount equal to price of project is deducted from his wallet and credited to 'Escrow' wallet within 'Project' entity. The 'Financer' then has no way to get the amount back to his wallet. The 'Financer' can however transfer the amount to 'Worker' associated with 'project' after 'project' completion. Similarly, the 'worker' cannot get money to his acccount from 'escrow' but can transfer back to 'financer' in case of project termination due to a genuine reason. In this prototype implementation, the step of a 'financer' transferring to 'worker' from 'escrow' on successful project completion and vice versa on project termination is divided into two steps - (i) 'Financer' or 'Worker' creating 'wallet' update request for the orther party. (ii) 'UserAdmin' authorizing the request after which wallet update happens. The 'UserAdmin' authorization can be improved later so that there is no party involved between 'Financer' and 'worker'. This decentralized escrow system incentivizes fair behavior in both parties.
The code is compiling properly and has been testes on Visual Studo Code IDE as well as SandBox. Front-end integration has not been done yet for this prototype.
There are two modules - Main.daml and UserAdmin.daml .