-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathto_do.sol
37 lines (32 loc) · 1.01 KB
/
to_do.sol
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
34
35
pragma solidity ^0.5.17 ;
pragma experimental ABIEncoderV2;
contract todo{
address owner = msg.sender;
struct Tasks{
string task;
bool taskdone;
}
mapping (address => Tasks[]) private user;
function addTask(string calldata _task) external {
user[owner].push(Tasks({
task:_task,
taskdone:false
}));
}
function getTask(uint _taskindex) external view returns (Tasks memory ){
Tasks memory task = user[msg.sender][_taskindex];
return task;
}
function updateStatus(uint256 _taskIndex,bool _status) external
{
user[msg.sender][_taskIndex].taskdone = _status;
}
function deleteTask(uint256 _taskIndex) external
{
delete user[msg.sender][_taskIndex];
}
function getTaskCount() external view returns (uint256)
{
return user[msg.sender].length;
}
}