Skip to content

Instantly share code, notes, and snippets.

@pcaversaccio
Last active September 13, 2022 19:19
Show Gist options
  • Save pcaversaccio/87b4666b2131ad950bf9ee97573447be to your computer and use it in GitHub Desktop.
Save pcaversaccio/87b4666b2131ad950bf9ee97573447be to your computer and use it in GitHub Desktop.
This smart contract determines whether "The Merge" has already taken place or not.
// SPDX-License-Identifier: WTFPL
pragma solidity 0.8.16;
contract Merge {
uint72 private constant _DIFFICULTY_THRESHOLD = 2**64;
/**
* @dev A difficulty value greater than `2**64` indicates that a transaction is
* being executed in a PoS block. Also note that the `DIFFICULTY` opcode (0x44)
* is renamed to `PREVRANDAO` post-merge.
*
* For further information, see here: https://eips.ethereum.org/EIPS/eip-4399.
*/
function merged() public view returns (bool) {
return block.difficulty > _DIFFICULTY_THRESHOLD;
}
}
@pcaversaccio
Copy link
Author

Official deployment address 0x17FEF0D05fFed818aF08AE00BeC06B65c4319618.

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