TasksManager
The main contract that manages the tasks.
TaskCannotBeChanged
Emitted when a task cannot be changed.
TitleUpdated
Emitted when a title is updated.
DescriptionUpdated
Emitted when a description is updated.
EndDateUpdated
Emitted when an end date is updated.
MetadataUpdated
Emitted when metadata is updated.
setTitle
This function sets a new title
for a task.
Emits a {TitleUpdated} event.
setDescription
This function sets a new description
for a task.
Emits a {DescriptionUpdated} event.
setEndDate
This function sets a new endDate
for a task.
Emits an {EndDateUpdated} event.
setMetadata
This function sets a new metadata
for a task.
Emits a {MetadataUpdated} event.
NOTE
This function is not restricted by the task status. It can be called at any time by the authorized operators._
validateTask
This function checks if a task can be changed.
Requirements:
_taskId
must be a valid task id withing the right timestamp.task.status
must not beStatus.Completed
orStatus.Canceled
.msg.sender
must be an authorized operator (see {AccessControl}).
TasksManager Summarize
TheTasksManager
smart contract inherits from AccessControl
, Web3Task
, and Multicall
contracts. This contract is designed to manage tasks and provides functions to update task details.
Task Updates: The contract provides functions to update the title, description, end date, and metadata of a task. Each function first validates the task using the
validateTask
function, then updates the corresponding attribute and emits an event.Task Validation: The function
validateTask(uint256 _taskId)
checks if a task can be changed. It first retrieves the task using the provided task ID. If the task's status isCompleted
or, it reverts with anTaskCannotBeChanged
error. If the sender is not an authorized operator for the task's creator role, it reverts with anUnauthorized
error.Events: The contract emits several events when a task's details are updated. These include
TitleUpdated
,DescriptionUpdated
,EndDateUpdated
, andMetadataUpdated
. Each event includes the task ID and the new value of the updated attribute.
This contract is designed to be used as a base contract for the other contracts that need to manage tasks. It provides a simple and efficient way to update task details, and it ensures that only authorized users can perform these updates.
Last updated