hermez-node/common/pooll2tx.go
common/pooll2tx.goRaw
1package common
2
3import (
4 "math/big"
5 "time"
6
7 eth "github.com/ethereum/go-ethereum/common"
8 "github.com/iden3/go-iden3-crypto/babyjub"
9)
10
11// PoolL2Tx is a struct that represents a L2Tx sent by an account to the coordinator hat is waiting to be forged
12type PoolL2Tx struct {
13 Tx
14 ToBJJ babyjub.PublicKey
15 Status PoolL2TxStatus
16 RqTxCompressedData []byte // 253 bits, optional for atomic txs
17 RqTx RqTx
18 Timestamp time.Time // time when added to the tx pool
19 Signature babyjub.Signature // tx signature
20 ToEthAddr eth.Address
21}
22
23// RqTx Transaction Data used to indicate that a transaction depends on another transaction
24type RqTx struct {
25 FromEthAddr eth.Address
26 ToEthAddr eth.Address
27 TokenID TokenID
28 Amount *big.Int
29 FeeSelector FeeSelector
30 Nonce uint64 // effective 48 bits used
31}
32
33// PoolL2TxStatus is a struct that represents the status of a L2 transaction
34type PoolL2TxStatus string
35
36const (
37 // PoolL2TxStatusPending represents a valid L2Tx that hasn't started the forging process
38 PoolL2TxStatusPending PoolL2TxStatus = "Pending"
39 // PoolL2TxStatusForging represents a valid L2Tx that has started the forging process
40 PoolL2TxStatusForging PoolL2TxStatus = "Forging"
41 // PoolL2TxStatusForged represents a L2Tx that has already been forged
42 PoolL2TxStatusForged PoolL2TxStatus = "Forged"
43 // PoolL2TxStatusInvalid represents a L2Tx that has been invalidated
44 PoolL2TxStatusInvalid PoolL2TxStatus = "Invalid"
45)