hermez-node/common/l2tx.go
common/l2tx.goRaw
1package common
2
3import (
4 "math/big"
5)
6
7// L2Tx is a struct that represents an already forged L2 tx
8type L2Tx struct {
9 // Stored in DB: mandatory fileds
10 TxID TxID `meddler:"tx_id"`
11 BatchNum BatchNum `meddler:"batch_num"` // batchNum in which this tx was forged.
12 Position int `meddler:"position"`
13 FromIdx Idx `meddler:"from_idx"`
14 ToIdx Idx `meddler:"to_idx"`
15 Amount *big.Int `meddler:"amount,bigint"`
16 Fee FeeSelector `meddler:"fee"`
17 Nonce Nonce `meddler:"nonce"`
18 Type TxType `meddler:"tx_type"`
19}
20
21// Tx returns a *Tx from the L2Tx
22func (tx *L2Tx) Tx() *Tx {
23 return &Tx{
24 TxID: tx.TxID,
25 FromIdx: tx.FromIdx,
26 ToIdx: tx.ToIdx,
27 Amount: tx.Amount,
28 Nonce: tx.Nonce,
29 Fee: tx.Fee,
30 Type: tx.Type,
31 }
32}