All Implemented Interfaces:
Comparable<org.apache.tuweni.bytes.Bytes>, org.apache.tuweni.bytes.Bytes, org.apache.tuweni.bytes.Bytes32, UInt256Value<Gas>

public final class Gas extends BaseUInt256Value<Gas>
A unit measure of Gas as used by the Ethereum VM.
  • Field Details

    • ZERO

      public static final Gas ZERO
    • MAX

      public static final Gas MAX
  • Method Details

    • valueOf

      public static Gas valueOf(UInt256 value)
      Return a Gas containing the specified value.
      Parameters:
      value - The value to create a Gas for.
      Returns:
      A Gas containing the specified value.
      Throws:
      IllegalArgumentException - If the value is negative.
    • valueOf

      public static Gas valueOf(long value)
      Return a Gas containing the specified value.
      Parameters:
      value - The value to create a Gas for.
      Returns:
      A Gas containing the specified value.
      Throws:
      IllegalArgumentException - If the value is negative.
    • valueOf

      public static Gas valueOf(BigInteger value)
      Return a Gas containing the specified value.
      Parameters:
      value - The value to create a Gas for.
      Returns:
      A Gas containing the specified value.
      Throws:
      IllegalArgumentException - If the value is negative.
    • minimum

      public static Gas minimum(Gas one, Gas two)
      Provides the minimum value between 2 gas objects.
      Parameters:
      one - a gas object
      two - another gas object
      Returns:
      the minimum between the 2 gas objects
    • priceFor

      public Wei priceFor(Wei gasPrice)
      The price of this amount of gas given the provided price per unit of gas.
      Parameters:
      gasPrice - The price per unit of gas.
      Returns:
      The price of this amount of gas for a per unit of gas price of gasPrice.
    • tooHigh

      public boolean tooHigh()
      Returns true if the gas value is past the maximum allowed gas, 2^63 -1
      Returns:
      true if gas is past allowed maximum