Feature/merge history l2 tables (#156)

* WIP rebase

* Combine both SQL DBs

* API and DB refactor
This commit is contained in:
a_bennassar
2020-09-29 18:27:07 +02:00
committed by GitHub
parent 8efbb7ab18
commit c6f70f3177
34 changed files with 1493 additions and 990 deletions

View File

@@ -13,7 +13,9 @@ type L2Tx struct {
FromIdx Idx
ToIdx Idx
Amount *big.Int
USD *float64
Fee FeeSelector
FeeUSD *float64
Nonce Nonce
Type TxType
EthBlockNum int64 // Ethereum Block Number in which this L2Tx was added to the queue
@@ -23,6 +25,12 @@ type L2Tx struct {
func (tx *L2Tx) Tx() *Tx {
f := new(big.Float).SetInt(tx.Amount)
amountFloat, _ := f.Float64()
batchNum := new(BatchNum)
*batchNum = tx.BatchNum
fee := new(FeeSelector)
*fee = tx.Fee
nonce := new(Nonce)
*nonce = tx.Nonce
return &Tx{
IsL1: false,
TxID: tx.TxID,
@@ -31,11 +39,13 @@ func (tx *L2Tx) Tx() *Tx {
FromIdx: tx.FromIdx,
ToIdx: tx.ToIdx,
Amount: tx.Amount,
USD: tx.USD,
AmountFloat: amountFloat,
BatchNum: tx.BatchNum,
BatchNum: batchNum,
EthBlockNum: tx.EthBlockNum,
Fee: tx.Fee,
Nonce: tx.Nonce,
Fee: fee,
FeeUSD: tx.FeeUSD,
Nonce: nonce,
}
}