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.
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.
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.
The contract emits the following events:
_taskId | uint256 |
Jul 01, 2023
Unlicense