-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTodolist.sol
More file actions
33 lines (28 loc) · 799 Bytes
/
Todolist.sol
File metadata and controls
33 lines (28 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: MIT
pragma solidity 0.8.8;
contract Todo{
uint public task_count =0;
struct todo
{
string title ;
string description;
uint256 timeCreatedAt;
address createdBy;
}
todo[] public todolist;
function addtodo(string memory _title, string memory _description) public
{
todolist.push(todo(_title,_description,block.timestamp,msg.sender));
task_count++;
}
function donetodo(uint256 _index) public
{
delete todolist[_index];
task_count--;
}
function updatetodo(uint256 _index,string memory _title, string memory _description ) public
{
delete todolist[_index];
todolist[_index]= todo(_title,_description,block.timestamp,msg.sender);
}
}