Skip to content

Instantly share code, notes, and snippets.

@wissalHaji
Last active October 27, 2020 11:39
Show Gist options
  • Save wissalHaji/3f439098d3ce3c76d1cc4432b6da550e to your computer and use it in GitHub Desktop.
Save wissalHaji/3f439098d3ce3c76d1cc4432b6da550e to your computer and use it in GitHub Desktop.
Example for the msg.sender property
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.7.0;
contract HelloWorldContract {
string greeting;
address owner;
constructor() {
greeting = "hello world";
owner = msg.sender;
}
function sayHello() external view returns(string memory) {
if(msg.sender == owner)
return "hello Daddy";
else
return greeting;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment