Created
June 20, 2021 17:04
-
-
Save hadv/20832b2882d37bf5537c57ae7d963c0e to your computer and use it in GitHub Desktop.
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 ^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