Package org.apache.tuweni.units.ethereum
Class Gas
- All Implemented Interfaces:
Comparable<org.apache.tuweni.bytes.Bytes>,org.apache.tuweni.bytes.Bytes,org.apache.tuweni.bytes.Bytes32,UInt256Value<Gas>
A unit measure of Gas as used by the Ethereum VM.
-
Field Summary
FieldsFields inherited from interface org.apache.tuweni.bytes.Bytes
EMPTYFields inherited from interface org.apache.tuweni.bytes.Bytes32
SIZE -
Method Summary
Modifier and TypeMethodDescriptionstatic GasProvides the minimum value between 2 gas objects.The price of this amount of gas given the provided price per unit of gas.booleantooHigh()Returns true if the gas value is past the maximum allowed gas, 2^63 -1static GasvalueOf(long value) Return aGascontaining the specified value.static GasvalueOf(BigInteger value) Return aGascontaining the specified value.static GasReturn aGascontaining the specified value.Methods inherited from class org.apache.tuweni.units.bigints.BaseUInt256Value
add, add, add, addMod, addMod, addMod, addMod, compareTo, copy, divide, divide, divide, divideCeil, divideCeil, divideCeil, equals, get, hashCode, max, mod, mod, mod0, mod0, multiply, multiply, multiply, multiplyMod, multiplyMod, multiplyMod, multiplyMod, mutableCopy, pow, pow, slice, subtract, subtract, subtract, toBytes, toLong, toMinimalBytes, toString, toUInt256, zeroMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.tuweni.bytes.Bytes
and, and, appendHexTo, appendTo, appendTo, bitLength, commonPrefix, commonPrefixLength, compareTo, copyTo, copyTo, getInt, getInt, getLong, getLong, hasLeadingZero, hasLeadingZeroByte, isEmpty, isZero, not, numberOfLeadingZeroBytes, numberOfLeadingZeros, numberOfTrailingZeroBytes, or, or, reverse, shiftLeft, shiftRight, slice, toArray, toArray, toArrayUnsafe, toBase64String, toEllipsisHexString, toFastHex, toHexString, toInt, toLong, toQuantityHexString, toShortHexString, toUnprefixedHexString, toUnsignedBigInteger, toUnsignedBigInteger, trimLeadingZeros, trimTrailingZeros, update, xor, xorMethods inherited from interface org.apache.tuweni.bytes.Bytes32
and, not, or, shiftLeft, shiftRight, size, xorMethods inherited from interface org.apache.tuweni.units.bigints.UInt256Value
addExact, addExact, addSafe, addSafe, fitsInt, fitsInt, fitsLong, fitsLong, greaterOrEqualThan, greaterThan, intValue, lessOrEqualThan, lessThan, plus, plus, subtractExact, subtractExact, toBigInteger, toBigInteger, toDecimalString, toInt, toSignedBigInteger, toSignedBigInteger
-
Field Details
-
ZERO
-
MAX
-
-
Method Details
-
valueOf
Return aGascontaining the specified value.- Parameters:
value- The value to create aGasfor.- Returns:
- A
Gascontaining the specified value. - Throws:
IllegalArgumentException- If the value is negative.
-
valueOf
Return aGascontaining the specified value.- Parameters:
value- The value to create aGasfor.- Returns:
- A
Gascontaining the specified value. - Throws:
IllegalArgumentException- If the value is negative.
-
valueOf
Return aGascontaining the specified value.- Parameters:
value- The value to create aGasfor.- Returns:
- A
Gascontaining the specified value. - Throws:
IllegalArgumentException- If the value is negative.
-
minimum
Provides the minimum value between 2 gas objects.- Parameters:
one- a gas objecttwo- another gas object- Returns:
- the minimum between the 2 gas objects
-
priceFor
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
-