Created
December 14, 2021 01:58
-
-
Save leeduckgo/b6415bcb9a694d2f66fc5e4e65d63af2 to your computer and use it in GitHub Desktop.
purpose_handler.sol
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
pragma solidity >=0.8.0 <0.9.0; | |
// 其它合约引用 | |
contract PurposeHandler { | |
// 变量定义 | |
string public purpose = "Building Unstoppable Apps!!!"; | |
address public owner = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4; | |
uint256 public price = 0.001 ether; | |
// 事件定义 | |
// 构造函数 | |
constructor(){ | |
} | |
// 其它函数 | |
function setPurpose(string memory newPurpose) payable public { | |
// require(msg.sender == owner, "NOT THE OWNER"); | |
require(msg.value > price, "NOT ENOUGH!"); | |
purpose = newPurpose; | |
price = msg.value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment