Skip to content

Instantly share code, notes, and snippets.

@amadeobrands
Last active April 3, 2017 09:34
Show Gist options
  • Select an option

  • Save amadeobrands/fa3fc695963ca4cc7559f8864ed40a33 to your computer and use it in GitHub Desktop.

Select an option

Save amadeobrands/fa3fc695963ca4cc7559f8864ed40a33 to your computer and use it in GitHub Desktop.
Simple smartcontract function | Solidity
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