Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save notatestuser/69a0b4d0baa83305ef5fbd90c69f2fa9 to your computer and use it in GitHub Desktop.
Save notatestuser/69a0b4d0baa83305ef5fbd90c69f2fa9 to your computer and use it in GitHub Desktop.
helloworld.sol
// The source code is for Solidity version
// greater than 0.7.0
pragma solidity >=0.7.0 <0.9.0;
// https://github.com/OpenZeppelin/openzeppelin-contracts
import "@openzeppelin/contracts/access/Ownable.sol";
// Starts the contract
contract HelloWorld is Ownable {
// The keyword "public" makes variables
// accessible from other contracts
string public message;
// Constructor code runs when the contract is completed
constructor(string memory firstMessage) {
message = firstMessage;
}
function update(string memory newMessage) public onlyOwner {
message = newMessage;
}
// getter
function getMessage() public view returns (string memory) {
return message;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment