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.

45 lines
1.5 KiB

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