-
-
Save mcne65/85a6f6c24a5d5570aca8e0173f53c10e to your computer and use it in GitHub Desktop.
Inter-contract execution in Solidity
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.5.0; | |
contract Base { | |
uint x; | |
constructor() public { | |
x = 10; | |
} | |
function setX(uint _x) public returns(bool) { | |
x = _x; | |
return true; | |
} | |
function getX() public view returns(uint) { | |
return x; | |
} | |
} | |
contract Caller { | |
function getBaseX(address baseAddress) public view returns(uint) { | |
Base baseContract = Base(baseAddress); | |
return baseContract.getX(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment