How To Create Smart Contract In Solidity

[Solved] How To Create Smart Contract In Solidity | Solidity - Code Explorer | yomemimo.com
Question : smart contract function in solidity

Answered by : shirshak

//This is real life smart contract function which contains tasks array of struct
//taskToOwner container to map taskId with msg.sender.and AddTask event.
//We all use function in addTask function
contract TaskContract{ //COMMENT EVENTS event AddTask(address recipient,uint taskId); //COMMENT Task structure struct Task{ uint id; string taskText; bool isDeleted; } //COMMENT create array name tasks with struct Task Task[] private tasks; //COMMENT mapping in taskToOwner with key value pair of taskid with owner address mapping(uint256 => address) taskToOwner; //COMMENT Contract function function addTask(string memory taskText, bool isDeleted) external { uint taskId = tasks.length; tasks.push(Task(taskId,taskText,isDeleted)); taskToOwner[taskId]=msg.sender; emit AddTask(msg.sender,taskId); }
}

Source : | Last Update : Sat, 17 Sep 22

Question : how to create smart contract in solidity

Answered by : asif-iqbal-paracha

// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0 <0.7.0;
contract SimpleStorage { uint storedData; function set(uint x) public { storedData = x; } function get() public view returns (uint) { return storedData; }
}

Source : https://www.quicknode.com/guides/solidity/how-to-write-an-ethereum-smart-contract-using-solidity | Last Update : Tue, 08 Mar 22

Answers related to how to create smart contract in solidity

Code Explorer Popular Question For Solidity