I have 2 smart contracts. The first contract has some basic function for a ToDo list. So functions to add or delete tasks. The second contract is just a standard ERC20 contract with fixed cap of 100 mil tokens.
So I need a function to give the user that created/deleted a task 1 token. So every time the user uses the function addTask or deleteTask he will get automatically 1 token to his wallet address. Is this possible?
Environment
Remix, local server and Ganache
Details
Code to reproduce
solidity ^0.5.1;
contract Tasks{
// Defining a structure to
// store a task
struct Task
{
string task;
bool isDone;
}
mapping (address => Task[]) private Users;
function addTask(string calldata _task) external
{
Users[msg.sender].push(Task({
task:_task,
isDone:false
}));
}
function deleteTask(uint256 _taskIndex) external
{
delete Users[msg.sender][_taskIndex];
}
}