Skip to content

Instantly share code, notes, and snippets.

@fmhall
Last active May 29, 2022 21:48
Show Gist options
  • Save fmhall/e5011b630439734689c6762db23fab95 to your computer and use it in GitHub Desktop.
Save fmhall/e5011b630439734689c6762db23fab95 to your computer and use it in GitHub Desktop.
// I had been intending for people to just play around with this for fun and for personal use,
// but I've been advised to remove the first portion due to regulatory uncertainty.
// This way people can still use the merge check however they want.
/** @notice Determine whether we're running in Proof of Work or Proof of Stake
@dev Post-merge, the DIFFICULTY opcode gets renamed to PREVRANDAO,
and stores the prevRandao field from the beacon chain state if EIP-4399 is finalized.
If not the difficulty must be be 0 according to EIP-3675, so both possibilities are checked here. */
function haveWeMergedYet() public view returns (bool) {
return block.difficulty > 2**64 || block.difficulty == 0;
}
}
// You can DM for the full code
@Alexintosh
Copy link

kek

@howardpen9
Copy link

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment