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.

31 lines
768 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. Type TxType `meddler:"tx_type"`
  17. }
  18. func (tx *L2Tx) Tx() *Tx {
  19. return &Tx{
  20. TxID: tx.TxID,
  21. FromIdx: tx.FromIdx,
  22. ToIdx: tx.ToIdx,
  23. Amount: tx.Amount,
  24. Nonce: tx.Nonce,
  25. Fee: tx.Fee,
  26. Type: tx.Type,
  27. }
  28. }