-
-
Save anonymous/373a3bb6d74a852e4a2cbdc5e76e0d29 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 ^0.4; | |
contract BigSpender { | |
uint writeToMe; | |
function writes(uint){ | |
writeToMe = 1; // this throws if gas given is less than 20k | |
} | |
} | |
contract ThingDoer { | |
BigSpender bigSpender = new BigSpender(); | |
function anotherWay(){ | |
if(!address(bigSpender).call(bytes4(sha3('writes(uint256)')), 1)){ | |
// if the external call fails because OOG, we'll return | |
return; | |
} | |
else { | |
// if the external call succeeds, we'll throw | |
throw; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment