thirdweb

AccountabilityContract

This is a smart contract that enables task management and accountability. The contract allows the owner to deposit of funds and create tasks, mark them as completed, and upon completing task receive fund back.

Accountability Contract

This is a smart contract that enables task management and accountability. The contract allows the owner to deposit of funds and create tasks, mark them as completed, and upon completing task receive fund back. Only the owner of the contract can interact with the functions.

The contract consists of the following key components: Task Struct: Represents a task with a description and completion status. tasks Array: Stores the created tasks. deposit Variable: Keeps track of the deposited funds. owner Variable: Represents the address of the contract owner.

Contract Functions

createTask Creates a new task with the provided description. Only the owner can call this function.

depositFunds Allows the owner to deposit funds into the contract. The deposited funds are added to the deposit variable.

withdrawDepositSafely Allows the owner to safely withdraw the entire deposit amount from the contract.

completeTask Marks a task as completed based on the provided task ID. If all tasks are completed after marking the current task as complete, the deposit amount is transferred back to the owner, and all tasks are cleared.

getTaskCount Returns the total number of tasks created.

getDeposit Returns the current deposit amount in the contract.

getTasks Returns an array containing all the tasks created in the contract.

Events

The contract emits the following events:

  • TaskCreated: Triggered when a new task is created.
  • TaskCompleted: Triggered when a task is marked as completed.
  • DepositWithdrawn: Triggered when the deposit amount is withdrawn.

Complete Task

(completeTask)

nonpayable

Inputs

_taskId

uint256

Published by

View all contracts

Details

  • Publish Date

    Jul 01, 2023

  • License

    Unlicense

  • Learn more about Publish