Skip to content

Instantly share code, notes, and snippets.

@ConsenSys-Academy
Created August 20, 2021 14:39
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ConsenSys-Academy/be7dacf4d313ea4c1347638e921541b5 to your computer and use it in GitHub Desktop.
Save ConsenSys-Academy/be7dacf4d313ea4c1347638e921541b5 to your computer and use it in GitHub Desktop.
pragma solidity >=0.7.0 <0.9.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