Enum EthereumVersion

java.lang.Object
java.lang.Enum<EthereumVersion>
com.norswap.nanoeth.versions.EthereumVersion
All Implemented Interfaces:
Serializable, Comparable<EthereumVersion>, Constable

public enum EthereumVersion
extends Enum<EthereumVersion>
Enumeration of Ethereum's "versions": the hard forks that were rolled out during the chain's history.

Note that the CONSTANTINOPLE fork also includes the St-Petersburg hard fork at the same block height, which removes EIP-1283, which was only rolled out on the testnets.

  • Enum Constant Details

  • Field Details

    • startBlock

      public final int startBlock
      Block height where the fork took effect.
  • Method Details

    • values

      public static EthereumVersion[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static EthereumVersion valueOf​(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • isFuture

      public boolean isFuture()
      Returns true iff the current block height (Context.blockHeight) is lower than the initial block height (startBlock) of this version.
    • isPast

      public boolean isPast()
      Returns true iff the current block height (Context.blockHeight) is higher or equal than the initial block height (startBlock) of this version.
    • startsBefore

      public boolean startsBefore​(int blockHeight)
      Returns true iff the start block of this version is before the given block height.
    • startsBefore

      public boolean startsBefore​(Natural blockHeight)
      Returns true iff the start block of this version is before the given block height.
    • contains

      public boolean contains​(int blockHeight)
      Returns true iff the given block height is "within" this version: after or on its start block, but before the start block of the next version.
    • contains

      public boolean contains​(Natural blockHeight)
      Returns true if the given block height is "within" this version: after or on its start block, but before the start block of the next version.