Last active
May 29, 2022 21:48
-
-
Save fmhall/e5011b630439734689c6762db23fab95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kek