Skip to content

The **Task Bounty System** is a decentralized smart contract that allows users to create and participate in task-based bounties. Employers can post tasks with rewards in ETH, freelancers can apply, and the task owner selects a winner who receives the reward.

Notifications You must be signed in to change notification settings

MrinalSingh04/Task_Bounty_System_smart_contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Task Bounty System Smart Contract

Overview

The Task Bounty System is a decentralized smart contract that allows users to create and participate in task-based bounties. Employers can post tasks with rewards in ETH, freelancers can apply, and the task owner selects a winner who receives the reward.

Features

  • Task Creation: Users can create tasks with ETH rewards and deadlines.
  • Freelancer Applications: Freelancers can apply for open tasks.
  • Winner Selection: Task owners select a freelancer to complete the task and receive the reward.
  • Automatic Payments: ETH is automatically transferred to the winner upon selection.
  • Task Cancellation: Task owners can cancel tasks and reclaim their funds (before selecting a winner).
  • Reputation System: Freelancers earn reputation points for completing tasks.

Smart Contract Functions

🛠 Task Management

createTask(string memory _description, uint _duration) payable

  • Creates a new task with a deadline.
  • Requires ETH to be sent as a reward.

applyForTask(uint _taskId, string memory _proposal)

  • Allows freelancers to submit a proposal for a task.
  • Task must be active and not expired.

selectWinner(uint _taskId, address _freelancer)

  • Task owner selects a winner from the list of applicants.
  • The freelancer receives the ETH reward.

cancelTask(uint _taskId)

  • Task owner can cancel the task and reclaim funds (before selecting a winner).

🔍 Utility Functions

getApplicants(uint _taskId) returns (address[])

  • Returns the list of freelancers who applied for a task.

getFreelancerReputation(address _freelancer) returns (uint)

  • Retrieves a freelancer's reputation score based on completed tasks.

How It Works

  1. Employer Posts a Task: Calls createTask() and sends ETH as a reward.
  2. Freelancers Apply: Call applyForTask() with a proposal.
  3. Employer Selects a Winner: Calls selectWinner(), and the freelancer receives ETH.
  4. Freelancer Reputation Increases: The freelancer gains a reputation point.

Security & Best Practices

  • Uses the checks-effects-interactions pattern to prevent re-entrancy attacks.
  • Ensures only the task owner can select a winner or cancel a task.
  • Prevents expired tasks from being manipulated.

Deployment & Testing

Deploying on Remix

  1. Open Remix IDE.
  2. Create a new Solidity file (TaskBounty.sol).
  3. Copy and paste the contract code.
  4. Compile and deploy using an Ethereum testnet.

Testing with Hardhat

  1. Install dependencies:
    npm install hardhat ethers chai
  2. Write test cases in Hardhat and run:
    npx hardhat test

License

This project is licensed under the MIT License.

Author

Developed by [Mrinal Singh]. Feel free to contribute or modify as needed!

About

The **Task Bounty System** is a decentralized smart contract that allows users to create and participate in task-based bounties. Employers can post tasks with rewards in ETH, freelancers can apply, and the task owner selects a winner who receives the reward.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published