Skip to content

Commit 861b836

Browse files
authored
Merge pull request #139 from beemdvp/main
MoonWork - Decentralised Freelance Platform
2 parents 91b6d4f + 222516b commit 861b836

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+9470
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
noremap <Leader>f :!scrypto fmt<cr><cr>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "moonwork"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
8+
scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
9+
10+
[dev-dependencies]
11+
transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
12+
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
13+
scrypto-unit = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.6.0" }
14+
15+
[profile.release]
16+
opt-level = 's' # Optimize for size.
17+
lto = true # Enable Link Time Optimization.
18+
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
19+
panic = 'abort' # Abort on panic.
20+
strip = "debuginfo" # Strip debug info.
21+
overflow-checks = true # Panic in the case of an overflow.
22+
23+
[lib]
24+
crate-type = ["cdylib", "lib"]
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# MoonWork - Decentralised Freelancer Platform
2+
3+
![MoonWork Logo](./image.png "MoonWork")
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>
Loading

0 commit comments

Comments
 (0)