nimbus-eth1/src/transaction.nim

36 lines
851 B
Nim
Raw Normal View History

import
constants, errors
type
BaseTransaction* = ref object
nonce*: Int256
gasPrice*: Int256
gas*: Int256
to*: cstring
value*: Int256
data*: cstring
v*: Int256
r*: Int256
s*: Int256
proc intrinsicGas*(t: BaseTransaction): Int256 =
# Compute the baseline gas cost for this transaction. This is the amount
# of gas needed to send this transaction (but that is not actually used
# for computation)
raise newException(ValueError, "not implemented intrinsicGas")
proc validate*(t: BaseTransaction) =
# Hook called during instantiation to ensure that all transaction
# parameters pass validation rules
if t.intrinsic_gas() > t.gas:
raise newException(ValidationError, "Insufficient gas")
# self.check_signature_validity()
2018-01-17 14:16:00 +00:00
proc sender*(t: BaseTransaction): cstring =
# TODO
cstring""