Skip to content

Instantly share code, notes, and snippets.

@trapp
Last active July 20, 2016 19:31
Show Gist options
  • Save trapp/75f15803910b0e2775a7b39864f0bf77 to your computer and use it in GitHub Desktop.
Save trapp/75f15803910b0e2775a7b39864f0bf77 to your computer and use it in GitHub Desktop.
Splits ETH into 2 addresses, depending on which chain it runs on.
contract ReplaySafeSplit {
// Fork oracle to use
AmIOnTheFork amIOnTheFork = AmIOnTheFork(0x2bd2326c993dfaef84f696526064ff22eba5b362);
// Splits the funds into 2 addresses
function split(address targetFork, address targetNoFork) returns(bool) {
if (amIOnTheFork.forked() && targetFork.send(msg.value)) {
return true;
} else if (!amIOnTheFork.forked() && targetNoFork.send(msg.value)) {
return true;
}
throw;
}
// Reject value transfers.
function() {
throw;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment