//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.18; contract ValueContract{ string word; address owner; // to avoid double code we add this modifier modifier onlyOwner(){ require(msg.sender==owner); //must have _;!! _; } //constractor function ValueContract(string _word) public{ word=_word; owner=msg.sender; } //seter function setWord(string _word) public payable{ require(msg.value> 1 ether); word=_word; } //geter function getWord() public view returns(string ){ return word; } // seter for the owner so it wont cost him gas function setWordForFree(string _word) onlyOwner public{ word=_word; } //transfer the ownership only by the owner function transferOwnership(address _owner) onlyOwner public{ owner=_owner; } //fallback fucntion //fucntion () payable{ //} }
0.4.18