From 9d0b278d50680142e9d93f3a81ad4027850198af Mon Sep 17 00:00:00 2001 From: arnaucube Date: Wed, 9 Dec 2020 18:26:54 +0100 Subject: [PATCH] Update missing LoadAmount to DepositAmount Related to https://github.com/hermeznetwork/hermez-node/commit/445f26ec9f908f0ced10565121c3556ff1862515 --- api/swagger.yml | 6 +++--- api/txshistory_test.go | 4 ++-- common/ethrollup.go | 2 +- db/historydb/historydb_test.go | 2 +- db/historydb/views.go | 2 +- db/migrations/0001.sql | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/swagger.yml b/api/swagger.yml index f18d147..d337e37 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -1768,7 +1768,7 @@ components: example: true historicDepositAmountUSD: type: number - description: Load amount in USD, at the moment the transaction was made. + description: Deposit amount in USD, at the moment the transaction was made. example: 3.897 nullable: true ethereumBlockNum: @@ -2974,7 +2974,7 @@ components: example: 1 limitDepositAmount: type: integer - description: Maximum load amount (L1 to L2) allowed. + description: Maximum deposit amount (L1 to L2) allowed. example: 321 limitL2TransferAmount: type: integer @@ -3116,4 +3116,4 @@ components: allOf: - $ref: '#/components/schemas/Error' - example: - message: Database error. \ No newline at end of file + message: Database error. diff --git a/api/txshistory_test.go b/api/txshistory_test.go index 29c628a..9d7855a 100644 --- a/api/txshistory_test.go +++ b/api/txshistory_test.go @@ -166,9 +166,9 @@ func genTestTxs( } laf := new(big.Float).SetInt(l1.DepositAmount) depositAmountFloat, _ := laf.Float64() - loadUSD := *token.USD * depositAmountFloat / math.Pow(10, float64(token.Decimals)) + depositUSD := *token.USD * depositAmountFloat / math.Pow(10, float64(token.Decimals)) if depositAmountFloat != 0 { - tx.L1Info.HistoricDepositAmountUSD = &loadUSD + tx.L1Info.HistoricDepositAmountUSD = &depositUSD } } txs = append(txs, tx) diff --git a/common/ethrollup.go b/common/ethrollup.go index 0e64585..eb12c01 100644 --- a/common/ethrollup.go +++ b/common/ethrollup.go @@ -87,7 +87,7 @@ const ( ) var ( - // RollupConstLimitDepositAmount Max load amount allowed (depositAmount: L1 --> L2) + // RollupConstLimitDepositAmount Max deposit amount allowed (depositAmount: L1 --> L2) RollupConstLimitDepositAmount, _ = new(big.Int).SetString("340282366920938463463374607431768211456", 10) // RollupConstLimitL2TransferAmount Max amount allowed (amount L2 --> L2) RollupConstLimitL2TransferAmount, _ = new(big.Int).SetString("6277101735386680763835789423207666416102355444464034512896", 10) diff --git a/db/historydb/historydb_test.go b/db/historydb/historydb_test.go index baa9224..d7f4393 100644 --- a/db/historydb/historydb_test.go +++ b/db/historydb/historydb_test.go @@ -516,7 +516,7 @@ func TestTxs(t *testing.T) { assert.Equal(t, true, dbL1Txs[8].UserOrigin) assert.Equal(t, true, dbL1Txs[9].UserOrigin) - // Load Amount + // Deposit Amount assert.Equal(t, big.NewInt(10), dbL1Txs[0].DepositAmount) assert.Equal(t, big.NewInt(10), dbL1Txs[1].DepositAmount) assert.Equal(t, big.NewInt(20), dbL1Txs[2].DepositAmount) diff --git a/db/historydb/views.go b/db/historydb/views.go index d79e8fd..d1784bd 100644 --- a/db/historydb/views.go +++ b/db/historydb/views.go @@ -120,7 +120,7 @@ func (tx TxAPI) MarshalJSON() ([]byte, error) { // txWrite is an representatiion that merges common.L1Tx and common.L2Tx // in order to perform inserts into tx table -// EffectiveAmount and LoadEffectiveAmount are not set since they have default values in the DB +// EffectiveAmount and EffectiveDepositAmount are not set since they have default values in the DB type txWrite struct { // Generic IsL1 bool `meddler:"is_l1"` diff --git a/db/migrations/0001.sql b/db/migrations/0001.sql index 73434af..81ec48f 100644 --- a/db/migrations/0001.sql +++ b/db/migrations/0001.sql @@ -137,7 +137,7 @@ CREATE SEQUENCE tx_item_id; -- When tx is not forged: amount_success = false, deposit_amount_success = false -- When tx is forged: -- amount_success = false if the "effective amount" is 0, else true --- deposit_amount_success = false if the "effective load amount" is 0, else true +-- deposit_amount_success = false if the "effective deposit amount" is 0, else true -- -- However, in order to reduce the amount of updates, by default amount_success and deposit_amount_success will be set to true (when tx is unforged) -- whne they should be false. This can be worked around at a query level by checking if "batch_num IS NULL" (which indicates that the tx is unforged).