Skip to content
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8846871
Multi Owners NFT
Jul 13, 2024
f19cb42
correct format
Jul 13, 2024
9b73e1b
correct format
Jul 13, 2024
18c8be9
correct format
Jul 13, 2024
2490372
correct format
Jul 13, 2024
d591c27
update format
Jul 13, 2024
910b33a
change format
Jul 13, 2024
acf7094
update format
Jul 13, 2024
de9d3b0
update Author
Jul 16, 2024
a34f31e
Merge pull request #1 from jamesavechives/MO-NFT
Jul 16, 2024
b945e47
Merge branch 'master' into MO-NFT
Jul 16, 2024
daadfeb
Merge branch 'ethereum:master' into master
Jul 17, 2024
3e9fb18
update epi number to 7743
Jul 17, 2024
9ad648e
Merge branch 'MO-NFT' of github.com:jamesavechives/ERCs into MO-NFT
Jul 17, 2024
aa9b515
Merge pull request #2 from jamesavechives/MO-NFT
Jul 17, 2024
26006c3
Add ERC : Decentralized Employment System
Aug 4, 2024
1f40d4b
change file name
Aug 4, 2024
995c726
update format
Aug 4, 2024
d58050d
update format
Aug 4, 2024
ce35b5d
update format
Aug 4, 2024
f15ed1f
Merge branch 'master' into DES
Aug 4, 2024
0fdf84e
Merge branch 'master' into DES
Aug 6, 2024
4b0bddf
eip number and discussion link
Aug 6, 2024
3761bee
Merge branch 'master' into DES
Aug 9, 2024
69445bc
Merge branch 'master' into DES
Aug 19, 2024
e1f086f
Update ERCS/erc-7750.md
Sep 29, 2024
b21a484
Update ERCS/erc-7750.md
Sep 29, 2024
f68729f
update specification
Oct 1, 2024
c307af6
Merge branch 'master' into DES
Oct 8, 2024
f4e9d5d
Employee Tokenization
Oct 8, 2024
c056b0e
update rationale section
Oct 8, 2024
de4faab
update tests section
Oct 8, 2024
ea4cc64
update format
Oct 8, 2024
6294e6b
Update ERC: Remove email & format document
Nov 28, 2024
f8a1005
Merge branch 'ethereum:master' into master
Nov 28, 2024
8b56acd
Update ERC-7743: Move to Review
Nov 28, 2024
ca2bc09
Merge branch 'master' into master
Dec 1, 2024
4030850
Merge branch 'ethereum:master' into master
Dec 7, 2024
97f0f7b
Merge branch 'master' into master
Dec 11, 2024
77f5cad
remove private members in specification section
Dec 11, 2024
bebc198
Merge branch 'master' into master
Dec 12, 2024
6f02563
Merge branch 'master' into master
Dec 15, 2024
f1e71d4
Merge branch 'master' into master
Dec 20, 2024
5a3d04c
Merge branch 'ethereum:master' into master
Dec 24, 2024
6565b28
Merge pull request #4 from jamesavechives/master
Dec 24, 2024
8943c58
revert for other erc
Dec 24, 2024
68c3a5a
revert changes for other ERC
Dec 24, 2024
479343a
revert from monft
Dec 24, 2024
44b2e36
Merge pull request #5 from jamesavechives/pure
Dec 24, 2024
e225df2
add more details
Dec 24, 2024
cc4bce3
update format
Dec 24, 2024
961b2a5
update format
Dec 24, 2024
de53926
Merge branch 'master' into DES
Dec 25, 2024
dca6ea7
Merge branch 'ethereum:master' into DES
Jan 9, 2025
248f47c
Update ERC-7750 : Move to Review
Jan 9, 2025
4505be1
Merge branch 'master' into DES
Jan 21, 2025
15c7346
Merge branch 'master' into DES
Jan 25, 2025
88d63b1
update test case
Jan 25, 2025
fe854c1
update format
Jan 25, 2025
abf4607
update format
Jan 25, 2025
934403e
Merge branch 'master' into DES
Feb 4, 2025
f863828
Merge branch 'master' into DES
Feb 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 156 additions & 34 deletions ERCS/erc-7750.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Decentralized Employment System
description: An employment system that records employment history.
author: James Savechives (@jamesavechives) <[email protected]>
discussions-to: https://ethereum-magicians.org/t/erc-7750-decentralized-employment-system-des/20724
status: Draft
status: Review
type: Standards Track
category: ERC
created: 2024-08-04
Expand Down Expand Up @@ -290,39 +290,161 @@ interface IDecentralizedEmploymentSystem {

## Test Cases

1. **Company Creation**:
- **Input**: A user calls the `registerCompany("TechCorp", "Technology")` function.
- **Expected Output**: A new company is registered with a unique `companyId`, and the `companies` mapping is updated with the company's details (name: "TechCorp", industry: "Technology", owner: caller's address).

2. **Employee Token Minting**:
- **Input**: The system owner calls `mintEmployeeToken(employeeAddress, "ipfs://metadataURI")`.
- **Expected Output**: A new SBT is minted for the employee with a unique `tokenId`, and the `employees` mapping is updated accordingly.

3. **Contract Creation and Execution**:
- **Input**:
1. A company with `companyId` `1` calls `createContract(1, 5, 1000, 6, "Software Development", "Failure to meet deadlines")`.
2. Both the company and the employee sign the contract by calling `executeContract(contractId)`.
- **Expected Output**:
1. A new labor contract is created with a unique `contractId`, and relevant mappings are updated.
2. The contract status is set to "active" upon execution by both parties.

4. **Salary Deposit**:
- **Input**: The company calls `depositSalary(contractId)` with a value of `1000 USDC`.
- **Expected Output**: The `escrowBalances` mapping is updated to reflect the deposited amount for `contractId`, securing the funds in escrow.

5. **Salary Payment**:
- **Input**: After the contract duration, `releaseSalary(contractId)` is called.
- **Expected Output**: The escrowed `1000 USDC` is transferred to the employee's address, and the `escrowBalances` mapping for `contractId` is reset to zero.

6. **Employment Termination**:
- **Input**: The company calls `terminateContract(contractId, "Failure to meet deadlines")`.
- **Expected Output**:
1. The contract status is updated to "terminated" in the `contracts` mapping.
2. A termination event is emitted, and the company is no longer obligated to continue salary payments.

7. **Dispute Resolution**:
- **Input**: Either party calls `raiseDispute(contractId)`, followed by the assigned moderator calling `resolveDispute(contractId, true)` to favor the employee.
- **Expected Output**: The escrow funds are transferred to the employee, and the dispute is marked as resolved in the contract's status.
1. **Company Creation**

**Input**
- A user calls `registerCompany("TechCorp", "Technology")`.

**Expected State Changes**
- A new `companyId` is generated (e.g., `companyId = 1`).
- The `companies` mapping is updated:
```solidity
companies[1]↦{
name="TechCorp",
industry="Technology",
owner=callerAddress,
employeeIds=[ ]
}
```
- An event `CompanyRegistered` is emitted with the arguments `(1, callerAddress, "TechCorp", "Technology")`.

**Expected Output**
- **Return Value**: `companyId = 1` (the newly created company ID).
- **Event**: `CompanyRegistered` is logged.

2. **Employee Token Minting**

**Input**
- The contract owner (or an authorized address) calls `mintEmployeeToken(employeeAddress, "ipfs://metadataURI")`.

**Expected State Changes**
- A new token ID is generated (e.g., `tokenId = 5`).
- An internal mapping (e.g., `employeeTokenToOwner`) is updated:
```solidity
employeeTokenToOwner[5]↦employeeAddress
```
- (Optional) If the implementation tracks metadata, another mapping (e.g., `employeeTokenMetadata`) might store:
```solidity
employeeTokenMetadata[5]↦"ipfs://metadataURI"
```
- An event `EmployeeTokenMinted` is emitted with `(5, employeeAddress)`.

**Expected Output**
- **Return Value**: `tokenId = 5` (the newly minted employee token ID).
- **Event**: `EmployeeTokenMinted` is logged.

3. **Contract Creation and Execution**

**Input**
1. A company with `companyId = 1` calls:
```solidity
createContract(1,5,1000,6,"SoftwareDevelopment","Failuretomeetdeadlines")
```
which returns `contractId`.
2. Both the company and the employee call `executeContract(contractId)`.

**Expected State Changes**
- **Contract Creation**:
1. A new labor contract ID is generated, e.g., `contractId = 10`.
2. The `contracts` mapping is updated:
```solidity
contracts[10]↦{
companyId=1,
employeeTokenId=5,
salary=1000,
duration=6,
responsibilities="SoftwareDevelopment",
terminationConditions="Failuretomeetdeadlines",status="Created"
}
```
3. The system may also update a per-company or per-employee tracking structure (optional but typical):
```solidity
companyContracts[1].push(10)
employeeContracts[5].push(10)
```
4. An event `ContractCreated` is emitted with arguments `(10, 1, 5, 1000, 6)`.
- **Contract Execution**:
1. Upon calls from both parties, the contract’s status changes from `"Created"` to `"Active"`:
```solidity
contracts[10].status↦"Active"
```
2. An event `ContractExecuted` is emitted with `(10)` once both signatures/confirmations are received.

**Expected Output**
- **Return Value** (from `createContract`): `contractId = 10`
- **Event**: `ContractCreated(10, 1, 5, 1000, 6)` upon creation.
- **Event**: `ContractExecuted(10)` once execution is confirmed by both parties.

4. **Salary Deposit**

**Input**
- The company (owner of `companyId = 1`) calls `depositSalary(10)` and sends `1000 USDC` (or equivalent in wei for an [ERC-20](./eip-20.md) token or native token) to the contract.

**Expected State Changes**
1. The contract’s escrow balance mapping is updated:
```solidity
escrowBalances[10]↦1000
```
2. An event `SalaryDeposited` is emitted with `(10, 1000)`.

**Expected Output**
- **Event**: `SalaryDeposited(10, 1000)`
- The contract’s internal `escrowBalances[10]` should now be `1000`.

5. **Salary Payment**

**Input**
- After the contract’s duration or satisfaction of any release condition, `releaseSalary(10)` is called (by the contract or the employee).

**Expected State Changes**
1. The escrow balance for `contractId = 10` is transferred to the employee token owner (`employeeAddress` associated with token ID `5`).
2. The `escrowBalances[10]` is set to `0`:
```solidity
escrowBalances[10]↦0
```
3. An event `SalaryReleased` is emitted with `(10, employeeAddress)`.

**Expected Output**
- **Event**: `SalaryReleased(10, employeeAddress)`
- The updated `escrowBalances[10]` is now `0`.
- The employee’s on-chain balance (or token balance if using [ERC-20](./eip-20.md)) increases by `1000`.

6. **Employment Termination**

**Input**
- The company calls `terminateContract(10, "Failure to meet deadlines")`.

**Expected State Changes**
1. The `contracts[10].status` is updated to `"Terminated"`:
```solidity
contracts[10].status↦"Terminated"
```
2. An event `ContractTerminated` is emitted with `(10, "Failure to meet deadlines")`.

**Expected Output**
- **Event**: `ContractTerminated(10, "Failure to meet deadlines")`
- The `contracts[10]` status is now `"Terminated"`.
- No further salary obligations exist unless otherwise specified in dispute-resolution processes.

7. **Dispute Resolution**

**Input**
1. Either party (company or employee) calls `raiseDispute(10)`.
2. The assigned moderator calls `resolveDispute(10, true)` indicating the decision favors the employee.

**Expected State Changes**
- **Dispute Raised**:
1. The contract’s dispute status is noted (implementation-specific, but typically `contracts[10].disputeRaised = true`).
2. An event `DisputeRaised(10, msg.sender)` is emitted.
- **Dispute Resolved**:
1. If `decisionForEmployee == true`, any remaining escrow funds for `contractId = 10` are transferred to the employee.
2. A `DisputeResolved(10, true)` event is emitted.

**Expected Output**
- **Event**: `DisputeRaised(10, msg.sender)`
- **Event**: `DisputeResolved(10, true)`
- If funds remain in escrow, `escrowBalances[10]` is set to `0`, and the employee receives the outstanding balance.


## Security Considerations

Expand Down
Loading