Created
June 14, 2021 05:47
-
-
Save johnson86tw/ea1d60a3509d6f760a4145aac4e5274c to your computer and use it in GitHub Desktop.
This file contains 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
contract WithoutZK { | |
string greeting = "hello world"; | |
uint256 answer = 1770; | |
function greet() public view returns (string memory) { | |
return greeting; | |
} | |
function _setGreeting(string memory _greeting) internal { | |
greeting = _greeting; | |
} | |
function process(uint256 _secret) public { | |
require(verify(_secret), "invalid"); | |
_setGreeting("answer to the ultimate question of life, the universe, and everything"); | |
} | |
function verify(uint256 _secret) public view returns(bool){ | |
return calculate(_secret) == answer; | |
} | |
function calculate(uint256 _secret) public pure returns(uint256) { | |
return _secret*_secret + 6; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment