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 virtualThis function sets a new title for a task.
Emits a {TitleUpdated} event.
setDescription
function setDescription(uint256 _taskId, string _description) public virtualThis function sets a new description for a task.
Emits a {DescriptionUpdated} event.
setEndDate
function setEndDate(uint256 _taskId, uint256 _endDate) public virtualThis function sets a new endDate for a task.
Emits an {EndDateUpdated} event.
setMetadata
function setMetadata(uint256 _taskId, string _metadata) public virtualThis function sets a new metadata for a task.
Emits a {MetadataUpdated} event.
validateTask
function validateTask(uint256 _taskId) internal viewThis function checks if a task can be changed.
Requirements:
_taskIdmust be a valid task id withing the right timestamp.task.statusmust not beStatus.CompletedorStatus.Canceled.msg.sendermust 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
validateTaskfunction, 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 isCompletedor, it reverts with anTaskCannotBeChangederror. If the sender is not an authorized operator for the task's creator role, it reverts with anUnauthorizederror.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