You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
839 B

  1. package common
  2. import (
  3. "math/big"
  4. )
  5. // L2Tx is a struct that represents an already forged L2 tx
  6. type L2Tx struct {
  7. // Stored in DB: mandatory fileds
  8. TxID TxID `meddler:"tx_id"`
  9. BatchNum BatchNum `meddler:"batch_num"` // batchNum in which this tx was forged.
  10. Position int `meddler:"position"`
  11. FromIdx Idx `meddler:"from_idx"`
  12. ToIdx Idx `meddler:"to_idx"`
  13. Amount *big.Int `meddler:"amount,bigint"`
  14. Fee FeeSelector `meddler:"fee"`
  15. Nonce Nonce `meddler:"nonce"`
  16. // Extra metadata, may be uninitialized
  17. Type TxType `meddler:"-"` // optional, descrives which kind of tx it's
  18. }
  19. func (tx *L2Tx) Tx() *Tx {
  20. return &Tx{
  21. TxID: tx.TxID,
  22. FromIdx: tx.FromIdx,
  23. ToIdx: tx.ToIdx,
  24. Amount: tx.Amount,
  25. Nonce: tx.Nonce,
  26. Fee: tx.Fee,
  27. Type: tx.Type,
  28. }
  29. }