Skip to content

Instantly share code, notes, and snippets.

@mcne65
Forked from critesjosh/BaseCaller.sol
Created December 29, 2019 01:34
Show Gist options
  • Save mcne65/29beb05d954081416220539659f254e4 to your computer and use it in GitHub Desktop.
Save mcne65/29beb05d954081416220539659f254e4 to your computer and use it in GitHub Desktop.
Inter-contract execution in Solidity
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