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.

42 lines
1.3 KiB

  1. package common
  2. import (
  3. "math/big"
  4. eth "github.com/ethereum/go-ethereum/common"
  5. )
  6. // Tx is a struct that represents a Hermez network transaction
  7. type Tx struct {
  8. ID TxID
  9. FromEthAddr eth.Address
  10. ToEthAddr eth.Address
  11. FromIdx uint32
  12. ToIdx uint32
  13. TokenID TokenID
  14. Amount *big.Int
  15. Nonce uint64 // effective 48 bits used
  16. FeeSelector FeeSelector
  17. Type TxType // optional, descrives which kind of tx it's
  18. }
  19. // TxID is the identifier of a Hermez network transaction
  20. type TxID Hash // Hash is a guess
  21. // TxType is a string that represents the type of a Hermez network transaction
  22. type TxType string
  23. const (
  24. // Exit represents L2->L1 token transfer. A leaf for this account appears in the exit tree of the block
  25. Exit TxType = "Exit"
  26. // Withdrawn represents the balance that was moved from L2->L1 has been widthrawn from the smart contract
  27. Withdrawn TxType = "Withdrawn"
  28. // Transfer represents L2->L2 token transfer
  29. Transfer TxType = "Transfer"
  30. // Deposit represents L1->L2 transfer
  31. Deposit TxType = "Deposit"
  32. // CreateAccountDeposit represents creation of a new leaf in the state tree (newAcconut) + L1->L2 transfer
  33. CreateAccountDeposit TxType = "CreateAccountDeposit"
  34. // CreateAccountDepositTransfer represents L1->L2 transfer + L2->L2 transfer
  35. CreateAccountDepositTransfer TxType = "CreateAccountDepositTransfer"
  36. )