ERC-7750 Decentralized employment system
Review · Other · created 2024-08-04
A standard that handles the entire employment lifecycle on the Ethereum blockchain, from company registration, employment history recording, and employment contract execution, to escrow salary payments, dispute resolution, and mutual reviews.
Why it is needed
Existing employment systems are often centralized, opaque, and lacking in trust. Job seekers' work histories depend on records kept separately by companies or institutions, making it hard to filter out forgery or exaggeration, and hiring companies must verify past records one by one. Salary payment also depends on the company's good faith, and when disputes arise over contract terms, the resolution process is slow and complicated. This standard aims to build a fairer and more transparent employment ecosystem by recording employment history on the blockchain, automating contract execution, and providing a dispute resolution mechanism. Employees prove their employment history with a non-transferable Soulbound Token (SBT), and companies can check this record before entering into a contract. Salary is held by a smart contract and paid out once conditions are met, protecting both parties.
What to implement
event CompanyRegistered(uint companyId, address owner, string name, string industry);: An event emitted when a new company is registered.event EmployeeTokenMinted(uint tokenId, address employee);: An event emitted when an employee token is minted.event ContractCreated(uint contractId, uint companyId, uint employeeTokenId, uint salary, uint duration);: An event emitted when an employment contract is created.event ContractExecuted(uint contractId);: An event emitted when both parties agree and the contract becomes active.event SalaryDeposited(uint contractId, uint amount);: An event emitted when salary is deposited into escrow.event SalaryReleased(uint contractId, address employee);: An event emitted when escrowed salary is paid out to the employee.event DisputeRaised(uint contractId, address raisedBy);: An event emitted when a party to the contract raises a dispute.event DisputeResolved(uint contractId, bool decisionForEmployee);: An event emitted when a moderator rules on a dispute.event ContractTerminated(uint contractId, string reason);: An event emitted, along with a reason, when a contract is terminated.event ReviewSubmitted(uint contractId, uint rating, string comments);: An event emitted when a review is submitted for a contract.function registerCompany(string calldata name, string calldata industry) external returns (uint companyId);: Registers a new company and returns a unique companyId. The caller address is recorded as the owner.function getCompany(uint companyId) external view returns (string memory name, string memory industry, address owner, uint[] memory employeeIds);: Looks up a company's name, industry, owner address, and the list of employee token IDs it holds.function mintEmployeeToken(address employee, string calldata metadataURI) external returns (uint tokenId);: Mints a soulbound token representing an employee. Metadata such as work history is referenced via metadataURI.function getEmploymentHistory(uint employeeTokenId) external view returns (uint[] memory contractIds);: Looks up the array of contract IDs linked to an employee token, i.e. the full employment history.function createContract(uint companyId, uint employeeTokenId, uint salary, uint duration, string calldata responsibilities, string calldata terminationConditions) external returns (uint contractId);: A company creates an employment contract with an employee. It holds salary, duration, responsibilities, and termination conditions, and returns a unique contractId.function executeContract(uint contractId) external;: When both the company and the employee sign with their own wallets to agree, the contract transitions to active status.function depositSalary(uint contractId) external payable;: The company deposits the agreed salary into the contract's escrow. It verifies that the deposited amount matches the contract salary.function releaseSalary(uint contractId) external;: Pays out the escrowed salary to the employee's address according to the payment schedule or contract completion.function raiseDispute(uint contractId) external;: Either party to the contract can raise a dispute. This starts the moderator assignment process.function resolveDispute(uint contractId, bool decisionForEmployee) external;: The assigned moderator rules on the dispute. If the employee wins, the escrowed funds go to the employee; otherwise they may go to the company.function terminateContract(uint contractId, string calldata reason) external;: The company terminates the contract according to pre-agreed conditions and changes its status to terminated.function submitReview(uint contractId, uint rating, string calldata comments) external;: After a contract ends, the company and employee submit reviews with a rating and comments.function getReviews(uint contractId) external view returns (Review[] memory);: Looks up all reviews attached to a specific contract.
In depth
Employee soulbound tokens and employment history
Employees are represented by a soulbound token (SBT) minted via mintEmployeeToken. The token is non-transferable, so employment records are permanently bound to the individual. Metadata such as work history is stored off-chain and referenced via metadataURI. Employment history is maintained as an array of contract IDs linked to each employee token and can be looked up by anyone with getEmploymentHistory(uint employeeTokenId). The source states that this record is stored permanently and immutably on the blockchain and is publicly accessible so companies can verify past history before finalizing a contract. The system operates after employee testing and before final hiring and contract signing.
Company registration and lookup
Calling registerCompany(name, industry) registers a new company, issues a unique companyId, and records the caller address as the owner. Per the test cases, the companies mapping stores the name, industry, owner, and an empty employeeIds array, and a CompanyRegistered event is emitted. getCompany(companyId) returns the company name, industry, owner address, and the array of employee token IDs it holds.
Creation and execution of employment contracts
createContract takes companyId, employeeTokenId, salary, duration (in months), responsibilities, and terminationConditions, and issues a unique contractId. The contract is in Created status upon creation, and both the company and employee must call executeContract with their own wallets to agree before it becomes Active. Once both confirmations are collected, a ContractExecuted event is emitted. The test cases present company-level and employee-level tracking structures such as companyContracts and employeeContracts as an optional but common implementation choice.
Escrow-based salary payment
The company calls depositSalary(contractId) as a payable function to deposit salary into escrow. The function verifies that the deposited amount matches the contract's salary, updates escrowBalances[contractId], and emits a SalaryDeposited event. releaseSalary(contractId) sends the escrowed funds to the employee token owner's address according to the contract's payment schedule or completion, zeroes out escrowBalances, and emits a SalaryReleased event. The source Rationale explains that this structure ensures salary funds are actually available and ties payment to contract fulfillment conditions, protecting both parties.
Dispute resolution
Either party to the contract can raise a dispute with raiseDispute(contractId), which starts the moderator assignment process. The assigned moderator rules via resolveDispute(contractId, decisionForEmployee). If decisionForEmployee is true, the remaining escrowed funds are transferred to the employee; otherwise they may be returned to the company. The source explains that for complex employment issues that a smart contract cannot enforce automatically, the moderator provides human oversight, reaching a fair conclusion based on the contract terms and the submitted evidence.
Contract termination and reviews
The company can terminate a contract according to pre-agreed conditions with terminateContract(contractId, reason), changing the contract status to Terminated. If there is an objection to the termination, the dispute resolution process can be used. After a contract ends, both the company and the employee can leave a rating and comments with submitReview(contractId, rating, comments), and all reviews for a contract can be looked up with getReviews. Reviews feed into both parties' reputation scores and are designed to encourage mutual accountability and positive behavior within the ecosystem.
Proposal status
This proposal is currently in Review status. Since it is not yet a finalized standard, the function signatures or behavior in the specification may still change during review.
Things to watch out for
- Contract integrity: Employment contracts must be immutable and tamper-proof once created and executed.
- Fund security: Salary must be held securely in escrow and paid out only according to pre-agreed conditions, preventing unauthorized access or misuse.
- Moderator trust: The system for selecting and overseeing moderators must be implemented in a decentralized and transparent way to maintain fairness and trust in dispute resolution.
- Review manipulation prevention: Safeguards against false reviews, such as verifying that a review is actually linked to a completed contract, must be in place to preserve the accuracy of reputation scores.
- Token security: Soulbound tokens must be used to represent employees so that token transfer is prevented and employment records remain firmly bound to that individual.