|
| 1 | +# MoonWork - Decentralised Freelancer Platform |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## Whats The Problem and Usecase? |
| 6 | +Freelancer platforms have been very popular allowing people to work from anywhere and likewise for those that want work done quickly, freelancer platforms are a quick solution. |
| 7 | +Lets imagine some work was done for a project but in the end, the client refused to pay out. |
| 8 | +This is an all too common problem we have. What if, as a contractor, you were also judged unfairly due to external reasons. |
| 9 | +Reviews are also hard to completely judge on your own, can be spoofed, made up etc. This presents a few problems with freelancer platforms. |
| 10 | +Now lets have a look at what use cases NFTs would have in this space for what `MoonWork` provides. |
| 11 | + |
| 12 | +## Why use NFTs and Decentralise Freelancer Platforms? |
| 13 | +NFTs (in my opinion) are the perfect use case for this, the advantages of using these are: |
| 14 | +1. Transparency - NFTs are public resources anyone can look into the ledger for. |
| 15 | +2. Verification - You can verify NFT metadata by verifying resource NFTs (more on this later). |
| 16 | +3. Immutability - NFTs can have some fields completely immutable and others mutable, this gives us confidence metadata is not able to be changed. |
| 17 | + |
| 18 | +## What is MoonWork? |
| 19 | +Taking the features above, what `MoonWork` does are the following, split by contractors, clients and disputes and the use of NFTs: |
| 20 | + |
| 21 | +### Contractors |
| 22 | +1. User registers as a contractor and receives a Contractor NFT which represents their MoonWork identity |
| 23 | +2. Newly registered contractors also get a ContractorAccolades NFT. Which all contractors get initially |
| 24 | + |
| 25 | +When work gets completed, the following happens: |
| 26 | +1. For every successfully created work, a contractor's total worth increases, their Contractor NFT gets updated |
| 27 | +2. Contractors get rewarded a `WorkCompleted` NFT minted and is a **souldbound** NFT |
| 28 | +3. For every 10 `WorkCompleted`, Contractor gets a new `ContractorAccolades` NFT minted with all work non fungible id they completed to achieve it |
| 29 | +4. You can verify a Contractor's work by looking at their wallet balance for `WorkCompleted` and `ContractorAccolades` and verify the jobs completed matches the corresponding resources |
| 30 | + |
| 31 | +When a dispute occurs and is completed: |
| 32 | +1. Contractors will get a `DisputeOutcome` NFT |
| 33 | +2. Contractor NFT also gets updated with the number of disputes they've been involved in |
| 34 | +3. In the same way, we can also verify the number of disputes by verifying it matches the balance of their `DisputeOutcome` NFT |
| 35 | + |
| 36 | +### Clients |
| 37 | +1. User registers as a client. |
| 38 | +2. Clients can create new work based on a category (Development & IT, Accounting & Finance etc.) |
| 39 | +3. Contractors then request to take a Client's work |
| 40 | +4. Client then accepts a Contractor they wish to work with |
| 41 | +5. For a completed work, the Client's identity gets updated alongside the work they raised |
| 42 | + |
| 43 | +When a dispute occurs and is completed: |
| 44 | + |
| 45 | +1. Clients will get a `DisputeOutcome` NFT |
| 46 | +2. Client NFT also gets updated with the number of disputes |
| 47 | +3. In the same way, we can also verify the number of disputes by verifying it matches the balance of their `DisputeOutcome` NFT |
| 48 | + |
| 49 | +### Dispute System |
| 50 | +1. A dispute is created with a participant criteria. In this case, for MoonWork, we have specific criteria: |
| 51 | + 1. Participant limit - this is a limit of `Client` **AND** `Contractor` that can join and decide a dispute. For example, if participant limit is 2, we allow 2 clients and 2 contractors to join and decide a dispute |
| 52 | + 2. Client criteria - this is a criteria a client has to meet, in this case, the number of jobs paid out |
| 53 | + 3. Contractor criteria - this is a criteria a contractor has to meet, in this case, the number of jobs completed |
| 54 | + |
| 55 | +2. Either a Client or Contractor can raise a dispute for work that has been assigned to them. |
| 56 | + 1. Disputes can be cancelled by the one who raised it |
| 57 | +3. The client and contractor present their case by submitting `DisputeDocument` NFT which is viewable to the public. Its at their discretion to censor private information from documents. |
| 58 | +4. Participants join and decide based on the documents submitted |
| 59 | +5. Disputes can be completed if either: |
| 60 | + 1. The time has expired and there is a majority vote |
| 61 | + 2. If the majority vote has been given with participant limit reached |
| 62 | +6. In cases where both those conditions above do not apply, i.e. an undecided decision due to split votes, the admin then takes over and has final decision |
| 63 | + |
| 64 | +### Promotion System |
| 65 | +This is a promotion system for contractors, where given their efforts of using the platform, they can, for a period of time, |
| 66 | +promote themselves which would appear on a "recommended" section on a frontend. |
| 67 | +The purpose of this system is really to show off the utility of the NFTs as a result of work being completed. |
| 68 | +The WorkCompleted and ContractorAccolades NFTs form the contractor's identity. |
| 69 | + |
| 70 | +### Enough Talk! I Want To See It In Action! |
| 71 | + |
| 72 | +#### Work Scenario - Completed Work |
| 73 | +Run through a happy path for work raised which does the following: |
| 74 | +- Creates the MoonWork service as an Admin |
| 75 | +- Registers an account as a Contractor |
| 76 | +- Registers an account as a Client |
| 77 | +- Creates a bunch of work categories as an Admin |
| 78 | +- Client creates a bunch of work in each cateogry as a Client |
| 79 | +- Contractor requests for said work raised by Client |
| 80 | +- Client accepts contractor for work |
| 81 | +- Client & Contractor accept to finish work |
| 82 | +- Finally Contractor can claim their compensation |
| 83 | + |
| 84 | +```bash |
| 85 | +resim reset |
| 86 | +source ./transactions/run_full_flow.sh |
| 87 | +``` |
| 88 | + |
| 89 | +#### Dispute Scenario - Completed Dispute |
| 90 | +Run through disputes being completed successfully. The above steps must be run for disputes flow to work correctly: |
| 91 | +- Creates a dispute as a Client |
| 92 | +- Contractor and client submits documents |
| 93 | +- Other contractors and clients join and decide on the dispute |
| 94 | +- Majority vote is given and the dispute is completed as a Contractor |
| 95 | + |
| 96 | +```bash |
| 97 | +source ./transactions/dispute/run_full_flow.sh |
| 98 | +``` |
| 99 | + |
| 100 | +#### Promotion Scenario - Promote Contractor |
| 101 | +Once again, like the above, run the Work Scenario first before running promotion flow: |
| 102 | +- Creates a promotion service as an admin |
| 103 | +- Contractor promotes themselves as a Contractor |
| 104 | +- Sets epoch and removes expired promotion |
| 105 | + |
| 106 | +```bash |
| 107 | +source ./transactions/promotion/run_full_flow.sh |
| 108 | +``` |
| 109 | + |
| 110 | +### Thats Great, What About Alternative Cases? |
| 111 | + |
| 112 | +We got you covered on this front luckily! So this is easy to test, instead of messing around with a bunch of bash environment variables, just run tests instead! |
| 113 | + |
| 114 | +**Spoiler, there are 52 integration tests in total :D** |
| 115 | + |
| 116 | +#### Running Tests |
| 117 | +``` |
| 118 | +scrypto test |
| 119 | +``` |
| 120 | + |
| 121 | +## Read Documentation |
| 122 | +You can generate docs by running: |
| 123 | + |
| 124 | +Install http and run a local server that serves the docs locally: |
| 125 | +``` |
| 126 | +cargo install https |
| 127 | +cargo doc && target/doc |
| 128 | +``` |
| 129 | +### Components |
| 130 | + |
| 131 | +1. <a href="http://localhost:8000/moonwork/moonwork/MoonWorkService_impl/struct.MoonWorkService.html" target="_blank">MoonWorkService</a> |
| 132 | +2. <a href="http://localhost:8000/moonwork/work/WorkService_impl/struct.WorkService.html" target="_blank">WorkService</a> |
| 133 | +3. <a href="http://localhost:8000/moonwork/dispute/DisputeService_impl/struct.DisputeService.html" target="_blank">DisputeService</a> |
| 134 | +4. <a href="http://localhost:8000/moonwork/promotion/PromotionService_impl/struct.PromotionService.html" target="_blank">PromotionService</a> |
0 commit comments