Skip to content

Instantly share code, notes, and snippets.

@hadv
Created June 20, 2021 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadv/20832b2882d37bf5537c57ae7d963c0e to your computer and use it in GitHub Desktop.
Save hadv/20832b2882d37bf5537c57ae7d963c0e to your computer and use it in GitHub Desktop.
pragma solidity ^8.0.0;
contract Machine {
address immutable public s;
constructor(address addr) public {
s = addr;
calculateResult = 0;
}
function saveValue(uint x) public returns (bool) {
bool success;
(successs, _) = s.call(abi.encodeWithSignature("setValue(uint)", x));
if (!successs) {
// solhint-disable-next-line no-inline-assembly
assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment