Created
November 25, 2017 16:11
-
-
Save anonymous/7d8875b744432f0a7a997c7171424847 to your computer and use it in GitHub Desktop.
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.18+commit.9cf6e910.js&optimize=undefined&gist=
This file contains hidden or 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.4.11; | |
| contract ViewCounter { | |
| address public donator; | |
| function ViewCounter() { | |
| donator = msg.sender; | |
| } | |
| function () payable { | |
| donator = msg.sender; | |
| } | |
| function setDonator (address _donator) internal { | |
| donator = _donator; | |
| } | |
| } |
This file contains hidden or 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.4.18; | |
| contract HelloWorld { | |
| string name; | |
| uint age; | |
| function getData() public constant returns (string) { | |
| return name; | |
| } | |
| function setData(string newData) public { | |
| name = newData; | |
| } | |
| function getData() public constant return (age) { | |
| return age; | |
| } | |
| function setData(uint newData) public { | |
| age = newData; | |
| } | |
| } |
This file contains hidden or 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.4.11; | |
| contract ParentContract { | |
| address public donator; | |
| function ParentContract() { | |
| donator = msg.sender; | |
| } | |
| function () payable { | |
| donator = msg.sender; | |
| } | |
| function setDonator(address _donator) internal { | |
| donator = _donator; | |
| } | |
| } | |
| contract ChildContract is ParentContract { | |
| function setRealDonator(address _donator) payable { | |
| if (msg.value > 1 * 1 ether){ | |
| donator = _donator; | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment