Skip to content

Instantly share code, notes, and snippets.

@charleslukes
Created May 1, 2021 23:25
Show Gist options
  • Save charleslukes/b3dae1251e6a128eb059230296ad7e56 to your computer and use it in GitHub Desktop.
Save charleslukes/b3dae1251e6a128eb059230296ad7e56 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.1+commit.df193b15.js&optimize=false&runs=200&gist=
SIMPLE GREETER PROJECT
This is a contract that
1. SET AND GETS Owners name
2. say hello with Owners name.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Greeter
*/
contract Greeter {
string private ownerName;
function setOwnerName(string memory name) public {
ownerName = name;
}
/**
* @dev gets the owners name
* @return string owners name
*/
function getOwnerName() public view returns (string memory) {
return ownerName;
}
/**
* @dev say hello with owner name.
* @return value of 'string'
*/
function sayHello() public view returns (string memory){
return string(abi.encodePacked("Hello ", ownerName));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment