Skip to content

Conversation

cantinaverse
Copy link
Collaborator

PR Description

Summary

This PR extends the TaskBounty smart contract by introducing two critical external functions — acceptSolution and deactivateTask. These functions allow task creators to either finalize tasks by accepting solutions and awarding bounties, or to deactivate tasks and refund rewards if needed. The update also includes full Natspec documentation for clarity and maintainability.


Key Changes

📂 TaskBounty.sol

  • Refactored submitSolution signature formatting for readability.
  • ✅ Added acceptSolution function:
    • Allows task creators to accept valid submissions.
    • Marks task as completed and records solver details (solver, solution, solvedAt).
    • Marks the submission as accepted.
    • Transfers reward funds to the solver if available.
    • Emits BountyClaimed event.
  • ✅ Added deactivateTask function:
    • Only callable by the task creator.
    • Ensures task is not already inactive or completed.
    • Sets isActive to false.
    • Refunds reward (if any) back to the task creator.
    • Emits TaskDeactivated event.
  • ✅ Added Natspec comments for both functions (@dev, @param, @notice) to improve contract readability and developer experience.
  • ✅ Ran forge fmt for consistent code formatting.

Motivation

  • 🛠️ Enable task lifecycle completion by allowing creators to finalize tasks when a solution is accepted.
  • 💸 Ensure secure and transparent reward payouts to solvers.
  • 🛡️ Provide creators the ability to deactivate unresolvable or outdated tasks and reclaim rewards.
  • 📚 Improve developer experience with clear, standardized Natspec documentation.

Next Steps

  • Add unit tests for:
    • Accepting valid solutions and transferring rewards.
    • Handling cases where solutions are already accepted or task is inactive.
    • Deactivating tasks with/without rewards.
  • Expand with frontend integration so users can accept or deactivate tasks directly from the UI.
  • Consider governance or community voting mechanisms for solution acceptance in future iterations.

@0xRiz0 0xRiz0 self-requested a review September 25, 2025 16:28
@0xRiz0 0xRiz0 added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 25, 2025
@0xRiz0 0xRiz0 merged commit 0079a69 into master Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants