// Account is a struct that gives information of the holdings of an address and a specific token. Is the data structure that generates the Value stored in the leaf of the MerkleTree
typeAccountstruct{
TokenIDTokenID
NonceNonce// max of 40 bits used
Balance*big.Int// max of 192 bits used
PublicKey*babyjub.PublicKey
EthAddrethCommon.Address
IdxIdx`meddler:"idx"`
TokenIDTokenID`meddler:"token_id"`
BatchNumBatchNum`meddler:"batch_num"`
PublicKey*babyjub.PublicKey`meddler:"bjj"`
EthAddrethCommon.Address`meddler:"eth_addr"`
NonceNonce`meddler:"-"`// max of 40 bits used
Balance*big.Int`meddler:"-"`// max of 192 bits used
ToForgeL1TxsNumuint32`meddler:"to_forge_l1_txs_num"`// toForgeL1TxsNum in which the tx was forged / will be forged
Positionint`meddler:"position"`
UserOriginbool`meddler:"user_origin"`// true if the tx was originated by a user, false if it was aoriginated by a coordinator. Note that this differ from the spec for implementation simplification purpposes
FromIdxIdx`meddler:"from_idx"`// FromIdx is used by L1Tx/Deposit to indicate the Idx receiver of the L1Tx.LoadAmount (deposit)
ToIdxIdx`meddler:"to_idx"`// ToIdx is ignored in L1Tx/Deposit, but used in the L1Tx/DepositAndTransfer
TokenIDTokenID`meddler:"token_id"`
Amount*big.Int`meddler:"amount,bigint"`
LoadAmount*big.Int`meddler:"load_amount,bigint"`
EthBlockNumuint64`meddler:"eth_block_num"`// Ethereum Block Number in which this L1Tx was added to the queue
TypeTxType`meddler:"tx_type"`
BatchNumBatchNum`meddler:"-"`
TxIDTxID
ToForgeL1TxsNumuint32// toForgeL1TxsNum in which the tx was forged / will be forged
Positionint
UserOriginbool// true if the tx was originated by a user, false if it was aoriginated by a coordinator. Note that this differ from the spec for implementation simplification purpposes
FromIdxIdx// FromIdx is used by L1Tx/Deposit to indicate the Idx receiver of the L1Tx.LoadAmount (deposit)
FromEthAddrethCommon.Address
FromBJJ*babyjub.PublicKey
ToIdxIdx// ToIdx is ignored in L1Tx/Deposit, but used in the L1Tx/DepositAndTransfer
TokenIDTokenID
Amount*big.Int
LoadAmount*big.Int
EthBlockNumint64// Ethereum Block Number in which this L1Tx was added to the queue
// TxID is the identifier of a Hermez network transaction
@ -37,12 +40,29 @@ const (
// Tx is a struct used by the TxSelector & BatchBuilder as a generic type generated from L1Tx & PoolL2Tx
typeTxstruct{
TxIDTxID
FromIdxIdx// FromIdx is used by L1Tx/Deposit to indicate the Idx receiver of the L1Tx.LoadAmount (deposit)
ToIdxIdx// ToIdx is ignored in L1Tx/Deposit, but used in the L1Tx/DepositTransfer
Amount*big.Int
NonceNonce// effective 40 bits used
FeeFeeSelector
TypeTxType// optional, descrives which kind of tx it's
BatchNumBatchNum// batchNum in which this tx was forged. Presence indicates "forged" state.
// Generic
IsL1bool`meddler:"is_l1"`
TxIDTxID`meddler:"id"`
TypeTxType`meddler:"type"`
Positionint`meddler:"position"`
FromIdxIdx`meddler:"from_idx"`
ToIdxIdx`meddler:"to_idx"`
Amount*big.Int`meddler:"amount,bigint"`
AmountFloatfloat64`meddler:"amount_f"`
TokenIDTokenID`meddler:"token_id"`
USDfloat64`meddler:"amount_usd,zeroisnull"`
BatchNumBatchNum`meddler:"batch_num,zeroisnull"`// batchNum in which this tx was forged. If the tx is L2, this must be != 0
EthBlockNumint64`meddler:"eth_block_num"`// Ethereum Block Number in which this L1Tx was added to the queue
// L1
ToForgeL1TxsNumuint32`meddler:"to_forge_l1_txs_num"`// toForgeL1TxsNum in which the tx was forged / will be forged
UserOriginbool`meddler:"user_origin"`// true if the tx was originated by a user, false if it was aoriginated by a coordinator. Note that this differ from the spec for implementation simplification purpposes