nimbus-eth1/nimbus/transaction.nim

44 lines
1.2 KiB
Nim
Raw Normal View History

# Nimbus
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
constants, errors, eth_common
type
BaseTransaction* = ref object
nonce*: Int256
2018-05-30 16:11:15 +00:00
gasPrice*: GasInt
gas*: GasInt
to*: string
value*: UInt256
data*: string
v*: Int256
r*: Int256
s*: Int256
2018-05-30 16:11:15 +00:00
proc intrinsicGas*(t: BaseTransaction): GasInt =
# 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.intrinsicGas() > t.gas:
raise newException(ValidationError, "Insufficient gas")
# self.check_signature_validity()
2018-01-17 14:16:00 +00:00
proc sender*(t: BaseTransaction): string =
2018-01-17 14:16:00 +00:00
# TODO
""