Skip to content

Instantly share code, notes, and snippets.

@etscrivner
Last active October 17, 2016 17:04
Show Gist options
  • Select an option

  • Save etscrivner/2e96868cb32d2e1c1787dadbb0ebeaf7 to your computer and use it in GitHub Desktop.

Select an option

Save etscrivner/2e96868cb32d2e1c1787dadbb0ebeaf7 to your computer and use it in GitHub Desktop.
Solidity contract used to determine the constant that should be used in EIP-150 fork oracle.
pragma solidity ^0.4.2;
contract EIP150ForkConstant {
// Used to determine gas constant
event GasConstant(uint first, uint second, uint third);
event OnFork(bool forked);
// This function should be called between block X and Y.
function run() {
uint beforeGas = 0;
uint afterGas = 0;
assembly {
beforeGas := gas
balance
afterGas := gas
}
GasConstant(beforeGas, afterGas, (beforeGas - afterGas));
OnFork((beforeGas - afterGas) == 27);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment