Skip to content

Instantly share code, notes, and snippets.

@D-Nice
Last active January 11, 2020 00:54
Show Gist options
  • Save D-Nice/0e08f6390499922496bc9b96cb9cd2e9 to your computer and use it in GitHub Desktop.
Save D-Nice/0e08f6390499922496bc9b96cb9cd2e9 to your computer and use it in GitHub Desktop.
contract ForkSplitterConduit {
//Tracks whether hard fork is effective on this chain. True means the fork is passed, false it hasn't.
bool forked = false;
//Identifies on which network fork this contract should do transfers. True transfers only on a hard-fork network, and false on the original network.
bool transferOnlyFork;
//Hard-fork DAO withdrawal contract
address constant C = 0xbf4ed7b27f1d666546e30d74d50d173d20bca754;
//In Constructor you set whether you want this contract to operate on hard fork or non-hard fork network
// Set to true for transfers to only complete on hard fork, and false for non-hard fork
function ForkSplitterConduit (bool _transferOnlyFork) {
transferOnlyFork = _transferOnlyFork;
}
//Needs to be called as close as possible to block 1920000, can use an alarm service to call this
function checkFork() returns (bool) {
if (msg.value != 0)
throw;
//Checks whether it is after the block that the hard-fork is supposed to take place, which is block 1920000
//Gives someone ~12 days days to call this, which checks whether the balance in the hard fork withdraw contract
//is above a certain threshhold (9m in this case) which indicates that the hard-fork is live.
if (block.number >= 1920000 && block.number <= 2000000 && C.balance >= 9000000 ether)
forked = true;
return forked;
}
//Transfers are only possible after the hard fork is supposed to take effect.
function transfer(address _recipient) returns (bool) {
if (transferOnlyFork != forked && block.number < 1920000)
throw;
if(!_recipient.send(msg.value))
throw;
return true;
}
function() {
throw;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment