Transaction Hash:
Block:
52496 at Aug-08-2015 08:28:47 AM +UTC
Transaction Fee:
0.00128962225633752 ETH
$4.13
Gas Used:
22,680 Gas / 56.861651514 Gwei
Account State Difference:
| Address | Before | After | State Difference | ||
|---|---|---|---|---|---|
| 0x48CD680b...C158c3e05 |
1,061.079395335496130142 Eth
Nonce: 1
|
1,061.078105713239792622 Eth
Nonce: 2
| 0.00128962225633752 | ||
|
0xf8E0CA3E...2141A9523
Miner
| 121.463958109005990151 Eth | 121.465247731262327671 Eth | 0.00128962225633752 |
Execution Trace
ReversibleDemo.4fb2e45d( )
// `interface` would make a nice keyword ;)
contract TheDaoHardForkOracle {
// `ran()` manually verified true on both ETH and ETC chains
function forked() constant returns (bool);
}
// demostrates calling own function in a "reversible" manner
/* important lines are marked by multi-line comments */
contract ReversibleDemo {
// counters (all public to simplify inspection)
uint public numcalls;
uint public numcallsinternal;
uint public numfails;
uint public numsuccesses;
address owner;
// needed for "naive" and "oraclized" checks
address constant withdrawdaoaddr = 0xbf4ed7b27f1d666546e30d74d50d173d20bca754;
TheDaoHardForkOracle oracle = TheDaoHardForkOracle(0xe8e506306ddb78ee38c9b0d86c257bd97c2536b3);
event logCall(uint indexed _numcalls,
uint indexed _numfails,
uint indexed _numsuccesses);
modifier onlyOwner { if (msg.sender != owner) throw; _ }
modifier onlyThis { if (msg.sender != address(this)) throw; _ }
// constructor (setting `owner` allows later termination)
function ReversibleDemo() { owner = msg.sender; }
/* external: increments stack height */
/* onlyThis: prevent actual external calling */
function sendIfNotForked() external onlyThis returns (bool) {
numcallsinternal++;
/* naive check for "is this the classic chain" */
// guaranteed `true`: enough has been withdrawn already
// three million ------> 3'000'000
if (withdrawdaoaddr.balance < 3000000 ether) {
/* intentionally not checking return value */
owner.send(42);
}
/* "reverse" if it's actually the HF chain */
if (oracle.forked()) throw;
// not exactly a "success": send() could have failed on classic
return true;
}
// accepts value transfers
function doCall(uint _gas) onlyOwner {
numcalls++;
if (!this.sendIfNotForked.gas(_gas)()) {
numfails++;
}
else {
numsuccesses++;
}
logCall(numcalls, numfails, numsuccesses);
}
function selfDestruct() onlyOwner {
selfdestruct(owner);
}
// accepts value trasfers, but does nothing
function() {}
}