Last active
April 3, 2017 09:34
-
-
Save amadeobrands/fa3fc695963ca4cc7559f8864ed40a33 to your computer and use it in GitHub Desktop.
Simple smartcontract function | Solidity
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.0; | |
| contract SimpleDapp { | |
| uint someVar; | |
| function setSomeVar (uint myVar) { | |
| someVar = myVar; | |
| } | |
| function getSomeVar() constant returns (uint) { | |
| return someVar; | |
| } | |
| function setSomeVarTinmesFour(uint myVar) { | |
| setSomeVar(4 * myVar); | |
| } | |
| } | |
| contract SimpleDapp01 { | |
| SimpleDapp simpleDapp; | |
| SimpleDapp newINstanceOfSimpleDapp; | |
| function SimpleDapp01(address whereIsMyOtherContract) { | |
| simpleDapp = SimpleDapp(whereIsMyOtherContract); | |
| newINstanceOfSimpleDapp = new SimpleDapp(); | |
| } | |
| function getVarSimpleDapp() constant returns (uint) { | |
| return simpleDapp.getSomeVar(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment