TasksManager

The main contract that manages the tasks.

TaskCannotBeChanged

error TaskCannotBeChanged(uint256 taskId, enum IWeb3Task.Status status)

Emitted when a task cannot be changed.

TitleUpdated

event TitleUpdated(uint256 taskId, string title)

Emitted when a title is updated.

DescriptionUpdated

event DescriptionUpdated(uint256 taskId, string description)

Emitted when a description is updated.

EndDateUpdated

event EndDateUpdated(uint256 taskId, uint256 endDate)

Emitted when an end date is updated.

MetadataUpdated

event MetadataUpdated(uint256 taskId, string metadata)

Emitted when metadata is updated.

setTitle

function setTitle(uint256 _taskId, string _title) public virtual

This function sets a new title for a task.

Emits a {TitleUpdated} event.

setDescription

function setDescription(uint256 _taskId, string _description) public virtual

This function sets a new description for a task.

Emits a {DescriptionUpdated} event.

setEndDate

function setEndDate(uint256 _taskId, uint256 _endDate) public virtual

This function sets a new endDate for a task.

Emits an {EndDateUpdated} event.

setMetadata

function setMetadata(uint256 _taskId, string _metadata) public virtual

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

function validateTask(uint256 _taskId) internal view

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 be Status.Completed or Status.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 is Completed or, it reverts with an TaskCannotBeChanged error. If the sender is not an authorized operator for the task's creator role, it reverts with an Unauthorized error.

  • Events: The contract emits several events when a task's details are updated. These include TitleUpdated, DescriptionUpdated, EndDateUpdated, and MetadataUpdated. 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