Last active
May 25, 2022 04:30
-
-
Save korrio/662c13bbcf1f0001712e3ab972e2459a to your computer and use it in GitHub Desktop.
YourContract.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.8.0 <0.9.0; | |
//SPDX-License-Identifier: MIT | |
import "hardhat/console.sol"; | |
// import "@openzeppelin/contracts/access/Ownable.sol"; | |
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol | |
contract YourContract { | |
event SetPurpose(address sender, string purpose); | |
string public purpose = "Building Unstoppable Apps!!!"; | |
uint public korr = 10 ether; // 10 * 10 ** 18 wei | |
uint public korr2 = 10; // 10 wei | |
uint private korr3 = 125; | |
constructor() payable { | |
// what should we do on deploy? | |
} | |
function getKorr3() public view returns(uint) { | |
return korr3; | |
} | |
function getPlusProduct() public view returns(uint) { | |
return korr + korr2; | |
} | |
function setKorr(uint _korr) public { | |
korr = _korr; | |
} | |
function setKorr2(uint _korr2) public { | |
korr2 = _korr2; | |
} | |
function setPurpose(string memory newPurpose) public { | |
purpose = newPurpose; | |
console.log(msg.sender,"set purpose to",purpose); | |
emit SetPurpose(msg.sender, purpose); | |
} | |
// to support receiving ETH by default | |
receive() external payable {} | |
fallback() external payable {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment